1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00: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

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: [],
},
},
"*",
);
});
});
});
});