From 3624f9890625c328cb9933cb80be77c4c3fae136 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 14 Nov 2024 16:15:10 -0800 Subject: [PATCH] test(ssr): add more tests for dynamic components Co-authored-by: James Tu --- .../basic}/error.txt | 0 .../dynamic-components/{ => basic}/expected.html | 0 .../dynamic-components/{ => basic}/index.js | 0 .../{ => basic}/modules/x/dynamic/dynamic.html | 0 .../{ => basic}/modules/x/dynamic/dynamic.js | 0 .../{ => basic}/modules/x/test/test.html | 0 .../{ => basic}/modules/x/test/test.js | 0 .../invalid-ctor-function/error.txt | 1 + .../expected.html} | 0 .../invalid-ctor-function/index.js | 3 +++ .../dynamic-invalid-ctor.html} | 0 .../dynamic-invalid-ctor/dynamic-invalid-ctor.js | 5 +++++ .../dynamic-components/invalid-ctor/error.txt | 1 + .../invalid-ctor/expected.html | 0 .../dynamic-components/invalid-ctor/index.js | 3 +++ .../dynamic-invalid-ctor.html | 3 +++ .../dynamic-invalid-ctor/dynamic-invalid-ctor.js | 5 +++++ .../dynamic-components/no-ctor/error.txt | 0 .../no-ctor}/expected.html | 0 .../no-ctor}/index.js | 0 .../x/dynamic-no-ctor/dynamic-no-ctor.html | 3 +++ .../modules/x/dynamic-no-ctor/dynamic-no-ctor.js | 0 .../slots/light-fallback/error.txt | 0 .../slots/light-fallback/expected.html | 11 +++++++++++ .../slots/light-fallback/index.js | 3 +++ .../modules/x/dynamic/dynamic.html | 3 +++ .../light-fallback/modules/x/dynamic/dynamic.js | 6 ++++++ .../light-fallback/modules/x/test/test.html | 5 +++++ .../slots/light-fallback/modules/x/test/test.js | 5 +++++ .../dynamic-components/slots/light/error.txt | 0 .../dynamic-components/slots/light/expected.html | 13 +++++++++++++ .../dynamic-components/slots/light/index.js | 3 +++ .../slots/light/modules/x/dynamic/dynamic.html | 5 +++++ .../slots/light/modules/x/dynamic/dynamic.js | 6 ++++++ .../slots/light/modules/x/test/test.html | 5 +++++ .../slots/light/modules/x/test/test.js | 5 +++++ .../dynamic-components/slots/shadow/error.txt | 0 .../slots/shadow/expected.html | 16 ++++++++++++++++ .../dynamic-components/slots/shadow/index.js | 3 +++ .../slots/shadow/modules/x/dynamic/dynamic.html | 5 +++++ .../slots/shadow/modules/x/dynamic/dynamic.js | 6 ++++++ .../slots/shadow/modules/x/test/test.html | 5 +++++ .../slots/shadow/modules/x/test/test.js | 5 +++++ .../src/__tests__/utils/expected-failures.ts | 9 +++++++-- 44 files changed, 141 insertions(+), 2 deletions(-) rename packages/@lwc/engine-server/src/__tests__/fixtures/{dynamic-component-no-ctor => dynamic-components/basic}/error.txt (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/expected.html (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/index.js (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/modules/x/dynamic/dynamic.html (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/modules/x/dynamic/dynamic.js (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/modules/x/test/test.html (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{ => basic}/modules/x/test/test.js (100%) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/error.txt rename packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/{error.txt => invalid-ctor-function/expected.html} (100%) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/index.js rename packages/@lwc/engine-server/src/__tests__/fixtures/{dynamic-component-no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html => dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html} (100%) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/error.txt create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/expected.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/index.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/error.txt rename packages/@lwc/engine-server/src/__tests__/fixtures/{dynamic-component-no-ctor => dynamic-components/no-ctor}/expected.html (100%) rename packages/@lwc/engine-server/src/__tests__/fixtures/{dynamic-component-no-ctor => dynamic-components/no-ctor}/index.js (100%) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html rename packages/@lwc/engine-server/src/__tests__/fixtures/{dynamic-component-no-ctor => dynamic-components/no-ctor}/modules/x/dynamic-no-ctor/dynamic-no-ctor.js (100%) create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/error.txt create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/expected.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/index.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/error.txt create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/expected.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/index.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/error.txt create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/expected.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/index.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.js create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.html create mode 100644 packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/error.txt similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/error.txt rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/error.txt diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/expected.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/expected.html rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/expected.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/index.js similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/index.js rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/index.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/dynamic/dynamic.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/dynamic/dynamic.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/dynamic/dynamic.html rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/dynamic/dynamic.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/dynamic/dynamic.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/dynamic/dynamic.js similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/dynamic/dynamic.js rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/dynamic/dynamic.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/test/test.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/test/test.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/test/test.html rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/test/test.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/test/test.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/test/test.js similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/modules/x/test/test.js rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/basic/modules/x/test/test.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/error.txt new file mode 100644 index 0000000000..5e20594de6 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/error.txt @@ -0,0 +1 @@ +Invalid constructor: "function fake() {}" is not a LightningElement constructor. \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/expected.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/error.txt rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/expected.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/index.js new file mode 100644 index 0000000000..30885ee9a6 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/index.js @@ -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'; \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js new file mode 100644 index 0000000000..792d37aee4 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor-function/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js @@ -0,0 +1,5 @@ +import { LightningElement } from 'lwc'; + +export default class extends LightningElement { + customCtor = function fake () {}; +} diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/error.txt new file mode 100644 index 0000000000..957987955f --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/error.txt @@ -0,0 +1 @@ +Invalid constructor: "frankenstein" is not a LightningElement constructor. \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/expected.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/index.js new file mode 100644 index 0000000000..30885ee9a6 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/index.js @@ -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'; \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html new file mode 100644 index 0000000000..e48fa62ca9 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js new file mode 100644 index 0000000000..111557c1c8 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/invalid-ctor/modules/x/dynamic-invalid-ctor/dynamic-invalid-ctor.js @@ -0,0 +1,5 @@ +import { LightningElement } from 'lwc'; + +export default class extends LightningElement { + customCtor = 'frankenstein'; +} \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/error.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/expected.html similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/expected.html rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/expected.html diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/index.js similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/index.js rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/index.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html new file mode 100644 index 0000000000..e48fa62ca9 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.js similarity index 100% rename from packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-component-no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.js rename to packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/no-ctor/modules/x/dynamic-no-ctor/dynamic-no-ctor.js diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/error.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/expected.html new file mode 100644 index 0000000000..886d6dc1d4 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/expected.html @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/index.js new file mode 100644 index 0000000000..6192730f7d --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/index.js @@ -0,0 +1,3 @@ +export const tagName = 'x-dynamic-component'; +export { default } from 'x/dynamic'; +export * from 'x/dynamic'; \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.html new file mode 100644 index 0000000000..58873891c4 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.html @@ -0,0 +1,3 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.js new file mode 100644 index 0000000000..01a4af18bf --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/dynamic/dynamic.js @@ -0,0 +1,6 @@ +import { LightningElement, track } from 'lwc'; +import Test from 'x/test'; + +export default class DynamicCtor extends LightningElement { + @track customCtor = Test; +} \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.html new file mode 100644 index 0000000000..75e1ea6d91 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.js new file mode 100644 index 0000000000..2ef6c3f92a --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light-fallback/modules/x/test/test.js @@ -0,0 +1,5 @@ +import { LightningElement } from 'lwc'; + +export default class Test extends LightningElement { + static renderMode = 'light' +} diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/error.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/expected.html new file mode 100644 index 0000000000..de8cba90f3 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/expected.html @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/index.js new file mode 100644 index 0000000000..6192730f7d --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/index.js @@ -0,0 +1,3 @@ +export const tagName = 'x-dynamic-component'; +export { default } from 'x/dynamic'; +export * from 'x/dynamic'; \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.html new file mode 100644 index 0000000000..76a4cad352 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.js new file mode 100644 index 0000000000..01a4af18bf --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/dynamic/dynamic.js @@ -0,0 +1,6 @@ +import { LightningElement, track } from 'lwc'; +import Test from 'x/test'; + +export default class DynamicCtor extends LightningElement { + @track customCtor = Test; +} \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.html new file mode 100644 index 0000000000..75e1ea6d91 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.js new file mode 100644 index 0000000000..2ef6c3f92a --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/light/modules/x/test/test.js @@ -0,0 +1,5 @@ +import { LightningElement } from 'lwc'; + +export default class Test extends LightningElement { + static renderMode = 'light' +} diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/error.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/expected.html new file mode 100644 index 0000000000..b080fb15c5 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/expected.html @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/index.js new file mode 100644 index 0000000000..6192730f7d --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/index.js @@ -0,0 +1,3 @@ +export const tagName = 'x-dynamic-component'; +export { default } from 'x/dynamic'; +export * from 'x/dynamic'; \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.html new file mode 100644 index 0000000000..76a4cad352 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.js new file mode 100644 index 0000000000..01a4af18bf --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/dynamic/dynamic.js @@ -0,0 +1,6 @@ +import { LightningElement, track } from 'lwc'; +import Test from 'x/test'; + +export default class DynamicCtor extends LightningElement { + @track customCtor = Test; +} \ No newline at end of file diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.html b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.html new file mode 100644 index 0000000000..025257c8b8 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.js b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.js new file mode 100644 index 0000000000..3e695ed7e4 --- /dev/null +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/dynamic-components/slots/shadow/modules/x/test/test.js @@ -0,0 +1,5 @@ +import { LightningElement } from 'lwc'; + +export default class Test extends LightningElement { + +} diff --git a/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts b/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts index b559ecd35f..49c15354ab 100644 --- a/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts +++ b/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts @@ -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',