-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
39 lines (34 loc) · 1.11 KB
/
index.spec.js
File metadata and controls
39 lines (34 loc) · 1.11 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
import { expectConsoleCallsDev } from '../../../helpers/utils.js';
export default {
props: {
content: '<p>test-content</p>',
},
clientProps: {
content: '<p>different-content</p>',
},
snapshot(target) {
const div = target.shadowRoot.querySelector('div');
const p = div.querySelector('p');
return {
div,
p,
};
},
test(target, snapshot, consoleCalls) {
const div = target.shadowRoot.querySelector('div');
const p = div.querySelector('p');
expect(div).toBe(snapshot.div);
expect(p).not.toBe(snapshot.p);
expect(p.textContent).toBe('different-content');
expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration innerHTML mismatch on: <div> - rendered on server: <p>test-content</p> - expected on client: <p>different-content</p>',
],
});
target.content = '<p>another-content</p>';
return Promise.resolve().then(() => {
expect(div.textContent).toBe('another-content');
});
},
};