diff --git a/test/runtime-puppeteer/samples/dynamic-element-custom-element/_config.js b/test/runtime-puppeteer/samples/dynamic-element-custom-element/_config.js new file mode 100644 index 0000000000..64b362a702 --- /dev/null +++ b/test/runtime-puppeteer/samples/dynamic-element-custom-element/_config.js @@ -0,0 +1,47 @@ +export default { + skip_if_ssr: true, + props: { + tag: 'my-custom-element', + name: null + }, + html: ` + Hello null! + Hello null! + `, + + test({ assert, component, target }) { + component.name = undefined; + assert.htmlEqual( + target.innerHTML, + `Hello undefined! + Hello undefined!` + ); + + component.name = 'foo'; + assert.htmlEqual( + target.innerHTML, + `Hello foo! + Hello foo!` + ); + + component.tag = null; + assert.htmlEqual( + target.innerHTML, + 'Hello foo!' + ); + + component.tag = 'div'; + assert.htmlEqual( + target.innerHTML, + `
+ Hello foo!` + ); + + component.tag = 'my-custom-element'; + assert.htmlEqual( + target.innerHTML, + `Hello foo! + Hello foo!` + ); + } +}; diff --git a/test/runtime-puppeteer/samples/dynamic-element-custom-element/main.svelte b/test/runtime-puppeteer/samples/dynamic-element-custom-element/main.svelte new file mode 100644 index 0000000000..81e29895d7 --- /dev/null +++ b/test/runtime-puppeteer/samples/dynamic-element-custom-element/main.svelte @@ -0,0 +1,32 @@ + + + +