Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
30 changes: 30 additions & 0 deletions packages/web-components/src/menu-list/menu-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,36 @@
await expect(firstItem).toBeFocused();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-web-components/Accordion 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Accordion. - Dark Mode.normal.chromium_1.png 3398 Changed
vr-tests-web-components/Avatar 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Avatar. - Dark Mode.normal.chromium_1.png 298 Changed
vr-tests-web-components/Badge 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Badge. - Dark Mode.normal.chromium.png 443 Changed
vr-tests-web-components/MenuList 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/MenuList. - RTL.1st selected.chromium_2.png 39384 Changed
vr-tests-web-components/MenuList. - RTL.normal.chromium_1.png 39083 Changed
vr-tests-web-components/MenuList. - RTL.2nd selected.chromium_3.png 38816 Changed
vr-tests-web-components/TextInput 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/TextInput. - Dark Mode.normal.chromium_1.png 288 Changed

});

test('should preserve arrow key navigation after being moved in the DOM', async ({ fastPage }) => {
const { element } = fastPage;
const menuItems = element.locator(MenuItemTagName);

await fastPage.setTemplate();

// Move the menu list to trigger its disconnect/reconnect lifecycle.
await element.evaluate(node => {
const parent = node.parentElement;

if (!parent) {
throw new Error('Menu list must have a parent element');
}

const nextSibling = node.nextSibling;
node.remove();
parent.insertBefore(node, nextSibling);
});

await element.evaluate(node => {
node.focus();
});

await expect(menuItems.first()).toBeFocused();

await element.press('ArrowDown');

await expect(menuItems.nth(1)).toBeFocused();
});

test('should focus before the queued item refresh completes', async ({ fastPage, page }) => {
await fastPage.setTemplate('');
await page.evaluate(
Expand Down Expand Up @@ -385,7 +415,7 @@

await element.first().press('ArrowRight');

await expect(menuItems.nth(1)).toBeFocused();

Check failure on line 418 in packages/web-components/src/menu-list/menu-list.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[webkit-csr] › src/menu-list/menu-list.spec.ts:393:3 › MenuList › should navigate to submenu

3) [webkit-csr] › src/menu-list/menu-list.spec.ts:393:3 › MenuList › should navigate to submenu, close it with escape key, and return focus to the first menu item Error: expect(locator).toBeFocused() failed Locator: locator('fluent-menu-list').locator('fluent-menu-item').nth(1) Expected: focused Received: inactive Timeout: 5000ms Call log: - Expect "toBeFocused" with timeout 5000ms - waiting for locator('fluent-menu-list').locator('fluent-menu-item').nth(1) 9 × locator resolved to <fluent-menu-item tabindex="0" role="menuitem" data-fg-ati="0">Menu item 1.1</fluent-menu-item> - unexpected value "inactive" 416 | await element.first().press('ArrowRight'); 417 | > 418 | await expect(menuItems.nth(1)).toBeFocused(); | ^ 419 | 420 | await element.first().press('Escape'); 421 | at /home/runner/work/fluentui/fluentui/packages/web-components/src/menu-list/menu-list.spec.ts:418:36

Check failure on line 418 in packages/web-components/src/menu-list/menu-list.spec.ts

View workflow job for this annotation

GitHub Actions / e2e

[chromium-ssr] › src/menu-list/menu-list.spec.ts:393:3 › MenuList › should navigate to submenu

1) [chromium-ssr] › src/menu-list/menu-list.spec.ts:393:3 › MenuList › should navigate to submenu, close it with escape key, and return focus to the first menu item Error: expect(locator).toBeFocused() failed Locator: locator('fluent-menu-list').locator('fluent-menu-item').nth(1) Expected: focused Received: inactive Timeout: 5000ms Call log: - Expect "toBeFocused" with timeout 5000ms - waiting for locator('fluent-menu-list').locator('fluent-menu-item').nth(1) 9 × locator resolved to <fluent-menu-item tabindex="0" role="menuitem" data-fg-ati="none">Menu item 1.1</fluent-menu-item> - unexpected value "inactive" 416 | await element.first().press('ArrowRight'); 417 | > 418 | await expect(menuItems.nth(1)).toBeFocused(); | ^ 419 | 420 | await element.first().press('Escape'); 421 | at /home/runner/work/fluentui/fluentui/packages/web-components/src/menu-list/menu-list.spec.ts:418:36

await element.first().press('Escape');

Expand Down
1 change: 1 addition & 0 deletions packages/web-components/src/menu-list/menu-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class MenuList extends BaseMenuList {

disconnectedCallback() {
this.fg?.disconnect();
this.fg = undefined;
super.disconnectedCallback();
}

Expand Down
Loading