Skip to content

Commit

Permalink
test: add more tests to custom-field focus switch
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 26, 2024
1 parent 60b467e commit 56542de
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/integration/grid-pro-custom-editor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@ describe('grid-pro custom editor', () => {
await editFirstCell();
});

it('should not stop editing when switching between fields using mouse', async () => {
// Move focus to the second field
const { x, y } = middleOfNode(cell._content.querySelectorAll('input')[1]);
await sendMouse({ type: 'click', position: [Math.floor(x), Math.floor(y)] });
await nextRender();
expect(cell._content.querySelector('vaadin-custom-field')).to.be.ok;
});

it('should not stop editing when switching between fields using Tab', async () => {
// Move focus to the second field
await sendKeys({ press: 'Tab' });
Expand All @@ -316,5 +324,17 @@ describe('grid-pro custom editor', () => {
await nextRender();
expect(cell._content.querySelector('vaadin-custom-field')).to.be.ok;
});

it('should stop editing when moving focus outside the field using Tab', async () => {
// Move focus to the second field
await sendKeys({ press: 'Tab' });
await nextRender();
expect(cell._content.querySelector('vaadin-custom-field')).to.be.ok;

// Move focus outside of the field
await sendKeys({ press: 'Tab' });
await nextRender();
expect(cell._content.querySelector('vaadin-custom-field')).to.be.not.ok;
});
});
});

0 comments on commit 56542de

Please sign in to comment.