-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: template provided through @api-decorated prop (#5243)
* test: template provided through @api-decorated prop * chore: add comment
- Loading branch information
Showing
7 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...s/@lwc/engine-server/src/__tests__/fixtures/slots-light-evil-template-as-prop/config.json
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 @@ | ||
{ | ||
"entry": "x/outer" | ||
} |
Empty file.
15 changes: 15 additions & 0 deletions
15
...@lwc/engine-server/src/__tests__/fixtures/slots-light-evil-template-as-prop/expected.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,15 @@ | ||
<fixture-test> | ||
<x-inner> | ||
a | ||
<!----> | ||
slotted content | ||
<!----> | ||
b | ||
<!----> | ||
<div> | ||
named slotted content | ||
</div> | ||
<!----> | ||
c | ||
</x-inner> | ||
</fixture-test> |
10 changes: 10 additions & 0 deletions
10
...-server/src/__tests__/fixtures/slots-light-evil-template-as-prop/modules/x/inner/inner.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,10 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class extends LightningElement { | ||
static renderMode = 'light'; | ||
@api tmpl; | ||
|
||
render() { | ||
return this.tmpl; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...__tests__/fixtures/slots-light-evil-template-as-prop/modules/x/outer/innerTemplateFn.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,7 @@ | ||
<template lwc:render-mode="light"> | ||
a | ||
<slot>fallback for default</slot> | ||
b | ||
<slot name=foo>fallback for foo</slot> | ||
c | ||
</template> |
6 changes: 6 additions & 0 deletions
6
...erver/src/__tests__/fixtures/slots-light-evil-template-as-prop/modules/x/outer/outer.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,6 @@ | ||
<template lwc:render-mode="light"> | ||
<x-inner tmpl={innerTemplateFn}> | ||
slotted content | ||
<div slot="foo">named slotted content</div> | ||
</x-inner> | ||
</template> |
14 changes: 14 additions & 0 deletions
14
...-server/src/__tests__/fixtures/slots-light-evil-template-as-prop/modules/x/outer/outer.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,14 @@ | ||
import { LightningElement } from 'lwc'; | ||
import innerTemplateFn from './innerTemplateFn.html'; | ||
import tmpl from './outer.html'; | ||
|
||
export default class extends LightningElement { | ||
static renderMode = 'light'; | ||
innerTemplateFn = innerTemplateFn; | ||
|
||
// This isn't strictly necessary and has no functional value relative to an implicit template. It is present | ||
// only to disambiguate the outer component's template from the one we're passing to the child. | ||
render() { | ||
return tmpl; | ||
} | ||
} |