2022-04-25 18:02:09 +02:00
|
|
|
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
|
|
|
|
|
|
|
import { BannerComponent } from "./banner.component";
|
|
|
|
|
|
|
|
describe("BannerComponent", () => {
|
|
|
|
let component: BannerComponent;
|
|
|
|
let fixture: ComponentFixture<BannerComponent>;
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
|
|
|
await TestBed.configureTestingModule({
|
|
|
|
declarations: [BannerComponent],
|
|
|
|
}).compileComponents();
|
|
|
|
|
|
|
|
fixture = TestBed.createComponent(BannerComponent);
|
|
|
|
component = fixture.componentInstance;
|
|
|
|
fixture.detectChanges();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with alert", () => {
|
2022-05-12 17:33:49 +02:00
|
|
|
expect(component.useAlertRole).toBe(true);
|
2022-04-25 18:02:09 +02:00
|
|
|
const el = fixture.nativeElement.children[0];
|
|
|
|
expect(el.getAttribute("role")).toEqual("status");
|
|
|
|
expect(el.getAttribute("aria-live")).toEqual("polite");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("useAlertRole=false", () => {
|
|
|
|
component.useAlertRole = false;
|
|
|
|
fixture.autoDetectChanges();
|
|
|
|
|
2022-05-12 17:33:49 +02:00
|
|
|
expect(component.useAlertRole).toBe(false);
|
2022-04-25 18:02:09 +02:00
|
|
|
const el = fixture.nativeElement.children[0];
|
|
|
|
expect(el.getAttribute("role")).toBeNull();
|
|
|
|
expect(el.getAttribute("aria-live")).toBeNull();
|
|
|
|
});
|
|
|
|
});
|