mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Move to libs
This commit is contained in:
35
libs/components/src/banner/banner.component.spec.ts
Normal file
35
libs/components/src/banner/banner.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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", () => {
|
||||
expect(component.useAlertRole).toBe(true);
|
||||
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();
|
||||
|
||||
expect(component.useAlertRole).toBe(false);
|
||||
const el = fixture.nativeElement.children[0];
|
||||
expect(el.getAttribute("role")).toBeNull();
|
||||
expect(el.getAttribute("aria-live")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user