mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 00:53:23 +00:00
* Rename service-factory folder * Move cryptographic service factories * Move crypto models * Move crypto services * Move domain base class * Platform code owners * Move desktop log services * Move log files * Establish component library ownership * Move background listeners * Move background background * Move localization to Platform * Move browser alarms to Platform * Move browser state to Platform * Move CLI state to Platform * Move Desktop native concerns to Platform * Move flag and misc to Platform * Lint fixes * Move electron state to platform * Move web state to Platform * Move lib state to Platform * Fix broken tests * Rename interface to idiomatic TS * `npm run prettier` 🤖 * Resolve review feedback * Set platform as owners of web core and shared * Expand moved services * Fix test types --------- Co-authored-by: Hinton <hinton@users.noreply.github.com>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
|
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
|
|
import { SharedModule } from "../shared/shared.module";
|
|
import { I18nMockService } from "../utils/i18n-mock.service";
|
|
|
|
import { BannerComponent } from "./banner.component";
|
|
|
|
describe("BannerComponent", () => {
|
|
let component: BannerComponent;
|
|
let fixture: ComponentFixture<BannerComponent>;
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
imports: [SharedModule],
|
|
declarations: [BannerComponent],
|
|
providers: [
|
|
{
|
|
provide: I18nService,
|
|
useFactory: () =>
|
|
new I18nMockService({
|
|
close: "Close",
|
|
}),
|
|
},
|
|
],
|
|
}).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();
|
|
});
|
|
});
|