[PM-8833] Fixing broken jest tests for AutofillInlineMenuList

This commit is contained in:
Cesar Gonzalez 2024-09-26 09:38:16 -05:00
parent caeedb7d23
commit 61bcb8b78a
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
3 changed files with 6 additions and 6 deletions

View File

@ -2177,7 +2177,7 @@ exports[`AutofillInlineMenuList initAutofillInlineMenuList the locked inline men
class="locked-inline-menu inline-menu-list-message"
id="locked-inline-menu-description"
>
unlockYourAccount
unlockYourAccountToViewAutofillSuggestions
</div>
<div
class="inline-menu-list-button-container"

View File

@ -228,6 +228,7 @@ describe("AutofillInlineMenuList", () => {
describe("fill cipher button event listeners", () => {
beforeEach(() => {
postWindowMessage(createInitAutofillInlineMenuListMessageMock({ portKey }));
jest.spyOn(autofillInlineMenuList as any, "isListHovered").mockReturnValue(true);
});
describe("filling a cipher", () => {
@ -736,8 +737,8 @@ describe("AutofillInlineMenuList", () => {
it("does not post a `checkAutofillInlineMenuButtonFocused` message if the inline menu list is currently hovered", () => {
jest.spyOn(globalThis.document, "hasFocus").mockReturnValue(false);
jest
.spyOn(autofillInlineMenuList["inlineMenuListContainer"], "matches")
.mockReturnValue(true);
.spyOn(autofillInlineMenuList["inlineMenuListContainer"], "querySelector")
.mockReturnValue(autofillInlineMenuList["inlineMenuListContainer"]);
postWindowMessage({ command: "checkAutofillInlineMenuListFocused" });
@ -747,8 +748,8 @@ describe("AutofillInlineMenuList", () => {
it("posts a `checkAutofillInlineMenuButtonFocused` message to the parent if the inline menu is not currently focused", () => {
jest.spyOn(globalThis.document, "hasFocus").mockReturnValue(false);
jest
.spyOn(autofillInlineMenuList["inlineMenuListContainer"], "matches")
.mockReturnValue(false);
.spyOn(autofillInlineMenuList["inlineMenuListContainer"], "querySelector")
.mockReturnValue(null);
postWindowMessage({ command: "checkAutofillInlineMenuListFocused" });

View File

@ -1,6 +1,5 @@
import "@webcomponents/custom-elements";
import "lit/polyfill-support.js";
import { HTMLElement } from "@webcomponents/custom-elements/src/Patch/Native";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { EVENTS, UPDATE_PASSKEYS_HEADINGS_ON_SCROLL } from "@bitwarden/common/autofill/constants";