File size: 1,114 Bytes
1e92f2d |
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 37 |
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)
})
})
|