Skip to content

Commit 12aa8ab

Browse files
committed
test: add test coverage for multi-root and slot cleanup (testing-library#295)
1 parent e12fffc commit 12aa8ab

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: src/__tests__/auto-cleanup.js

+30
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,33 @@ test('renders the component', () => {
1616
test('cleans up after each test by default', () => {
1717
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
1818
})
19+
20+
test('renders multi-root component', () => {
21+
render({
22+
template: `
23+
<h1>Hello World</h1>
24+
<h2>Hello World</h2>
25+
`,
26+
})
27+
28+
expect(document.body.innerHTML).toMatchInlineSnapshot(`
29+
<div>
30+
<h1>Hello World</h1>
31+
<h2>Hello World</h2>
32+
</div>
33+
`)
34+
})
35+
36+
test('cleans up after rendering multi-root node', () => {
37+
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
38+
})
39+
40+
test('renders single slot component', () => {
41+
render({template: `<slot />`})
42+
43+
expect(document.body.innerHTML).toMatchInlineSnapshot(`<div></div>`)
44+
})
45+
46+
test('cleans up after rendering slot component', () => {
47+
expect(document.body.innerHTML).toMatchInlineSnapshot(``)
48+
})

0 commit comments

Comments
 (0)