From 6ff2b6aeca56b8b5d71bb54f88c2498b8b868e18 Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Wed, 8 Jan 2025 15:00:35 +0400 Subject: [PATCH] fix more local failures --- packages/context-menu/test/a11y.common.js | 12 ++++++------ packages/grid/test/keyboard-navigation.common.js | 4 ++-- packages/rich-text-editor/test/a11y.common.js | 12 ++++++------ packages/virtual-list/test/drag-and-drop.common.js | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/context-menu/test/a11y.common.js b/packages/context-menu/test/a11y.common.js index 9f1c2562ad5..9b690491846 100644 --- a/packages/context-menu/test/a11y.common.js +++ b/packages/context-menu/test/a11y.common.js @@ -6,19 +6,19 @@ import { getMenuItems } from './helpers.js'; describe('a11y', () => { describe('focus restoration', () => { - let contextMenu, contextMenuButton, beforeButton, afterButton; + let contextMenu, contextMenuButton, firstGlobalFocusable, lastGlobalFocusable; beforeEach(async () => { const wrapper = fixtureSync(`
- + - +
`); - [beforeButton, contextMenu, afterButton] = wrapper.children; + [firstGlobalFocusable, contextMenu, lastGlobalFocusable] = wrapper.children; contextMenu.items = [{ text: 'Item 0' }, { text: 'Item 1', children: [{ text: 'Item 1/0' }] }]; await nextRender(); contextMenuButton = contextMenu.querySelector('button'); @@ -82,14 +82,14 @@ describe('a11y', () => { await sendKeys({ down: 'Shift' }); await sendKeys({ press: 'Tab' }); await sendKeys({ up: 'Shift' }); - expect(getDeepActiveElement()).to.equal(beforeButton); + expect(getDeepActiveElement()).to.equal(firstGlobalFocusable); }); it('should move focus to the next element outside the menu on Tab pressed inside', async () => { contextMenuButton.click(); await nextRender(); await sendKeys({ press: 'Tab' }); - expect(getDeepActiveElement()).to.equal(afterButton); + expect(getDeepActiveElement()).to.equal(lastGlobalFocusable); }); }); }); diff --git a/packages/grid/test/keyboard-navigation.common.js b/packages/grid/test/keyboard-navigation.common.js index f90f81c63f0..6466bbf0ed3 100644 --- a/packages/grid/test/keyboard-navigation.common.js +++ b/packages/grid/test/keyboard-navigation.common.js @@ -2221,7 +2221,7 @@ describe('empty state', () => { } function getEmptyStateFocusables() { - return [...getEmptyState().querySelectorAll('button')]; + return [...getEmptyState().querySelectorAll('input')]; } function getEmptyStateBody() { @@ -2233,7 +2233,7 @@ describe('empty state', () => {
- No items + No items
`); diff --git a/packages/rich-text-editor/test/a11y.common.js b/packages/rich-text-editor/test/a11y.common.js index cb17212bdb1..8f2da5af2c3 100644 --- a/packages/rich-text-editor/test/a11y.common.js +++ b/packages/rich-text-editor/test/a11y.common.js @@ -178,15 +178,15 @@ describe('accessibility', () => { it('should move focus to next element after esc followed by tab are pressed', async () => { const wrapper = fixtureSync(`
- +
`); await nextRender(); - const [rte, button] = wrapper.children; + const [rte, lastGlobalFocusable] = wrapper.children; editor = rte._editor; editor.focus(); await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Tab' }); - expect(document.activeElement).to.equal(button); + expect(document.activeElement).to.equal(lastGlobalFocusable); }); it('should move focus to the first toolbar button after esc followed by shift-tab are pressed', async () => { @@ -201,17 +201,17 @@ describe('accessibility', () => { it('should restore default Tab behavior after multiple Esc and then Tab', async () => { const wrapper = fixtureSync(`
- +
`); await nextRender(); - const [rte, button] = wrapper.children; + const [rte, lastGlobalFocusable] = wrapper.children; editor = rte._editor; editor.focus(); // Hitting Escape multiple times and Tab should move focus to next element await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Escape' }); await sendKeys({ press: 'Tab' }); - expect(document.activeElement).to.equal(button); + expect(document.activeElement).to.equal(lastGlobalFocusable); // Checking that default Tab behavior is restored editor.focus(); diff --git a/packages/virtual-list/test/drag-and-drop.common.js b/packages/virtual-list/test/drag-and-drop.common.js index 4c443504ab8..a3c46391020 100644 --- a/packages/virtual-list/test/drag-and-drop.common.js +++ b/packages/virtual-list/test/drag-and-drop.common.js @@ -38,6 +38,7 @@ describe('drag and drop', () => { async function assertDragSucceeds(draggedElement) { await dragElement(draggedElement); + await nextFrame(); expect(virtualList.$.items.style.display).to.equal(''); }