-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathauto-cleanup.js
48 lines (39 loc) · 1.17 KB
/
auto-cleanup.js
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
import {render} from '..'
import '@testing-library/jest-dom'
// This verifies that by importing VTL in an environment which supports
// afterEach (like jest) we'll get automatic cleanup between tests.
test('renders the component', () => {
render({template: `<h1>Hello World</h1>`})
expect(document.body.innerHTML).toMatchInlineSnapshot(`
<div>
<h1>Hello World</h1>
</div>
`)
})
test('cleans up after each test by default', () => {
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
})
test('renders multi-root component', () => {
render({
template: `
<h1>Hello World</h1>
<h2>Hello World</h2>
`,
})
expect(document.body.innerHTML).toMatchInlineSnapshot(`
<div>
<h1>Hello World</h1>
<h2>Hello World</h2>
</div>
`)
})
test('cleans up after rendering multi-root node', () => {
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
})
test('renders single slot component', () => {
render({template: `<slot />`})
expect(document.body.innerHTML).toMatchInlineSnapshot(`<div></div>`)
})
test('cleans up after rendering slot component', () => {
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
})