Skip to content

Commit

Permalink
test: activate cell with Enter instead of double click (#8202) (#8204)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <[email protected]>
  • Loading branch information
vaadin-bot and web-padawan authored Nov 21, 2024
1 parent 111e397 commit a5038e7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/grid-pro/test/keyboard-navigation.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ describe('keyboard navigation', () => {

it('should focus cell next available for editing within a same row in non-edit mode on Tab', async () => {
const firstCell = getContainerCell(grid.$.items, 1, 0);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 1, 1);
const spy = sinon.spy(secondCell, 'focus');
Expand All @@ -48,7 +49,8 @@ describe('keyboard navigation', () => {

it('should focus previous cell available for editing within a same row in non-edit mode on Shift Tab', async () => {
const firstCell = getContainerCell(grid.$.items, 1, 1);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 1, 0);
const spy = sinon.spy(secondCell, 'focus');
Expand All @@ -60,7 +62,8 @@ describe('keyboard navigation', () => {

it('should focus cell next available for editing on the next row in non-edit mode on Tab', async () => {
const firstCell = getContainerCell(grid.$.items, 1, 1);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 2, 0);
const spy = sinon.spy(secondCell, 'focus');
Expand All @@ -70,7 +73,8 @@ describe('keyboard navigation', () => {

it('should focus previous cell available for editing on the previous in non-edit mode on Shift Tab', async () => {
const firstCell = getContainerCell(grid.$.items, 2, 0);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 1, 1);
const spy = sinon.spy(secondCell, 'focus');
Expand All @@ -94,7 +98,8 @@ describe('keyboard navigation', () => {

it('should exit the edit mode for the cell on Enter, if `enterNextRow` is false', async () => {
const firstCell = getContainerCell(grid.$.items, 1, 0);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

await sendKeys({ press: 'Enter' });
expect(getCellEditor(firstCell)).to.be.not.ok;
Expand All @@ -116,7 +121,8 @@ describe('keyboard navigation', () => {

it('should exit the edit mode for the cell on Shift Enter, if `enterNextRow` is false', async () => {
const firstCell = getContainerCell(grid.$.items, 1, 0);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Enter' });
Expand All @@ -133,7 +139,8 @@ describe('keyboard navigation', () => {
dragAndDropOver(headerContent[0], headerContent[1]);

const firstCell = getContainerCell(grid.$.items, 1, 1);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 1, 0);
const spy = sinon.spy(secondCell, 'focus');
Expand All @@ -147,7 +154,8 @@ describe('keyboard navigation', () => {
flushGrid(grid);

const firstCell = getContainerCell(grid.$.items, 1, 0);
dblclick(firstCell._content);
firstCell.focus();
await sendKeys({ press: 'Enter' });

const secondCell = getContainerCell(grid.$.items, 2, 0);
const spy = sinon.spy(secondCell, 'focus');
Expand Down

0 comments on commit a5038e7

Please sign in to comment.