Skip to content
Snippets Groups Projects
Verified Commit 8705e4b6 authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

OZG-6988 implement button

Sub task: OZG-7446
parent 63eb36aa
No related branches found
No related tags found
1 merge request!27OZG-6988 implement button
...@@ -24,3 +24,10 @@ ...@@ -24,3 +24,10 @@
--> -->
<h1 class="heading-1" data-test-id="statistik-header-text">Statistik</h1> <h1 class="heading-1" data-test-id="statistik-header-text">Statistik</h1>
@if (!evaluateAdditionalFields) {
<ods-button
text="Weitere Felder auswerten"
(clickEmitter)="onEvaluateAdditionalFields()"
data-test-id="weitere-felder-auswerten-button"
></ods-button>
}
...@@ -21,13 +21,17 @@ ...@@ -21,13 +21,17 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { existsAsHtmlElement, notExistsAsHtmlElement, triggerEvent } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { getDataTestIdOf } from '../../../../../tech-shared/test/data-test';
import { StatistikContainerComponent } from './statistik-container.component'; import { StatistikContainerComponent } from './statistik-container.component';
describe('StatistikContainerComponent', () => { describe('StatistikContainerComponent', () => {
let component: StatistikContainerComponent; let component: StatistikContainerComponent;
let fixture: ComponentFixture<StatistikContainerComponent>; let fixture: ComponentFixture<StatistikContainerComponent>;
const evaluateAdditionalFieldsTestId: string = getDataTestIdOf('weitere-felder-auswerten-button');
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [StatistikContainerComponent], imports: [StatistikContainerComponent],
...@@ -41,7 +45,60 @@ describe('StatistikContainerComponent', () => { ...@@ -41,7 +45,60 @@ describe('StatistikContainerComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}); });
describe('component', () => {
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it('should set default values', () => {
expect(component.evaluateAdditionalFields).toBeDefined();
expect(component.evaluateAdditionalFields).toBeFalsy();
});
describe('onEvaluateAdditionalFieldsClick', () => {
it('should update component state', () => {
component.evaluateAdditionalFields = false;
component.onEvaluateAdditionalFields();
expect(component.evaluateAdditionalFields).toBeTruthy();
});
});
});
describe('template', () => {
describe('weiter felder auswerten button', () => {
it('should exists', () => {
fixture.detectChanges();
existsAsHtmlElement(fixture, evaluateAdditionalFieldsTestId);
});
it('should NOT exists', () => {
component.evaluateAdditionalFields = true;
fixture.detectChanges();
notExistsAsHtmlElement(fixture, evaluateAdditionalFieldsTestId);
});
describe('output', () => {
describe('clickEmitter', () => {
it('should call handler', () => {
component.onEvaluateAdditionalFields = jest.fn();
component.evaluateAdditionalFields = false;
fixture.detectChanges();
triggerEvent({
fixture,
elementSelector: evaluateAdditionalFieldsTestId,
name: 'clickEmitter',
});
expect(component.onEvaluateAdditionalFields).toHaveBeenCalled();
});
});
});
});
});
}); });
...@@ -23,11 +23,18 @@ ...@@ -23,11 +23,18 @@
*/ */
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ButtonComponent } from '@ods/system';
@Component({ @Component({
selector: 'admin-statistik-container', selector: 'admin-statistik-container',
templateUrl: './statistik-container.component.html', templateUrl: './statistik-container.component.html',
standalone: true, standalone: true,
imports: [CommonModule], imports: [CommonModule, ButtonComponent],
}) })
export class StatistikContainerComponent {} export class StatistikContainerComponent {
public evaluateAdditionalFields: boolean = false;
public onEvaluateAdditionalFields(): void {
this.evaluateAdditionalFields = true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment