-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathContextData.test.js
More file actions
32 lines (28 loc) · 1.26 KB
/
ContextData.test.js
File metadata and controls
32 lines (28 loc) · 1.26 KB
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
beforeAll(async () => {
await page.goto('http://localhost:6969/context-data')
await page.waitForSelector('[data-hydrated]')
})
describe('ContextData', () => {
test('data attributes are added to the dom', async () => {
const element = await page.$('[data-multiply-by="3"]')
expect(element).toBeTruthy()
})
test('data attributes are merged into the data attribute and passed to events', async () => {
await page.click('[data-multiply-by="3"]')
await page.waitForSelector('[data-count-with-default="6"]')
const element = await page.$('[data-count-with-default="6"]')
expect(element).toBeTruthy()
})
test('data attributes are added into a new data object and passed to events if no data attribute is provided', async () => {
await page.click('[data-set-to="2"]')
await page.waitForSelector('[data-count-without-default="2"]')
const element = await page.$('[data-count-without-default="2"]')
expect(element).toBeTruthy()
})
test('data attributes are kebabized when generating the data argument', async () => {
await page.click('[data-set-to="2"]')
await page.waitForSelector('[data-count-without-default="2"]')
const element = await page.$('[data-count-without-default="2"]')
expect(element).toBeTruthy()
})
})