forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlegacy-editor.spec.ts
36 lines (32 loc) · 1.01 KB
/
legacy-editor.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { test, expect } from '@playwright/test';
import { focusEditor } from './utils/editor';
test.describe('Editor Shortcuts', () => {
test('Should add a new line if the user presses Alt+Enter', async ({
page,
isMobile
}) => {
await page.goto(
'learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
);
await focusEditor({ page, isMobile });
await page.keyboard.press('Alt+Enter');
await expect(
page
.getByTestId('editor-container-indexhtml')
.getByText('<h1>Hello</h1>\n')
).toBeVisible();
});
test('Should not add a new line if the user presses Ctrl+Enter', async ({
page,
isMobile
}) => {
await page.goto(
'learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
);
await focusEditor({ page, isMobile });
await page.keyboard.press('Control+Enter');
await expect(
page.getByTestId('editor-container-indexhtml').getByText('<h1>Hello</h1>')
).toBeVisible();
});
});