-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathmulti-base.test.js
42 lines (37 loc) · 983 Bytes
/
multi-base.test.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
import { render } from '@testing-library/svelte'
import { describe, expect, test } from 'vitest'
import Comp from './fixtures/Comp.svelte'
describe('multi-base', () => {
const treeA = document.createElement('div')
const treeB = document.createElement('div')
test('container isolates trees from one another', () => {
const { getByText: getByTextInA } = render(
Comp,
{
target: treeA,
props: {
name: 'Tree A',
},
},
{
baseElement: treeA,
}
)
const { getByText: getByTextInB } = render(
Comp,
{
target: treeB,
props: {
name: 'Tree B',
},
},
{
baseElement: treeB,
}
)
expect(() => getByTextInA('Hello Tree A!')).not.toThrow()
expect(() => getByTextInB('Hello Tree A!')).toThrow()
expect(() => getByTextInA('Hello Tree B!')).toThrow()
expect(() => getByTextInB('Hello Tree B!')).not.toThrow()
})
})