Skip to content
Snippets Groups Projects
Commit 461e1893 authored by Alexander Reifschneider's avatar Alexander Reifschneider
Browse files

Merge branch 'OZG-7774-statistic-new-menu-items' into 'main'

OZG-7774 add new menu items

See merge request !128
parents a847ba47 be5338cd
No related branches found
No related tags found
1 merge request!128OZG-7774 add new menu items
Showing
with 358 additions and 32 deletions
...@@ -300,7 +300,7 @@ describe('AppComponent', () => { ...@@ -300,7 +300,7 @@ describe('AppComponent', () => {
it('should navigate to statistik if aggregation mapping link exists', () => { it('should navigate to statistik if aggregation mapping link exists', () => {
component._navigateByConfiguration(createConfigurationResource([ConfigurationLinkRel.AGGREGATION_MAPPINGS])); component._navigateByConfiguration(createConfigurationResource([ConfigurationLinkRel.AGGREGATION_MAPPINGS]));
expect(router.navigate).toHaveBeenCalledWith(['/auswertungen']); expect(router.navigate).toHaveBeenCalledWith(['/statistik/auswertungen']);
}); });
it('should navigate to unavailable page if no link exists', () => { it('should navigate to unavailable page if no link exists', () => {
......
...@@ -23,5 +23,7 @@ ...@@ -23,5 +23,7 @@
*/ */
export enum ConfigurationLinkRel { export enum ConfigurationLinkRel {
SETTING = 'settings', SETTING = 'settings',
AGGREGATION_MAPPINGS = 'aggregationMappings', AGGREGATION_MAPPINGS = 'auswertungs',
DATENFREIGABE = 'datenfreigabes',
DATENANFRAGE = 'datenanfrages',
} }
<admin-menu [configurationStateResource]="configurationStateResource$ | async"></admin-menu> <admin-menu [configurationStateResource]="configurationStateResource$ | async" />
\ No newline at end of file
...@@ -3,8 +3,4 @@ ...@@ -3,8 +3,4 @@
<ods-icon icon name="mail" fill="text" /> <ods-icon icon name="mail" fill="text" />
</ods-nav-item> </ods-nav-item>
} }
@if (configurationStateResource.resource | hasLink: configurationLinkRel.AGGREGATION_MAPPINGS) { <admin-statistik-menu [configurationStateResource]="configurationStateResource" />
<ods-nav-item data-test-id="statistik-navigation" caption="Statistik" [path]="'/' + ROUTES.AGGREGATION_MAPPING">
<ods-icon icon name="statistic" fill="text" />
</ods-nav-item>
}
import { ConfigurationLinkRel } from '@admin-client/configuration-shared'; import { ConfigurationLinkRel } from '@admin-client/configuration-shared';
import { createEmptyStateResource, createStateResource, HasLinkPipe } from '@alfa-client/tech-shared'; import { createEmptyStateResource, createStateResource, HasLinkPipe } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils'; import { existsAsHtmlElement, getMockComponent, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IconComponent, NavItemComponent } from '@ods/system'; import { IconComponent, NavItemComponent } from '@ods/system';
import { createConfigurationResource } from 'libs/admin/configuration-shared/test/configuration'; import { createConfigurationResource } from 'libs/admin/configuration-shared/test/configuration';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { MenuComponent } from './menu.component'; import { MenuComponent } from './menu.component';
import { StatistikMenuComponent } from './statistik-menu/statistik-menu.component';
describe('MenuComponent', () => { describe('MenuComponent', () => {
let component: MenuComponent; let component: MenuComponent;
...@@ -17,8 +18,7 @@ describe('MenuComponent', () => { ...@@ -17,8 +18,7 @@ describe('MenuComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [MenuComponent, HasLinkPipe], imports: [MenuComponent, HasLinkPipe, MockComponent(NavItemComponent), MockComponent(IconComponent)],
declarations: [MockComponent(NavItemComponent), MockComponent(IconComponent)],
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(MenuComponent); fixture = TestBed.createComponent(MenuComponent);
...@@ -49,23 +49,11 @@ describe('MenuComponent', () => { ...@@ -49,23 +49,11 @@ describe('MenuComponent', () => {
}); });
}); });
describe('statistic navigation', () => { describe('statistik menu', () => {
it('should show if settings link is present', () => { it('should call with configurationStateResource', () => {
component.configurationStateResource = createStateResource( const statisticMenu: StatistikMenuComponent = getMockComponent(fixture, StatistikMenuComponent);
createConfigurationResource([ConfigurationLinkRel.AGGREGATION_MAPPINGS]),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, statistikNavigationSelector);
});
it('should hide if settings link is missing', () => {
component.configurationStateResource = createStateResource(createConfigurationResource());
fixture.detectChanges();
notExistsAsHtmlElement(fixture, statistikNavigationSelector); expect(statisticMenu.configurationStateResource).toBe(component.configurationStateResource);
}); });
}); });
}); });
...@@ -4,11 +4,12 @@ import { HasLinkPipe, StateResource } from '@alfa-client/tech-shared'; ...@@ -4,11 +4,12 @@ import { HasLinkPipe, StateResource } from '@alfa-client/tech-shared';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { IconComponent, NavItemComponent } from '@ods/system'; import { IconComponent, NavItemComponent } from '@ods/system';
import { StatistikMenuComponent } from './statistik-menu/statistik-menu.component';
@Component({ @Component({
selector: 'admin-menu', selector: 'admin-menu',
standalone: true, standalone: true,
imports: [CommonModule, NavItemComponent, IconComponent, HasLinkPipe], imports: [CommonModule, NavItemComponent, IconComponent, HasLinkPipe, StatistikMenuComponent],
templateUrl: './menu.component.html', templateUrl: './menu.component.html',
}) })
export class MenuComponent { export class MenuComponent {
......
@if (
configurationStateResource.resource
| hasAnyLink
: configurationLinkRel.AGGREGATION_MAPPINGS
: configurationLinkRel.DATENFREIGABE
: configurationLinkRel.DATENANFRAGE
) {
<ods-nav-headline label="Statistik" />
<div class="flex flex-col gap-2">
@if (configurationStateResource.resource | hasLink: configurationLinkRel.AGGREGATION_MAPPINGS) {
<ods-nav-item data-test-id="auswertung-navigation" caption="Auswertungen" [path]="'/' + ROUTES.AGGREGATION_MAPPING">
<ods-icon icon name="statistic" fill="text" />
</ods-nav-item>
}
@if (configurationStateResource.resource | hasLink: configurationLinkRel.DATENFREIGABE) {
<ods-nav-item data-test-id="datenfreigaben-navigation" caption="Datenfreigaben" [path]="'/' + ROUTES.DATENFREIGABEN">
<ods-icon icon name="bar-chart-arrow" fill="text" />
</ods-nav-item>
}
@if (configurationStateResource.resource | hasLink: configurationLinkRel.DATENANFRAGE) {
<ods-nav-item data-test-id="datenanfragen-navigation" caption="Datenanfragen" [path]="'/' + ROUTES.DATENANFRAGEN">
<ods-icon icon name="bubble-question-mark" fill="text" />
</ods-nav-item>
}
</div>
}
import { ConfigurationLinkRel } from '@admin-client/configuration-shared';
import { createEmptyStateResource, createStateResource, HasLinkPipe } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IconComponent, NavItemComponent } from '@ods/system';
import { createConfigurationResource } from 'libs/admin/configuration-shared/test/configuration';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { StatistikMenuComponent } from './statistik-menu.component';
describe('StatistikMenuComponent', () => {
let component: StatistikMenuComponent;
let fixture: ComponentFixture<StatistikMenuComponent>;
const auswertungNavigationSelector: string = getDataTestIdOf('auswertung-navigation');
const datenfreigabenNavigationSelector: string = getDataTestIdOf('datenfreigaben-navigation');
const datenanfragenNavigationSelector: string = getDataTestIdOf('datenanfragen-navigation');
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [StatistikMenuComponent, HasLinkPipe, MockComponent(NavItemComponent), MockComponent(IconComponent)],
}).compileComponents();
fixture = TestBed.createComponent(StatistikMenuComponent);
component = fixture.componentInstance;
component.configurationStateResource = createEmptyStateResource();
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('statistic navigation', () => {
describe('auswertung', () => {
it('should show if agregation mapping link is present', () => {
component.configurationStateResource = createStateResource(
createConfigurationResource([ConfigurationLinkRel.AGGREGATION_MAPPINGS]),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, auswertungNavigationSelector);
});
it('should hide if agregation mapping link is missing', () => {
component.configurationStateResource = createStateResource(createConfigurationResource());
fixture.detectChanges();
notExistsAsHtmlElement(fixture, auswertungNavigationSelector);
});
});
describe('datenfreigaben', () => {
it('should show if datenfreigabe link is present', () => {
component.configurationStateResource = createStateResource(
createConfigurationResource([ConfigurationLinkRel.DATENFREIGABE]),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, datenfreigabenNavigationSelector);
});
it('should hide if datenfreigabe link is missing', () => {
component.configurationStateResource = createStateResource(createConfigurationResource());
fixture.detectChanges();
notExistsAsHtmlElement(fixture, datenfreigabenNavigationSelector);
});
});
describe('datenanfragen', () => {
it('should show if datenanfrage link is present', () => {
component.configurationStateResource = createStateResource(
createConfigurationResource([ConfigurationLinkRel.DATENANFRAGE]),
);
fixture.detectChanges();
existsAsHtmlElement(fixture, datenanfragenNavigationSelector);
});
it('should hide if datenanfrage link is missing', () => {
component.configurationStateResource = createStateResource(createConfigurationResource());
fixture.detectChanges();
notExistsAsHtmlElement(fixture, datenanfragenNavigationSelector);
});
});
});
});
import { ConfigurationLinkRel, ConfigurationResource } from '@admin-client/configuration-shared';
import { ROUTES } from '@admin-client/shared';
import { HasAnyLinkPipe, HasLinkPipe, StateResource } from '@alfa-client/tech-shared';
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
import { IconComponent, NavHeadlineComponent, NavItemComponent } from '@ods/system';
@Component({
selector: 'admin-statistik-menu',
standalone: true,
imports: [CommonModule, NavItemComponent, IconComponent, HasLinkPipe, HasAnyLinkPipe, NavHeadlineComponent],
templateUrl: './statistik-menu.component.html',
})
export class StatistikMenuComponent {
@Input() configurationStateResource: StateResource<ConfigurationResource>;
public readonly configurationLinkRel = ConfigurationLinkRel;
public readonly ROUTES = ROUTES;
}
...@@ -28,7 +28,9 @@ export enum ROUTES { ...@@ -28,7 +28,9 @@ export enum ROUTES {
BENUTZER_ID = 'benutzer/:userid', BENUTZER_ID = 'benutzer/:userid',
ORGANISATIONSEINHEITEN = 'organisationseinheiten', ORGANISATIONSEINHEITEN = 'organisationseinheiten',
UNAVAILABLE = 'unavailable', UNAVAILABLE = 'unavailable',
AGGREGATION_MAPPING = 'auswertungen', AGGREGATION_MAPPING = 'statistik/auswertungen',
AGGREGATION_MAPPING_NEU = 'auswertungen/neu', AGGREGATION_MAPPING_NEU = 'statistik/auswertungen/neu',
AGGREGATION_MAPPING_ID = 'auswertungen/:aggregationMappingId', AGGREGATION_MAPPING_ID = 'statistik/auswertungen/:aggregationMappingId',
DATENFREIGABEN = 'statistik/datenfreigaben',
DATENANFRAGEN = 'statistik/datenanfragen',
} }
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M9 24L7.6 22.6L9.35 20.8C7.21667 20.5167 5.45833 19.9333 4.075 19.05C2.69167 18.1667 2 17.15 2 16C2 14.6167 2.9625 13.4375 4.8875 12.4625C6.8125 11.4875 9.18333 11 12 11C14.8167 11 17.1875 11.4875 19.1125 12.4625C21.0375 13.4375 22 14.6167 22 16C22 17.0333 21.4458 17.9583 20.3375 18.775C19.2292 19.5917 17.7833 20.2 16 20.6V18.55C17.2833 18.2167 18.2708 17.8042 18.9625 17.3125C19.6542 16.8208 20 16.3833 20 16C20 15.4667 19.2875 14.8333 17.8625 14.1C16.4375 13.3667 14.4833 13 12 13C9.51667 13 7.5625 13.3667 6.1375 14.1C4.7125 14.8333 4 15.4667 4 16C4 16.4 4.425 16.8792 5.275 17.4375C6.125 17.9958 7.33333 18.4167 8.9 18.7L7.6 17.4L9 16L13 20L9 24Z"
mask="url(#transparent-rect)" />
<path
d="M4.5 14.75V13.25H19.5V14.75H4.5ZM5.25 12.5V7.25H7.5V12.5H5.25ZM9 12.5V3.5H11.25V12.5H9ZM12.75 12.5V5.75H15V12.5H12.75ZM16.5 12.5V1.25H18.75V12.5H16.5Z" />
<mask id="transparent-rect">
<rect x="0" y="0" width="100%" height="100%" fill="white" />
<path d="M4 0H20V16H4V0Z" fill="black" />
</mask>
</svg>
\ No newline at end of file
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M12 22L11.75 19H11.5C9.13333 19 7.125 18.175 5.475 16.525C3.825 14.875 3 12.8667 3 10.5C3 8.13333 3.825 6.125 5.475 4.475C7.125 2.825 9.13333 2 11.5 2C12.6833 2 13.7875 2.22083 14.8125 2.6625C15.8375 3.10417 16.7375 3.7125 17.5125 4.4875C18.2875 5.2625 18.8958 6.1625 19.3375 7.1875C19.7792 8.2125 20 9.31667 20 10.5C20 11.75 19.7958 12.95 19.3875 14.1C18.9792 15.25 18.4208 16.3167 17.7125 17.3C17.0042 18.2833 16.1625 19.175 15.1875 19.975C14.2125 20.775 13.15 21.45 12 22ZM14 18.35C15.1833 17.35 16.1458 16.1792 16.8875 14.8375C17.6292 13.4958 18 12.05 18 10.5C18 8.68333 17.3708 7.14583 16.1125 5.8875C14.8542 4.62917 13.3167 4 11.5 4C9.68333 4 8.14583 4.62917 6.8875 5.8875C5.62917 7.14583 5 8.68333 5 10.5C5 12.3167 5.62917 13.8542 6.8875 15.1125C8.14583 16.3708 9.68333 17 11.5 17H14V18.35ZM11.475 15.975C11.7583 15.975 12 15.875 12.2 15.675C12.4 15.475 12.5 15.2333 12.5 14.95C12.5 14.6667 12.4 14.425 12.2 14.225C12 14.025 11.7583 13.925 11.475 13.925C11.1917 13.925 10.95 14.025 10.75 14.225C10.55 14.425 10.45 14.6667 10.45 14.95C10.45 15.2333 10.55 15.475 10.75 15.675C10.95 15.875 11.1917 15.975 11.475 15.975ZM10.75 12.8H12.25C12.25 12.3 12.3 11.95 12.4 11.75C12.5 11.55 12.8167 11.1833 13.35 10.65C13.65 10.35 13.9 10.025 14.1 9.675C14.3 9.325 14.4 8.95 14.4 8.55C14.4 7.7 14.1125 7.0625 13.5375 6.6375C12.9625 6.2125 12.2833 6 11.5 6C10.7667 6 10.15 6.20417 9.65 6.6125C9.15 7.02083 8.8 7.51667 8.6 8.1L10 8.65C10.0833 8.36667 10.2417 8.0875 10.475 7.8125C10.7083 7.5375 11.05 7.4 11.5 7.4C11.95 7.4 12.2875 7.525 12.5125 7.775C12.7375 8.025 12.85 8.3 12.85 8.6C12.85 8.88333 12.7667 9.1375 12.6 9.3625C12.4333 9.5875 12.2333 9.81667 12 10.05C11.4167 10.55 11.0625 10.9458 10.9375 11.2375C10.8125 11.5292 10.75 12.05 10.75 12.8Z" />
</svg>
\ No newline at end of file
...@@ -54,6 +54,7 @@ export * from './lib/instant-search/instant-search/instant-search.model'; ...@@ -54,6 +54,7 @@ export * from './lib/instant-search/instant-search/instant-search.model';
export * from './lib/link/link.component'; export * from './lib/link/link.component';
export * from './lib/list/list-item/list-item.component'; export * from './lib/list/list-item/list-item.component';
export * from './lib/list/list.component'; export * from './lib/list/list.component';
export * from './lib/navbar/nav-headline/nav-headline.component';
export * from './lib/navbar/nav-item/nav-item.component'; export * from './lib/navbar/nav-item/nav-item.component';
export * from './lib/navbar/navbar/navbar.component'; export * from './lib/navbar/navbar/navbar.component';
export * from './lib/testbtn/testbtn.component'; export * from './lib/testbtn/testbtn.component';
......
/*
* Copyright (C) 2025 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BadgeComponent } from './badge.component';
describe('BadgeComponent', () => {
let component: BadgeComponent;
let fixture: ComponentFixture<BadgeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BadgeComponent],
}).compileComponents();
fixture = TestBed.createComponent(BadgeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
/*
* Copyright (C) 2025 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
@Component({
selector: 'ods-badge',
standalone: true,
imports: [CommonModule],
template: `<p class="rounded-full bg-primary px-2 py-0.5 text-sm text-whitetext">{{ name }}</p>`,
styles: [':host {@apply block w-fit}'],
})
export class BadgeComponent {
@Input({ required: true }) name!: string;
}
/*
* Copyright (C) 2025 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { type Meta, type StoryObj } from '@storybook/angular';
import { BadgeComponent } from './badge.component';
const meta: Meta = {
title: 'Badge',
excludeStories: /.*Data$/,
component: BadgeComponent,
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: 'The badge with some text',
},
},
},
};
export default meta;
type Story = StoryObj<BadgeComponent>;
export const Default: Story = {
args: { name: 'NEU' },
};
...@@ -52,8 +52,10 @@ const ICONS_LIST: string[] = [ ...@@ -52,8 +52,10 @@ const ICONS_LIST: string[] = [
'archive', 'archive',
'arrow-back', 'arrow-back',
'attachment', 'attachment',
'bar-chart-arrow',
'bescheid-generate', 'bescheid-generate',
'bescheid-upload', 'bescheid-upload',
'bubble-question-mark',
'check-circle', 'check-circle',
'check', 'check',
'close', 'close',
......
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavHeadlineComponent } from './nav-headline.component';
describe('NavHeadlineComponent', () => {
let component: NavHeadlineComponent;
let fixture: ComponentFixture<NavHeadlineComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NavHeadlineComponent],
}).compileComponents();
fixture = TestBed.createComponent(NavHeadlineComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
@Component({
selector: 'ods-nav-headline',
standalone: true,
imports: [CommonModule],
template: `<p class="mx-4 my-2 font-medium">{{ label }}</p>`,
})
export class NavHeadlineComponent {
@Input({ required: true }) label!: string;
}
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { convertForDataTest, ConvertForDataTestPipe } from '@alfa-client/tech-shared'; import { convertForDataTest, ConvertForDataTestPipe } from '@alfa-client/tech-shared';
import { getElementFromFixture, Mock, mock } from '@alfa-client/test-utils'; import { existsAsHtmlElement, getElementFromFixture, Mock, mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { importProvidersFrom } from '@angular/core'; import { importProvidersFrom } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router, RouterModule } from '@angular/router'; import { Router, RouterModule } from '@angular/router';
...@@ -33,6 +33,8 @@ describe('NavItemComponent', () => { ...@@ -33,6 +33,8 @@ describe('NavItemComponent', () => {
let component: NavItemComponent; let component: NavItemComponent;
let fixture: ComponentFixture<NavItemComponent>; let fixture: ComponentFixture<NavItemComponent>;
const badgeLocator: string = getDataTestIdOf('nav-item-badge');
const router: Mock<Router> = mock(Router); const router: Mock<Router> = mock(Router);
beforeEach(async () => { beforeEach(async () => {
...@@ -88,5 +90,23 @@ describe('NavItemComponent', () => { ...@@ -88,5 +90,23 @@ describe('NavItemComponent', () => {
expect(fixture.nativeElement.getAttribute('role')).toBe('menuitem'); expect(fixture.nativeElement.getAttribute('role')).toBe('menuitem');
}); });
}); });
describe('badge', () => {
it('should show', () => {
component.badge = true;
fixture.detectChanges();
existsAsHtmlElement(fixture, badgeLocator);
});
it('should hide', () => {
component.badge = false;
fixture.detectChanges();
notExistsAsHtmlElement(fixture, badgeLocator);
});
});
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment