Skip to content

Commit

Permalink
test(ssr): more tests for mixed light/scoped slots (#5133)
Browse files Browse the repository at this point in the history
Co-authored-by: John Hefferman <[email protected]>
  • Loading branch information
nolanlawson and jhefferman-sfdc authored Jan 13, 2025
1 parent 2b678bb commit 095a777
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<x-parent>
<template shadowrootmode="open">
<x-child>
<div>
<!---->
<!---->
<!---->
<span>
a
</span>
<span>
b
</span>
<!---->
</div>
</x-child>
</template>
</x-parent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-parent';
export { default } from 'x/parent';
export * from 'x/parent';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template lwc:render-mode="light">
<div>
<slot>Default fallback slot content</slot>
<slot name="foo">Named fallback slot content</slot>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class Child extends LightningElement {
static renderMode = 'light';
item = { id: 99, name: 'ssr' };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<x-child>
<span slot="foo">a</span>
<template lwc:slot-data="data1">
<span>default {data1.id} - {foo}</span>
</template>
<span slot="foo">b</span>
</x-child>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Parent extends LightningElement {
foo = 'bar';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<x-parent>
<template shadowrootmode="open">
<x-child>
</x-child>
</template>
</x-parent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-parent';
export { default } from 'x/parent';
export * from 'x/parent';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<template lwc:render-mode="light">
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class Child extends LightningElement {
static renderMode = 'light';
item = { id: 99, name: 'ssr' };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<x-child>
<span slot="foo">a</span>
<template lwc:slot-data="data1">
<span>default {data1.id} - {foo}</span>
</template>
<span slot="foo">b</span>
</x-child>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Parent extends LightningElement {
foo = 'bar';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<x-parent>
<template shadowrootmode="open">
<x-child>
<div>
<!---->
<!---->
<span>
1 default 99 - bar
</span>
<!---->
<!---->
<span>
5 default 99 - bar
</span>
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
<!---->
Fallback slot content 3
<!---->
</div>
</x-child>
</template>
</x-parent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-parent';
export { default } from 'x/parent';
export * from 'x/parent';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lwc:render-mode="light">
<div>
<slot lwc:slot-bind={item}>Fallback slot content</slot>
<slot lwc:slot-bind={item} name="slot1">Fallback slot content 1</slot>
<slot lwc:slot-bind={item} name="slot2">Fallback slot content 2</slot>
<slot lwc:slot-bind={item} name="slot3">Fallback slot content 3</slot>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class Child extends LightningElement {
static renderMode = 'light';
item = { id: 99, name: 'ssr' };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<x-child>
<template lwc:slot-data="data1">
<span>1 default {data1.id} - {foo}</span>
</template>
<span>2 default {data1} - {foo}</span>
<span slot="slot1">3 slot1 {data1} - {foo}</span>
<span slot="slot2">4 slot2 {data1} - {foo}</span>
<template lwc:slot-data="data1">
<span>5 default {data1.id} - {foo}</span>
</template>
</x-child>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Parent extends LightningElement {
foo = 'bar';
}

0 comments on commit 095a777

Please sign in to comment.