From fca5cbc818c6a1be3ec5cf3b16586120b06e7572 Mon Sep 17 00:00:00 2001 From: Jeri Peier Date: Mon, 25 Nov 2024 15:00:27 +0100 Subject: [PATCH] test(sbb-menu): fix flickering menu test on webkit (#3241) --- src/elements/menu/menu/menu.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/elements/menu/menu/menu.spec.ts b/src/elements/menu/menu/menu.spec.ts index dac178930a..15eeb960ce 100644 --- a/src/elements/menu/menu/menu.spec.ts +++ b/src/elements/menu/menu/menu.spec.ts @@ -1,8 +1,9 @@ -import { assert, expect } from '@open-wc/testing'; +import { assert, aTimeout, expect } from '@open-wc/testing'; import { sendKeys, setViewport } from '@web/test-runner-commands'; import { html } from 'lit/static-html.js'; import type { SbbButtonElement } from '../../button.js'; +import { isWebkit } from '../../core/dom.js'; import { fixture, tabKey } from '../../core/testing/private.js'; import { EventSpy, waitForLitRender } from '../../core/testing.js'; @@ -168,6 +169,12 @@ describe(`sbb-menu`, () => { const willOpenEventSpy = new EventSpy(SbbMenuElement.events.willOpen); const didOpenEventSpy = new EventSpy(SbbMenuElement.events.didOpen); await setViewport({ width: 1200, height: 800 }); + if (isWebkit) { + // Needed to let media queries get applied on Webkit + // TODO: Figure out why + await aTimeout(50); + } + const menu: HTMLDivElement = element.shadowRoot!.querySelector('.sbb-menu')!; trigger.click();