Skip to content

Commit 340e4a4

Browse files
authored
test: template provided through @api-decorated prop (#5243)
* test: template provided through @api-decorated prop * chore: add comment
1 parent c04b0b7 commit 340e4a4

File tree

7 files changed

+55
-0
lines changed

7 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"entry": "x/outer"
3+
}

packages/@lwc/engine-server/src/__tests__/fixtures/slots-light-evil-template-as-prop/error.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<fixture-test>
2+
<x-inner>
3+
a
4+
<!---->
5+
slotted content
6+
<!---->
7+
b
8+
<!---->
9+
<div>
10+
named slotted content
11+
</div>
12+
<!---->
13+
c
14+
</x-inner>
15+
</fixture-test>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { LightningElement, api } from 'lwc';
2+
3+
export default class extends LightningElement {
4+
static renderMode = 'light';
5+
@api tmpl;
6+
7+
render() {
8+
return this.tmpl;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template lwc:render-mode="light">
2+
a
3+
<slot>fallback for default</slot>
4+
b
5+
<slot name=foo>fallback for foo</slot>
6+
c
7+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template lwc:render-mode="light">
2+
<x-inner tmpl={innerTemplateFn}>
3+
slotted content
4+
<div slot="foo">named slotted content</div>
5+
</x-inner>
6+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { LightningElement } from 'lwc';
2+
import innerTemplateFn from './innerTemplateFn.html';
3+
import tmpl from './outer.html';
4+
5+
export default class extends LightningElement {
6+
static renderMode = 'light';
7+
innerTemplateFn = innerTemplateFn;
8+
9+
// This isn't strictly necessary and has no functional value relative to an implicit template. It is present
10+
// only to disambiguate the outer component's template from the one we're passing to the child.
11+
render() {
12+
return tmpl;
13+
}
14+
}

0 commit comments

Comments
 (0)