-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
39 lines (35 loc) · 1.2 KB
/
index.spec.js
File metadata and controls
39 lines (35 loc) · 1.2 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: {
ssr: true,
},
clientProps: {
ssr: false,
},
snapshot(target) {
const p = target.shadowRoot.querySelector('p');
return {
p,
classes: p.className,
};
},
test(target, snapshots, consoleCalls) {
const p = target.shadowRoot.querySelector('p');
// TODO [#4656]: static optimization causes mismatches for style/class only when ordering is different
if (process.env.DISABLE_STATIC_CONTENT_OPTIMIZATION) {
expect(p).toBe(snapshots.p);
expect(p.className).toBe(snapshots.classes);
expect(consoleCalls.warn).toHaveSize(0);
} else {
expect(p).not.toBe(snapshots.p);
expect(p.className).toBe('c1 c2 c3');
expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: <p> - rendered on server: class="c3 c2 c1" - expected on client: class="c1 c2 c3"',
'Hydration completed with errors.',
],
});
}
},
};