1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

account for pre-set value of an angular form before the options are set (#17872)

This commit is contained in:
Nick Krantz
2025-12-09 09:31:12 -06:00
committed by GitHub
parent bbf9157ec0
commit 456f02958a
2 changed files with 35 additions and 0 deletions

View File

@@ -451,6 +451,24 @@ describe("ChipSelectComponent", () => {
expect(disabledMenuItem?.disabled).toBe(true);
});
it("should handle writeValue called before options are initialized", async () => {
const testApp = fixture.componentInstance;
component["rootTree"] = null;
component.writeValue("opt1");
expect(component["pendingValue"]).toBe("opt1");
expect(component["selectedOption"]).toBeUndefined();
testApp.options.set(testOptions);
fixture.detectChanges();
await fixture.whenStable();
expect(component["selectedOption"]?.value).toBe("opt1");
expect(component["pendingValue"]).toBeUndefined();
});
});
});