Skip to content

Commit

Permalink
test(sbb-menu): fix flickering menu test on webkit (#3241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB authored and github-actions committed Nov 25, 2024
1 parent 2203396 commit fca5cbc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/elements/menu/menu/menu.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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<HTMLDivElement>('.sbb-menu')!;

trigger.click();
Expand Down

0 comments on commit fca5cbc

Please sign in to comment.