-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
34 lines (31 loc) · 1.26 KB
/
index.spec.js
File metadata and controls
34 lines (31 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
33
34
export default {
props: {},
snapshot(target) {
const parentP = target.shadowRoot.querySelector('p');
const childP = target.shadowRoot.querySelector('x-child').shadowRoot.querySelector('p');
return {
parentP,
childP,
};
},
test(target, snapshots, consoleCalls) {
const parentP = target.shadowRoot.querySelector('p');
const child = target.shadowRoot.querySelector('x-child');
const childP = child.shadowRoot.querySelector('p');
expect(parentP).toBe(snapshots.parentP);
expect(childP).toBe(snapshots.childP);
expect(parentP.textContent).toBe('Parent');
expect(childP.textContent).toBe('Child');
// both should be native no matter what
expect(target.shadowRoot.synthetic).toBeUndefined();
expect(child.shadowRoot.synthetic).toBeUndefined();
// sanity check that the env var is working
if (process.env.NATIVE_SHADOW) {
expect(document.body.attachShadow.toString()).toContain('[native code');
} else {
expect(document.body.attachShadow.toString()).not.toContain('[native code');
}
expect(consoleCalls.warn).toHaveSize(0);
expect(consoleCalls.error).toHaveSize(0);
},
};