Skip to content

Commit

Permalink
test(engine-server): more slot tests (#4666)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Oct 21, 2024
1 parent ed5327f commit 02e434e
Show file tree
Hide file tree
Showing 29 changed files with 233 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/@lwc/engine-server/src/__tests__/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ async function compileFixture({ input, dirname }: { input: string; dirname: stri
// TODO [#3331]: The existing lwc:dynamic fixture test will generate warnings that can be safely suppressed.
const shouldIgnoreWarning =
message.includes('LWC1187') ||
// TODO [#4497]: stop warning on duplicate slots or disallow them entirely (LWC1137 is duplicate slots)
message.includes('LWC1137') ||
message.includes('-h-t-m-l') ||
code === 'CIRCULAR_DEPENDENCY';
if (!shouldIgnoreWarning) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<x-outer>
<x-inner>
a
<!---->
<div>
yolo
</div>
<!---->
b
<!---->
<div>
yolo
</div>
<!---->
c
<!---->
<div>
yolo
</div>
<!---->
d
</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,9 @@
<template lwc:render-mode="light">
a
<slot name=foo></slot>
b
<slot name=foo></slot>
c
<slot name=foo></slot>
d
</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,5 @@
<template lwc:render-mode="light">
<x-inner>
<div slot="foo">yolo</div>
</x-inner>
</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,21 @@
<x-outer>
<template shadowrootmode="open">
<x-inner>
<template shadowrootmode="open">
a
<slot name="foo">
</slot>
b
<slot name="foo">
</slot>
c
<slot name="foo">
</slot>
d
</template>
<div slot="foo">
yolo
</div>
</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,9 @@
<template>
a
<slot name=foo></slot>
b
<slot name=foo></slot>
c
<slot name=foo></slot>
d
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { LightningElement} from 'lwc';

export default class extends LightningElement {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<x-inner>
<div slot="foo">yolo</div>
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement} from 'lwc';

export default class extends LightningElement {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<x-outer>
<x-inner>
a
<!---->
<div>
x
</div>
<!---->
b
<!---->
<div>
y
</div>
<div>
y2
</div>
<div>
y3
</div>
<!---->
c
<!---->
default1default2default3default4default5default6
<!---->
d
</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,9 @@
<template lwc:render-mode="light">
a
<slot name="x"></slot>
b
<slot name="y"></slot>
c
<slot></slot>
d
</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,15 @@
<template lwc:render-mode="light">
<x-inner>
default1
<div slot="y">y</div>
default2
<div slot="x">x</div>
default3
<div slot="y">y2</div>
default4
<div slot="y">y3</div>
default5
<div slot="does-not-exist">does-not-exist</div>
default6
</x-inner>
</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,39 @@
<x-outer>
<template shadowrootmode="open">
<x-inner>
<template shadowrootmode="open">
a
<slot name="x">
</slot>
b
<slot name="y">
</slot>
c
<slot>
</slot>
d
</template>
default1
<div slot="y">
y
</div>
default2
<div slot="x">
x
</div>
default3
<div slot="y">
y2
</div>
default4
<div slot="y">
y3
</div>
default5
<div slot="does-not-exist">
does-not-exist
</div>
default6
</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,9 @@
<template>
a
<slot name="x"></slot>
b
<slot name="y"></slot>
c
<slot></slot>
d
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement} from 'lwc';

export default class extends LightningElement {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<x-inner>
default1
<div slot="y">y</div>
default2
<div slot="x">x</div>
default3
<div slot="y">y2</div>
default4
<div slot="y">y3</div>
default5
<div slot="does-not-exist">does-not-exist</div>
default6
</x-inner>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement} from 'lwc';

export default class extends LightningElement {}

0 comments on commit 02e434e

Please sign in to comment.