Skip to content

Commit b7673c8

Browse files
fix: prettier, dedicated dedupe test
1 parent b91f42e commit b7673c8

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
export default {
2-
test(target, snapshot, consoleCalls) {
3-
// Expect no errors or warnings, hydration or otherwise
4-
TestUtils.expectConsoleCalls(consoleCalls, {
5-
error: [],
6-
warn: [],
7-
});
2+
snapshot(target) {
3+
return {
4+
parent: target,
5+
child: target.querySelector('x-child'),
6+
};
7+
},
8+
advancedTest(target, { Component, hydrateComponent, consoleSpy }) {
9+
const { parent, child } = this.snapshot(target);
10+
hydrateComponent(target, Component, {});
11+
const consoleCalls = consoleSpy.calls;
12+
// Validate there is no class attribute mismatch
13+
expect(consoleCalls.error).toHaveSize(0);
14+
// Validate there is no hydration mismatch
15+
expect(parent).toBe(target);
16+
expect(child).toBe(target.querySelector('x-child'));
817
},
918
};
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<template lwc:render-mode="light">
2-
<div class="blue">child content</div>
2+
<div></div>
33
</template>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.blue {
2-
background-color: blue;
1+
:host {
2+
padding: 8px;
33
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<template lwc:render-mode="light">
2-
<x-child></x-child>
3-
<x-child></x-child>
2+
<x-child class="main"></x-child>
43
</template>

packages/@lwc/template-compiler/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const { code, warnings } = compile(`<template><h1>Hello World!</h1></template>`,
6464
- `customRendererConfig` (CustomRendererConfig, optional) - specifies a configuration to use to match elements. Matched elements will get a custom renderer hook in the generated template.
6565
- `instrumentation` (InstrumentationObject, optional) - instrumentation object to gather metrics and non-error logs for internal use. See the `@lwc/errors` package for details on the interface.
6666
- `disableSyntheticShadowSupport` (type: `boolean`, default: `false`) - Set to true if synthetic shadow DOM support is not needed, which can result in smaller/faster output.
67-
6867
- Example 1: Config to match `<use>` elements under the `svg` namespace and have `href` attribute set.
6968

7069
```

0 commit comments

Comments
 (0)