Skip to content

Commit

Permalink
prefer updateComplete over nextFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Dec 19, 2024
1 parent f2d2cb0 commit 8801b9c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/dashboard/test/dashboard-keyboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
setMinimumColumnWidth,
setMinimumRowHeight,
setSpacing,
updateComplete,
} from './helpers.js';

type TestDashboardItem = DashboardItem & { id: number };
Expand Down Expand Up @@ -209,7 +210,7 @@ describe('dashboard - keyboard interaction', () => {

it('should move the widget backwards on arrow up', async () => {
await sendKeys({ press: 'ArrowDown' });
await nextFrame();
await updateComplete(dashboard);
await sendKeys({ press: 'ArrowUp' });
expect(dashboard.items).to.eql([{ id: 0 }, { id: 1 }, { items: [{ id: 2 }, { id: 3 }] }]);
});
Expand Down Expand Up @@ -246,7 +247,7 @@ describe('dashboard - keyboard interaction', () => {
setMinimumRowHeight(dashboard, 100);
await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'ArrowDown' });
await nextFrame();
await updateComplete(dashboard);
await sendKeys({ press: 'ArrowUp' });
await sendKeys({ up: 'Shift' });
expect((dashboard.items[0] as DashboardItem).rowspan).to.equal(1);
Expand Down Expand Up @@ -365,7 +366,7 @@ describe('dashboard - keyboard interaction', () => {

it('should move the widget backwards on arrow backwards', async () => {
await sendKeys({ press: arrowForwards });
await nextFrame();
await updateComplete(dashboard);
await sendKeys({ press: arrowBackwards });
expect(dashboard.items).to.eql([{ id: 0 }, { id: 1 }, { items: [{ id: 2 }, { id: 3 }] }]);
});
Expand All @@ -380,7 +381,7 @@ describe('dashboard - keyboard interaction', () => {
it('should decrease the widget column span on shift + arrow backwards', async () => {
await sendKeys({ down: 'Shift' });
await sendKeys({ press: arrowForwards });
await nextFrame();
await updateComplete(dashboard);
await sendKeys({ press: arrowBackwards });
await sendKeys({ up: 'Shift' });
expect((dashboard.items[0] as DashboardItem).colspan).to.equal(1);
Expand Down

0 comments on commit 8801b9c

Please sign in to comment.