Skip to content

Commit

Permalink
test(ssr): add tests for nested elements in slots (#5048)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Dec 16, 2024
1 parent bfbc24b commit c4218fc
Show file tree
Hide file tree
Showing 29 changed files with 207 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-outer>
<x-inner>
<!---->
fallback for foo
<!---->
</x-inner>
</x-outer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-outer';
export { default } from 'x/outer';
export * from 'x/outer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:render-mode="light">
<slot name=foo>fallback for foo</slot>
</template>
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';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template lwc:render-mode="light">
<x-inner>
z
<div>
1
<div slot="foo">2</div>
3
<template if:true={isTrue}>
4
<div slot="foo">5</div>
6
</template>
7
</div>
8
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
static renderMode = 'light';
isTrue = true;
isFalse = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<x-outer>
<template shadowrootmode="open">
<x-inner>
<template shadowrootmode="open">
<slot name="foo">
fallback for foo
</slot>
</template>
z
<div>
1
<div slot="foo">
2
</div>
34
<div slot="foo">
5
</div>
67
</div>
8
</x-inner>
</template>
</x-outer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-outer';
export { default } from 'x/outer';
export * from 'x/outer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:render-mode="shadow">
<slot name=foo>fallback for foo</slot>
</template>
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 = 'shadow';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template lwc:render-mode="shadow">
<x-inner>
z
<div>
1
<div slot="foo">2</div>
3
<template if:true={isTrue}>
4
<div slot="foo">5</div>
6
</template>
7
</div>
8
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
static renderMode = 'shadow';
isTrue = true;
isFalse = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-outer>
<x-inner>
<!---->
fallback for foo
<!---->
</x-inner>
</x-outer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-outer';
export { default } from 'x/outer';
export * from 'x/outer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:render-mode="light">
<slot name=foo>fallback for foo</slot>
</template>
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';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template lwc:render-mode="light">
<x-inner>
z
<div>
1
<div slot="foo">2</div>
3
<template lwc:if={isTrue}>
4
<div slot="foo">5</div>
6
</template>
7
</div>
8
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
static renderMode = 'light';
isTrue = true;
isFalse = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<x-outer>
<template shadowrootmode="open">
<x-inner>
<template shadowrootmode="open">
<slot name="foo">
fallback for foo
</slot>
</template>
z
<div>
1
<div slot="foo">
2
</div>
3
<!---->
4
<div slot="foo">
5
</div>
6
<!---->
7
</div>
8
</x-inner>
</template>
</x-outer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-outer';
export { default } from 'x/outer';
export * from 'x/outer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:render-mode="shadow">
<slot name=foo>fallback for foo</slot>
</template>
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 = 'shadow';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template lwc:render-mode="shadow">
<x-inner>
z
<div>
1
<div slot="foo">2</div>
3
<template lwc:if={isTrue}>
4
<div slot="foo">5</div>
6
</template>
7
</div>
8
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
static renderMode = 'shadow';
isTrue = true;
isFalse = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const expectedFailures = new Set([
'slot-not-at-top-level/advanced/lwcIf/light/index.js',
'slot-not-at-top-level/advanced/lwcIf/shadow/index.js',
'slot-not-at-top-level/lwcIf-with-adjacent-text-nodes/light/index.js',
'slot-not-at-top-level/nested-elements/lwcIf/shadow/index.js',
'superclass/render-in-superclass/no-template-in-subclass/index.js',
'superclass/render-in-superclass/unused-default-in-subclass/index.js',
'superclass/render-in-superclass/unused-default-in-superclass/index.js',
Expand Down

0 comments on commit c4218fc

Please sign in to comment.