-
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.03 KB
/
index.spec.js
File metadata and controls
34 lines (31 loc) · 1.03 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
import { expectConsoleCallsDev } from '../../../../helpers/utils.js';
// SSR has no class at all, whereas the client has `class="null"`.
// This is to test if hydration is smart enough to recognize the difference between a null
// attribute and the literal string "null".
export default {
props: {
className: '',
},
clientProps: {
className: 'null',
},
snapshot(target) {
const p = target.shadowRoot.querySelector('p');
return {
p,
className: p.className,
};
},
test(target, snapshots, consoleCalls) {
const p = target.shadowRoot.querySelector('p');
expect(p).not.toBe(snapshots.p);
expect(p.className).not.toBe(snapshots.className);
expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: <p> - rendered on server: class="" - expected on client: class="null"',
'Hydration completed with errors.',
],
});
},
};