Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"eslint-config-prettier",
"eslint-import-resolver-typescript",
"eslint-plugin-import",
"eslint-plugin-jest",
"eslint-plugin-rxjs-angular",
"eslint-plugin-rxjs",
"eslint-plugin-storybook",
Expand Down Expand Up @@ -391,6 +392,7 @@
"eslint-config-prettier",
"eslint-import-resolver-typescript",
"eslint-plugin-import",
"eslint-plugin-jest",
"eslint-plugin-rxjs-angular",
"eslint-plugin-rxjs",
"eslint-plugin-storybook",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe("AccountSwitcherService", () => {

expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: null });

expect(removeListenerSpy).toBeCalledTimes(1);
expect(removeListenerSpy).toHaveBeenCalledTimes(1);
});

it("initiates an account switch with an account id", async () => {
Expand All @@ -199,13 +199,13 @@ describe("AccountSwitcherService", () => {
await selectAccountPromise;

expect(messagingService.send).toHaveBeenCalledWith("switchAccount", { userId: "1" });
expect(messagingService.send).toBeCalledWith(
expect(messagingService.send).toHaveBeenCalledWith(
"switchAccount",
matches((payload) => {
return payload.userId === "1";
}),
);
expect(removeListenerSpy).toBeCalledTimes(1);
expect(removeListenerSpy).toHaveBeenCalledTimes(1);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ describe("AutoSubmitLoginBackground", () => {
url: validAutoSubmitUrl,
tabId: webRequestDetails.tabId,
});
expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
url: [{ hostEquals: validAutoSubmitHost }],
});
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
expect.any(Function),
{
url: [{ hostEquals: validAutoSubmitHost }],
},
);
});

it("sets up the auto-submit workflow when the web request occurs in a sub frame and the initiator of the request is a valid auto-submit host", async () => {
Expand All @@ -145,9 +148,12 @@ describe("AutoSubmitLoginBackground", () => {

triggerWebRequestOnBeforeRequestEvent(webRequestDetails);

expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
url: [{ hostEquals: subFrameHost }],
});
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
expect.any(Function),
{
url: [{ hostEquals: subFrameHost }],
},
);
});

describe("injecting the auto-submit login content script", () => {
Expand Down Expand Up @@ -182,7 +188,7 @@ describe("AutoSubmitLoginBackground", () => {
triggerWebNavigationOnCompletedEvent(webNavigationDetails);
await flushPromises();

expect(scriptInjectorService.inject).toBeCalledWith({
expect(scriptInjectorService.inject).toHaveBeenCalledWith({
tabId: webRequestDetails.tabId,
injectDetails: {
file: "content/auto-submit-login.js",
Expand Down Expand Up @@ -320,7 +326,7 @@ describe("AutoSubmitLoginBackground", () => {

triggerWebRequestOnBeforeRequestEvent(webRequestDetails);

expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
autoSubmitLoginBackground["handleAutoSubmitHostNavigationCompleted"],
{ url: [{ hostEquals: validAutoSubmitHost }] },
);
Expand Down Expand Up @@ -440,9 +446,12 @@ describe("AutoSubmitLoginBackground", () => {
}),
);

expect(chrome.webNavigation.onCompleted.addListener).toBeCalledWith(expect.any(Function), {
url: [{ hostEquals: validAutoSubmitHost }],
});
expect(chrome.webNavigation.onCompleted.addListener).toHaveBeenCalledWith(
expect.any(Function),
{
url: [{ hostEquals: validAutoSubmitHost }],
},
);
});
});

Expand Down Expand Up @@ -491,7 +500,7 @@ describe("AutoSubmitLoginBackground", () => {
sendMockExtensionMessage(message, sender);
await flushPromises();

expect(autofillService.doAutoFillOnTab).toBeCalledWith(
expect(autofillService.doAutoFillOnTab).toHaveBeenCalledWith(
[
{
frameId: sender.frameId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ describe("ContextMenuClickedHandler", () => {
it("can generate password", async () => {
await sut.run(createData(GENERATE_PASSWORD_ID), { id: 5 } as any);

expect(generatePasswordToClipboard).toBeCalledTimes(1);
expect(generatePasswordToClipboard).toHaveBeenCalledTimes(1);

expect(generatePasswordToClipboard).toBeCalledWith({
expect(generatePasswordToClipboard).toHaveBeenCalledWith({
id: 5,
});
});
Expand All @@ -208,9 +208,9 @@ describe("ContextMenuClickedHandler", () => {

await sut.run(createData(`${AUTOFILL_ID}_1`, AUTOFILL_ID), { id: 5 } as any);

expect(autofill).toBeCalledTimes(1);
expect(autofill).toHaveBeenCalledTimes(1);

expect(autofill).toBeCalledWith({ id: 5 }, cipher);
expect(autofill).toHaveBeenCalledWith({ id: 5 }, cipher);
});

it("copies username to clipboard", async () => {
Expand All @@ -222,7 +222,7 @@ describe("ContextMenuClickedHandler", () => {
url: "https://test.com",
} as any);

expect(copyToClipboard).toBeCalledTimes(1);
expect(copyToClipboard).toHaveBeenCalledTimes(1);

expect(copyToClipboard).toHaveBeenCalledWith({
text: "TEST_USERNAME",
Expand All @@ -239,7 +239,7 @@ describe("ContextMenuClickedHandler", () => {
url: "https://test.com",
} as any);

expect(copyToClipboard).toBeCalledTimes(1);
expect(copyToClipboard).toHaveBeenCalledTimes(1);

expect(copyToClipboard).toHaveBeenCalledWith({
text: "TEST_PASSWORD",
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/autofill/content/autofill-init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ describe("AutofillInit", () => {
await flushPromises();

expect(autofillInit["collectAutofillContentService"].getPageDetails).toHaveBeenCalled();
expect(sendResponse).toBeCalledWith(pageDetails);
expect(sendResponse).toHaveBeenCalledWith(pageDetails);
expect(chrome.runtime.sendMessage).not.toHaveBeenCalledWith({
command: "collectPageDetailsResponse",
tab: message.tab,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe("AutofillInlineMenuList", () => {

firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect((secondFillCipherElement as HTMLElement).focus).toBeCalled();
expect((secondFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
});

it("directs focus to the first item in the cipher list if no cipher is present after the current one when pressing ArrowDown and no new item button exists", () => {
Expand All @@ -415,7 +415,7 @@ describe("AutofillInlineMenuList", () => {

lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect((firstFillCipherElement as HTMLElement).focus).toBeCalled();
expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
});

it("directs focus to the new item button if no cipher is present after the current one when pressing ArrowDown", async () => {
Expand All @@ -435,7 +435,7 @@ describe("AutofillInlineMenuList", () => {

lastFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled();
expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled();
});

it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => {
Expand All @@ -449,7 +449,7 @@ describe("AutofillInlineMenuList", () => {

secondFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));

expect((firstFillCipherElement as HTMLElement).focus).toBeCalled();
expect((firstFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
});

it("directs focus to the last item in the cipher list if no cipher is present before the current one when pressing ArrowUp", () => {
Expand All @@ -463,7 +463,7 @@ describe("AutofillInlineMenuList", () => {

firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));

expect((lastFillCipherElement as HTMLElement).focus).toBeCalled();
expect((lastFillCipherElement as HTMLElement).focus).toHaveBeenCalled();
});

it("directs focus to the new item button if no cipher is present before the current one when pressing ArrowUp", async () => {
Expand All @@ -483,7 +483,7 @@ describe("AutofillInlineMenuList", () => {

firstFillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));

expect(autofillInlineMenuList["newItemButtonElement"].focus).toBeCalled();
expect(autofillInlineMenuList["newItemButtonElement"].focus).toHaveBeenCalled();
});

it("allows the user to move keyboard focus to the view cipher button on ArrowRight", () => {
Expand All @@ -495,7 +495,7 @@ describe("AutofillInlineMenuList", () => {

fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" }));

expect((viewCipherButton as HTMLElement).focus).toBeCalled();
expect((viewCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => {
Expand All @@ -505,7 +505,7 @@ describe("AutofillInlineMenuList", () => {

fillCipherElement.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" }));

expect((fillCipherElement as HTMLElement).focus).not.toBeCalled();
expect((fillCipherElement as HTMLElement).focus).not.toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -540,7 +540,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowLeft" }));

expect((fillCipherButton as HTMLElement).focus).toBeCalled();
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("allows the user to move keyboard to the next cipher element on ArrowDown", () => {
Expand All @@ -553,7 +553,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect((secondFillCipherButton as HTMLElement).focus).toBeCalled();
expect((secondFillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("allows the user to move keyboard focus to the previous cipher element on ArrowUp", () => {
Expand All @@ -566,7 +566,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));

expect((firstFillCipherButton as HTMLElement).focus).toBeCalled();
expect((firstFillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("ignores keyup events that do not include ArrowUp, ArrowDown, or ArrowRight", () => {
Expand All @@ -576,7 +576,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowRight" }));

expect((viewCipherButton as HTMLElement).focus).not.toBeCalled();
expect((viewCipherButton as HTMLElement).focus).not.toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -808,7 +808,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect((fillCipherButton as HTMLElement).focus).toBeCalled();
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("skips the passkeys heading when the user presses ArrowDown to focus the first list item", () => {
Expand All @@ -820,7 +820,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowDown" }));

expect((fillCipherButton as HTMLElement).focus).toBeCalled();
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});

it("skips the logins heading when the user presses ArrowUp to focus the previous list item", () => {
Expand All @@ -832,7 +832,7 @@ describe("AutofillInlineMenuList", () => {

viewCipherButton.dispatchEvent(new KeyboardEvent("keyup", { code: "ArrowUp" }));

expect((fillCipherButton as HTMLElement).focus).toBeCalled();
expect((fillCipherButton as HTMLElement).focus).toHaveBeenCalled();
});
});
});
Expand Down Expand Up @@ -914,7 +914,7 @@ describe("AutofillInlineMenuList", () => {
new KeyboardEvent("keyup", { code: "ArrowRight" }),
);

expect((refreshGeneratedPasswordButton as HTMLElement).focus).toBeCalled();
expect((refreshGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled();
});
});
});
Expand Down Expand Up @@ -984,7 +984,7 @@ describe("AutofillInlineMenuList", () => {
new KeyboardEvent("keyup", { code: "ArrowLeft" }),
);

expect((fillGeneratedPasswordButton as HTMLElement).focus).toBeCalled();
expect((fillGeneratedPasswordButton as HTMLElement).focus).toHaveBeenCalled();
});
});
});
Expand Down Expand Up @@ -1207,7 +1207,7 @@ describe("AutofillInlineMenuList", () => {

postWindowMessage({ command: "focusAutofillInlineMenuList", token: "test-token" });

expect((unlockButton as HTMLElement).focus).toBeCalled();
expect((unlockButton as HTMLElement).focus).toHaveBeenCalled();
});

it("focuses the new item button element if the cipher list is empty", async () => {
Expand All @@ -1219,7 +1219,7 @@ describe("AutofillInlineMenuList", () => {

postWindowMessage({ command: "focusAutofillInlineMenuList", token: "test-token" });

expect((newItemButton as HTMLElement).focus).toBeCalled();
expect((newItemButton as HTMLElement).focus).toHaveBeenCalled();
});

it("focuses the first cipher button element if the cipher list is populated", () => {
Expand All @@ -1230,7 +1230,7 @@ describe("AutofillInlineMenuList", () => {

postWindowMessage({ command: "focusAutofillInlineMenuList", token: "test-token" });

expect((firstCipherItem as HTMLElement).focus).toBeCalled();
expect((firstCipherItem as HTMLElement).focus).toHaveBeenCalled();
});
});

Expand Down
Loading
Loading