Skip to content

Commit

Permalink
test(ssr): add more tests for dynamic components
Browse files Browse the repository at this point in the history
Co-authored-by: James Tu <[email protected]>
  • Loading branch information
nolanlawson and jmsjtu committed Nov 15, 2024
1 parent 7d7dea4 commit 3624f98
Show file tree
Hide file tree
Showing 44 changed files with 141 additions and 2 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,3 @@
export const tagName = 'x-dynamic-component-invalid-ctor';
export { default } from 'x/dynamic-invalid-ctor';
export * from 'x/dynamic-invalid-ctor';
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 @@
Invalid constructor: "frankenstein" is not a LightningElement constructor.
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';
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,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
customCtor = 'frankenstein';
}
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,8 +28,13 @@ export const expectedFailures = new Set([
'attribute-style/basic/index.js',
'attribute-style/dynamic/index.js',
'comments-text-preserve-off/index.js',
'dynamic-component-no-ctor/index.js',
'dynamic-components/index.js',
'dynamic-components/no-ctor/index.js',
'dynamic-components/basic/index.js',
'dynamic-components/invalid-ctor-function/index.js',
'dynamic-components/invalid-ctor/index.js',
'dynamic-components/slots/shadow/index.js',
'dynamic-components/slots/light/index.js',
'dynamic-components/slots/light-fallback/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 3624f98

Please sign in to comment.