[PM-6213] Fix Inline Autofill Menu Erasing Filled Form on Hilton.com (#7952)
* [PM-6213] Fix Inline Autofill Menu Erasing Filled Form on Hilton.com * [PM-6213] Fixing jest test
This commit is contained in:
parent
f9539ef68b
commit
e894ecda25
|
@ -208,7 +208,19 @@ describe("AutofillInit", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("updates the isCurrentlyFilling properties of the overlay and focus the recent field after filling", async () => {
|
||||
it("removes the overlay when filling the form", async () => {
|
||||
const blurAndRemoveOverlaySpy = jest.spyOn(autofillInit as any, "blurAndRemoveOverlay");
|
||||
sendExtensionRuntimeMessage({
|
||||
command: "fillForm",
|
||||
fillScript,
|
||||
pageDetailsUrl: window.location.href,
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(blurAndRemoveOverlaySpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates the isCurrentlyFilling property of the overlay to true after filling", async () => {
|
||||
jest.useFakeTimers();
|
||||
jest.spyOn(autofillInit as any, "updateOverlayIsCurrentlyFilling");
|
||||
jest
|
||||
|
@ -228,9 +240,6 @@ describe("AutofillInit", () => {
|
|||
fillScript,
|
||||
);
|
||||
expect(autofillInit["updateOverlayIsCurrentlyFilling"]).toHaveBeenNthCalledWith(2, false);
|
||||
expect(
|
||||
autofillInit["autofillOverlayContentService"].focusMostRecentOverlayField,
|
||||
).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("skips attempting to focus the most recent field if the autofillOverlayContentService is not present", async () => {
|
||||
|
|
|
@ -98,6 +98,7 @@ class AutofillInit implements AutofillInitInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
this.blurAndRemoveOverlay();
|
||||
this.updateOverlayIsCurrentlyFilling(true);
|
||||
await this.insertAutofillContentService.fillForm(fillScript);
|
||||
|
||||
|
@ -105,10 +106,7 @@ class AutofillInit implements AutofillInitInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.updateOverlayIsCurrentlyFilling(false);
|
||||
this.autofillOverlayContentService.focusMostRecentOverlayField();
|
||||
}, 250);
|
||||
setTimeout(() => this.updateOverlayIsCurrentlyFilling(false), 250);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue