Skip to content

Commit

Permalink
Add tests for navigating with arrow keys
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Sep 22, 2023
1 parent 499b623 commit e327b88
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 54 deletions.
22 changes: 22 additions & 0 deletions e2e/list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from '@playwright/test';
import { test } from './fixtures';

test.describe('list', () => {
test.beforeEach(async ({ editorPage }) => {
await editorPage.open();
});

test('cmd + arrow keys to navigate', async ({ page, editorPage }) => {
await editorPage.setContents([
{ insert: 'item 1' },
{ insert: '\n', attributes: { list: 'bullet' } },
]);

await editorPage.moveCursorAfterText('item 1');
await page.keyboard.press('Control+ArrowLeft');
expect(await editorPage.getSelection()).toEqual({ index: 0, length: 0 });

await page.keyboard.press('Control+ArrowRight');
expect(await editorPage.getSelection()).toEqual({ index: 6, length: 0 });
});
});
81 changes: 29 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@babel/core": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@playwright/test": "^1.34.3",
"@playwright/test": "^1.38.1",
"@types/lodash.clonedeep": "^4.5.7",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.merge": "^4.6.7",
Expand All @@ -51,7 +51,7 @@
"lodash": "^4.17.15",
"mini-css-extract-plugin": "^2.7.6",
"npm-run-all": "^4.1.5",
"playwright": "^1.36.0",
"playwright": "^1.38.1",
"prettier": "^3.0.1",
"style-loader": "^3.3.3",
"stylus": "^0.59.0",
Expand Down

0 comments on commit e327b88

Please sign in to comment.