Skip to content

Commit

Permalink
fix tab tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Dec 18, 2024
1 parent 2b17c2d commit 0075e0c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions packages/combo-box/test/keyboard.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ describe('keyboard', () => {
expect(getFocusedIndex()).to.equal(0);
});

it('should tab to the next focusable', async () => {
it('should tab to the prev focusable', async () => {
await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Tab' });
await sendKeys({ up: 'Shift' });

expect(document.activeElement).to.equal(document.body);
expect(document.activeElement).to.be.oneOf([document.body, document.documentElement]);
});

describe('focusable items content', () => {
Expand Down
8 changes: 5 additions & 3 deletions packages/multi-select-combo-box/test/readonly.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ describe('readonly', () => {
expect(internal.opened).to.be.true;
});

it('should close the dropdown on Tab when readonly', async () => {
await sendKeys({ down: 'ArrowDown' });
await sendKeys({ down: 'Tab' });
it('should close the dropdown on Shift+Tab when readonly', async () => {
await sendKeys({ press: 'ArrowDown' });
await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Tab' });
await sendKeys({ up: 'Shift' });
expect(internal.opened).to.be.false;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ describe('keyboard navigation', () => {
expect(buttons[2].hasAttribute('focused')).to.be.false;

// Move focus out of the group.
await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Tab' });
await sendKeys({ up: 'Shift' });
expect(buttons[0].hasAttribute('focused')).to.be.false;
expect(buttons[1].hasAttribute('focused')).to.be.false;
expect(buttons[2].hasAttribute('focused')).to.be.false;
Expand Down
1 change: 1 addition & 0 deletions packages/select/src/vaadin-select-base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const SelectBaseMixin = (superClass) =>
notify: true,
reflectToAttribute: true,
observer: '_openedChanged',
sync: true,
},

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/select/test/validation.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ describe('validation', () => {
select.click();
await nextRender();

await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Tab' });
await sendKeys({ up: 'Shift' });
await nextUpdate(select);
expect(validateSpy.calledOnce).to.be.true;
});
Expand Down

0 comments on commit 0075e0c

Please sign in to comment.