-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add karma test showing hydration mismatch when a child componen…
…t has scopd styles and a custom HTML template
- Loading branch information
1 parent
2efbadf
commit cc7caf9
Showing
6 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/@lwc/integration-karma/test-hydration/host-token/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
advancedTest(target, { Component, hydrateComponent, consoleSpy }) { | ||
hydrateComponent(target, Component, {}); | ||
|
||
expect(consoleSpy.calls.warn).toHaveSize(0); | ||
expect(consoleSpy.calls.error).toHaveSize(0); | ||
}, | ||
}; |
12 changes: 12 additions & 0 deletions
12
packages/@lwc/integration-karma/test-hydration/host-token/x/component/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LightningElement } from 'lwc'; | ||
import style from './component.scoped.css'; | ||
import html from './template.html'; | ||
|
||
export default class extends LightningElement { | ||
static renderMode = 'light'; | ||
static stylesheets = [style]; | ||
|
||
render() { | ||
return html; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/@lwc/integration-karma/test-hydration/host-token/x/component/component.scoped.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: red; | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/@lwc/integration-karma/test-hydration/host-token/x/component/template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<template lwc:render-mode="light"> | ||
<span>hello</span> | ||
</template> | ||
|
4 changes: 4 additions & 0 deletions
4
packages/@lwc/integration-karma/test-hydration/host-token/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<template lwc:render-mode="light"> | ||
<x-component></x-component> | ||
</template> | ||
|
5 changes: 5 additions & 0 deletions
5
packages/@lwc/integration-karma/test-hydration/host-token/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class extends LightningElement { | ||
static renderMode = 'light'; | ||
} |