diff --git a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts index 673f7326c1..cf298b19ac 100644 --- a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts +++ b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.spec.ts @@ -96,6 +96,17 @@ describe("UriOptionComponent", () => { expect(component["uriForm"].enabled).toBe(false); }); + it("should update form when `writeValue` is invoked", () => { + expect(component["uriForm"].value).toEqual({ uri: null, matchDetection: null }); + + component.writeValue({ uri: "example.com", matchDetection: UriMatchStrategy.Exact }); + + expect(component["uriForm"].value).toEqual({ + uri: "example.com", + matchDetection: UriMatchStrategy.Exact, + }); + }); + describe("match detection", () => { it("should hide the match detection select by default", () => { fixture.detectChanges(); diff --git a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts index 26f59ba9c1..a7741ae1bc 100644 --- a/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts +++ b/libs/vault/src/cipher-form/components/autofill-options/uri-option.component.ts @@ -149,12 +149,12 @@ export class UriOptionComponent implements ControlValueAccessor { } // NG_VALUE_ACCESSOR implementation - writeValue(value: any): void { + writeValue(value: { uri: string; matchDetection: UriMatchStrategySetting | null }): void { if (value) { this.uriForm.setValue( { uri: value.uri ?? "", - matchDetection: value.match ?? null, + matchDetection: value.matchDetection ?? null, }, { emitEvent: false }, );