Skip to content

Commit 01cfcbb

Browse files
fix broken tests asserting disabled attr
1 parent a18f983 commit 01cfcbb

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

apps/browser/src/vault/popup/components/vault-v2/vault-generator-dialog/vault-generator-dialog.component.spec.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ describe("VaultGeneratorDialogComponent", () => {
7676
component.onValueGenerated("test-password");
7777
fixture.detectChanges();
7878

79-
const button = fixture.debugElement.query(
80-
By.css("[data-testid='select-button']"),
81-
).nativeElement;
82-
expect(button.disabled).toBe(false);
79+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
80+
expect(button.attributes["aria-disabled"]).toBe(undefined);
8381
});
8482

8583
it("should disable the button if no value has been generated", () => {
@@ -90,10 +88,8 @@ describe("VaultGeneratorDialogComponent", () => {
9088
generator.algorithmSelected.emit({ useGeneratedValue: "Use Password" } as any);
9189
fixture.detectChanges();
9290

93-
const button = fixture.debugElement.query(
94-
By.css("[data-testid='select-button']"),
95-
).nativeElement;
96-
expect(button.disabled).toBe(true);
91+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
92+
expect(button.attributes["aria-disabled"]).toBe("true");
9793
});
9894

9995
it("should disable the button if no algorithm is selected", () => {
@@ -104,10 +100,8 @@ describe("VaultGeneratorDialogComponent", () => {
104100
generator.valueGenerated.emit("test-password");
105101
fixture.detectChanges();
106102

107-
const button = fixture.debugElement.query(
108-
By.css("[data-testid='select-button']"),
109-
).nativeElement;
110-
expect(button.disabled).toBe(true);
103+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
104+
expect(button.attributes["aria-disabled"]).toBe("true");
111105
});
112106

113107
it("should update button text when algorithm is selected", () => {

apps/web/src/app/vault/components/web-generator-dialog/web-generator-dialog.component.spec.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@ describe("WebVaultGeneratorDialogComponent", () => {
7070
generator.valueGenerated.emit("test-password");
7171
fixture.detectChanges();
7272

73-
const button = fixture.debugElement.query(
74-
By.css("[data-testid='select-button']"),
75-
).nativeElement;
76-
expect(button.disabled).toBe(false);
73+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
74+
expect(button.attributes["aria-disabled"]).toBe(undefined);
7775
});
7876

7977
it("should disable the button if no value has been generated", () => {
@@ -84,10 +82,8 @@ describe("WebVaultGeneratorDialogComponent", () => {
8482
generator.algorithmSelected.emit({ useGeneratedValue: "Use Password" } as any);
8583
fixture.detectChanges();
8684

87-
const button = fixture.debugElement.query(
88-
By.css("[data-testid='select-button']"),
89-
).nativeElement;
90-
expect(button.disabled).toBe(true);
85+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
86+
expect(button.attributes["aria-disabled"]).toBe("true");
9187
});
9288

9389
it("should disable the button if no algorithm is selected", () => {
@@ -98,10 +94,8 @@ describe("WebVaultGeneratorDialogComponent", () => {
9894
generator.valueGenerated.emit("test-password");
9995
fixture.detectChanges();
10096

101-
const button = fixture.debugElement.query(
102-
By.css("[data-testid='select-button']"),
103-
).nativeElement;
104-
expect(button.disabled).toBe(true);
97+
const button = fixture.debugElement.query(By.css("[data-testid='select-button']"));
98+
expect(button.attributes["aria-disabled"]).toBe("true");
10599
});
106100

107101
it("should close with selected value when confirmed", () => {

0 commit comments

Comments
 (0)