1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-24 21:41:33 +01:00

[PM-5189] Working through jest tests for the AutofillOverlayContentService

This commit is contained in:
Cesar Gonzalez 2024-06-07 14:14:55 -05:00
parent 191797e6c2
commit e3510a9a05
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF

View File

@ -1450,5 +1450,31 @@ describe("AutofillOverlayContentService", () => {
expect(sendResponseSpy).toHaveBeenCalledWith(null);
});
});
describe("getSubFrameOffsetsFromWindowMessage", () => {
it("sends a message to the parent to calculate the sub frame positioning", () => {
jest.spyOn(globalThis.parent, "postMessage");
const subFrameId = 10;
sendMockExtensionMessage({
command: "getSubFrameOffsetsFromWindowMessage",
subFrameId,
});
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
{
command: "calculateSubFramePositioning",
subFrameData: {
url: window.location.href,
frameId: subFrameId,
left: 0,
top: 0,
parentFrameIds: [],
},
},
"*",
);
});
});
});
});