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:
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user