Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ssr): more tests for mixed light/scoped slots #5133

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
}