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
Branches
Tags
1 merge request!27OZG-6988 implement button
......@@ -24,3 +24,10 @@
-->
<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 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* 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 { getDataTestIdOf } from '../../../../../tech-shared/test/data-test';
import { StatistikContainerComponent } from './statistik-container.component';
describe('StatistikContainerComponent', () => {
let component: StatistikContainerComponent;
let fixture: ComponentFixture<StatistikContainerComponent>;
const evaluateAdditionalFieldsTestId: string = getDataTestIdOf('weitere-felder-auswerten-button');
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StatistikContainerComponent],
......@@ -41,7 +45,60 @@ describe('StatistikContainerComponent', () => {
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
describe('component', () => {
it('should create', () => {
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 @@
*/
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { ButtonComponent } from '@ods/system';
@Component({
selector: 'admin-statistik-container',
templateUrl: './statistik-container.component.html',
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