Download slate/playwright/integration/examples/check-lists.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/check-lists.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/playwright/integration/examples/check-lists.test.ts
-
curl -L -o check-lists.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/check-lists.test.ts
1.11 kB
| import { test, expect } from '@playwright/test' | |
| test.describe('Check-lists example', () => { | |
| test.beforeEach(async ({ page }) => { | |
| await page.goto('http://localhost:3000/examples/check-lists') | |
| }) | |
| test('checks the bullet when clicked', async ({ page }) => { | |
| const slateNodeElement = 'div[data-slate-node="element"]' | |
| expect(await page.locator(slateNodeElement).nth(3).textContent()).toBe( | |
| 'Criss-cross!' | |
| ) | |
| await expect( | |
| page.locator(slateNodeElement).nth(3).locator('span').nth(1) | |
| ).toHaveCSS('text-decoration-line', 'line-through') | |
| // Unchecking the checkboxes should un-cross the corresponding text. | |
| await page | |
| .locator(slateNodeElement) | |
| .nth(3) | |
| .locator('span') | |
| .nth(0) | |
| .locator('input') | |
| .uncheck() | |
| expect(await page.locator(slateNodeElement).nth(3).textContent()).toBe( | |
| 'Criss-cross!' | |
| ) | |
| await expect( | |
| page.locator(slateNodeElement).nth(3).locator('span').nth(1) | |
| ).toHaveCSS('text-decoration-line', 'none') | |
| await expect(page.locator('p[data-slate-node="element"]')).toHaveCount(2) | |
| }) | |
| }) | |