-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ssr): add tests for nested elements in slots (#5048)
- Loading branch information
1 parent
bfbc24b
commit c4218fc
Showing
29 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
7 changes: 7 additions & 0 deletions
7
...r/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
...server/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
3 changes: 3 additions & 0 deletions
3
...__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/modules/x/inner/inner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
5 changes: 5 additions & 0 deletions
5
...ts__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/modules/x/inner/inner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
17 changes: 17 additions & 0 deletions
17
...__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/modules/x/outer/outer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
7 changes: 7 additions & 0 deletions
7
...ts__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/light/modules/x/outer/outer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Empty file.
24 changes: 24 additions & 0 deletions
24
.../src/__tests__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
...erver/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
3 changes: 3 additions & 0 deletions
3
..._/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/modules/x/inner/inner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
5 changes: 5 additions & 0 deletions
5
...s__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/modules/x/inner/inner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
17 changes: 17 additions & 0 deletions
17
..._/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/modules/x/outer/outer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
7 changes: 7 additions & 0 deletions
7
...s__/fixtures/slot-not-at-top-level/nested-elements/ifTrue/shadow/modules/x/outer/outer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
...er/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
...-server/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
3 changes: 3 additions & 0 deletions
3
...s__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/modules/x/inner/inner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
5 changes: 5 additions & 0 deletions
5
...sts__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/modules/x/inner/inner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
17 changes: 17 additions & 0 deletions
17
...s__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/modules/x/outer/outer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
7 changes: 7 additions & 0 deletions
7
...sts__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/light/modules/x/outer/outer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Empty file.
28 changes: 28 additions & 0 deletions
28
...r/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
3 changes: 3 additions & 0 deletions
3
...server/src/__tests__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
3 changes: 3 additions & 0 deletions
3
...__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/modules/x/inner/inner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
5 changes: 5 additions & 0 deletions
5
...ts__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/modules/x/inner/inner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
17 changes: 17 additions & 0 deletions
17
...__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/modules/x/outer/outer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
7 changes: 7 additions & 0 deletions
7
...ts__/fixtures/slot-not-at-top-level/nested-elements/lwcIf/shadow/modules/x/outer/outer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters