-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
24 lines (21 loc) · 978 Bytes
/
index.spec.js
File metadata and controls
24 lines (21 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { expectConsoleCallsDev } from '../../../../helpers/utils.js';
export default {
advancedTest(target, { Component, hydrateComponent, consoleSpy }) {
// This simulates a condition where the server-rendered markup has
// a classname that is incorrectly missing in the client-side
// VDOM at the time of validation.
//
// Outside of this test, the tested condition should never be reached
// unless something in SSR or hydration logic is broken.
target.shadowRoot.querySelector('x-child').classList.add('foo');
hydrateComponent(target, Component, {});
const consoleCalls = consoleSpy.calls;
expectConsoleCallsDev(consoleCalls, {
error: [],
warn: [
'Hydration attribute mismatch on: <x-child> - rendered on server: class="foo" - expected on client: class=""',
'Hydration completed with errors.',
],
});
},
};