Download slate/playwright/integration/examples/editable-voids.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/editable-voids.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/playwright/integration/examples/editable-voids.test.ts
-
curl -L -o editable-voids.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/editable-voids.test.ts
1.07 kB
| import { test, expect } from '@playwright/test' | |
| test.describe('editable voids', () => { | |
| const input = 'input[type="text"]' | |
| const elements = [ | |
| { tag: 'h4', count: 3 }, | |
| { tag: input, count: 1 }, | |
| { tag: 'input[type="radio"]', count: 2 }, | |
| ] | |
| test.beforeEach(async ({ page }) => { | |
| await page.goto('http://localhost:3000/examples/editable-voids') | |
| }) | |
| test('checks for the elements', async ({ page }) => { | |
| for (const elem of elements) { | |
| const { tag, count } = elem | |
| await expect(page.locator(tag)).toHaveCount(count) | |
| } | |
| }) | |
| test('should double the elements', async ({ page }) => { | |
| // click the `+` sign to duplicate the editable void | |
| await page.locator('span.material-icons').nth(1).click() | |
| for (const elem of elements) { | |
| const { tag, count } = elem | |
| await expect(page.locator(tag)).toHaveCount(count * 2) | |
| } | |
| }) | |
| test('make sure you can edit editable void', async ({ page }) => { | |
| await page.locator(input).fill('Typing') | |
| expect(await page.locator(input).inputValue()).toBe('Typing') | |
| }) | |
| }) | |