Skip to content

Commit

Permalink
test(ssr): add more tests for dynamic components (#4872)
Browse files Browse the repository at this point in the history
Co-authored-by: James Tu <[email protected]>
  • Loading branch information
nolanlawson and jmsjtu authored Nov 15, 2024
1 parent d2be62a commit d30539f
Show file tree
Hide file tree
Showing 44 changed files with 124 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Invalid constructor: "function fake() {}" is not a LightningElement constructor.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
customCtor = function fake () {};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dynamic-component-invalid-ctor';
export { default } from 'x/dynamic-invalid-ctor';
export * from 'x/dynamic-invalid-ctor';
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<lwc:component lwc:is={customCtor}></lwc:component>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<x-dynamic-component>
<template shadowrootmode="open">
<x-test>
a
<!---->
fallback
<!---->
b
</x-test>
</template>
</x-dynamic-component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dynamic-component';
export { default } from 'x/dynamic';
export * from 'x/dynamic';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<lwc:component lwc:is={customCtor}></lwc:component>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement, track } from 'lwc';
import Test from 'x/test';

export default class DynamicCtor extends LightningElement {
@track customCtor = Test;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template lwc:render-mode="light">
a
<slot>fallback</slot>
b
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Test extends LightningElement {
static renderMode = 'light'
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<x-dynamic-component>
<template shadowrootmode="open">
<x-test>
a
<!---->
<div>
Slot me in!
</div>
<!---->
b
</x-test>
</template>
</x-dynamic-component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dynamic-component';
export { default } from 'x/dynamic';
export * from 'x/dynamic';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<lwc:component lwc:is={customCtor}>
<div>Slot me in!</div>
</lwc:component>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement, track } from 'lwc';
import Test from 'x/test';

export default class DynamicCtor extends LightningElement {
@track customCtor = Test;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template lwc:render-mode="light">
a
<slot>fallback</slot>
b
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Test extends LightningElement {
static renderMode = 'light'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<x-dynamic-component>
<template shadowrootmode="open">
<x-test>
<template shadowrootmode="open">
a
<slot>
fallback
</slot>
b
</template>
<div>
Slot me in!
</div>
</x-test>
</template>
</x-dynamic-component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dynamic-component';
export { default } from 'x/dynamic';
export * from 'x/dynamic';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<lwc:component lwc:is={customCtor}>
<div>Slot me in!</div>
</lwc:component>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement, track } from 'lwc';
import Test from 'x/test';

export default class DynamicCtor extends LightningElement {
@track customCtor = Test;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
a
<slot>fallback</slot>
b
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class Test extends LightningElement {

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const expectedFailures = new Set([
'attribute-style/basic/index.js',
'attribute-style/dynamic/index.js',
'comments-text-preserve-off/index.js',
'dynamic-components/slots/shadow/index.js',
'dynamic-components/slots/light/index.js',
'dynamic-slots/index.js',
'empty-text-with-comments-non-static-optimized/index.js',
'if-conditional-slot-content/index.js',
Expand Down

0 comments on commit d30539f

Please sign in to comment.