-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathHtmlFragment.test.js
More file actions
60 lines (52 loc) · 2.34 KB
/
HtmlFragment.test.js
File metadata and controls
60 lines (52 loc) · 2.34 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
beforeEach(async () => {
await page.goto('http://localhost:6969/html-fragment')
})
describe('HtmlFragment', () => {
test('the html behaves as a fragment and creates no markup', async () => {
const element = await page.$('[data-html-parent] > [data-html-child]')
expect(element).toBeTruthy()
})
test('when the html is nested regular attributes are overwritten by the last one in the tree', async () => {
const element = await page.$('html[data-chars="b"]')
expect(element).toBeTruthy()
})
test('when the html is nested classes are merged togheter', async () => {
const element = await page.$('html[class="class-one class-two class-three class-four"]')
expect(element).toBeTruthy()
})
test('when the html is nested styles are merged togheter', async () => {
const element = await page.$('html[style="background-color: black; color: white;"]')
expect(element).toBeTruthy()
})
test('when the html is nested events are invoked sequentially', async () => {
await page.waitForSelector('html[data-hydrated]')
await page.click('html')
await page.waitForSelector('[data-keys][data-objected][data-visible]')
const element = await page.$('[data-keys][data-objected][data-visible]')
expect(element).toBeTruthy()
})
test('when a html is added to the vdom attributes are added', async () => {
await page.waitForSelector('html[data-hydrated]')
await page.click('html')
await page.waitForSelector('html[data-visible]')
const element = await page.$('html[data-visible]')
expect(element).toBeTruthy()
})
test('when a html is removed from the vdom attributes are removed', async () => {
await page.waitForSelector('html[data-hydrated]')
await page.click('html')
await page.waitForSelector('html[data-visible]')
await page.click('html')
await page.waitForSelector('html:not([data-visible])')
const element = await page.$('html:not([data-visible])')
expect(element).toBeTruthy()
})
test('the html removes events when the fragment leaves the tree', async () => {
await page.waitForSelector('html[data-hydrated]')
await page.click('[href="/"]')
await page.waitForSelector('[data-application-hydrated]:not([data-count])')
await page.click('html')
const element = await page.$('[data-application-hydrated]:not([data-count])')
expect(element).toBeTruthy()
})
})