Skip to content

Commit

Permalink
fix more local failures
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Jan 8, 2025
1 parent d04d73b commit 6ff2b6a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/context-menu/test/a11y.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
<div>
<button>Before</button>
<input id="first-global-focusable" />
<vaadin-context-menu open-on="click">
<button>Open context menu</button>
</vaadin-context-menu>
<button>After</button>
<input id="last-global-focusable" />
</div>
`);
[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');
Expand Down Expand Up @@ -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);
});
});
});
4 changes: 2 additions & 2 deletions packages/grid/test/keyboard-navigation.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2221,7 +2221,7 @@ describe('empty state', () => {
}

function getEmptyStateFocusables() {
return [...getEmptyState().querySelectorAll('button')];
return [...getEmptyState().querySelectorAll('input')];
}

function getEmptyStateBody() {
Expand All @@ -2233,7 +2233,7 @@ describe('empty state', () => {
<vaadin-grid>
<vaadin-grid-column path="name"></vaadin-grid-column>
<div slot="empty-state">
No items <button>button 1</button> <button>button 2</button>
No items <input /> <input />
</div>
</vaadin-grid>
`);
Expand Down
12 changes: 6 additions & 6 deletions packages/rich-text-editor/test/a11y.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ describe('accessibility', () => {
it('should move focus to next element after esc followed by tab are pressed', async () => {
const wrapper = fixtureSync(`<div>
<vaadin-rich-text-editor></vaadin-rich-text-editor>
<button>button</button>
<input id="last-global-focusable" />
</div>`);
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 () => {
Expand All @@ -201,17 +201,17 @@ describe('accessibility', () => {
it('should restore default Tab behavior after multiple Esc and then Tab', async () => {
const wrapper = fixtureSync(`<div>
<vaadin-rich-text-editor></vaadin-rich-text-editor>
<button>button</button>
<input id="last-global-focusable" />
</div>`);
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();
Expand Down
1 change: 1 addition & 0 deletions packages/virtual-list/test/drag-and-drop.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('drag and drop', () => {

async function assertDragSucceeds(draggedElement) {
await dragElement(draggedElement);
await nextFrame();
expect(virtualList.$.items.style.display).to.equal('');
}

Expand Down

0 comments on commit 6ff2b6a

Please sign in to comment.