From 038e7b092add1bf6fdbb2d27e9a461f7f7c311d9 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sat, 21 May 2022 12:42:30 +0900 Subject: [PATCH] add test --- .../samples/component-not-constructor/Sub.svelte | 1 + .../samples/component-not-constructor/_config.js | 11 +++++++++++ .../component-not-constructor/main.svelte | 9 +++++++++ .../component-not-constructor2/Sub.svelte | 1 + .../component-not-constructor2/_config.js | 16 ++++++++++++++++ .../component-not-constructor2/main.svelte | 9 +++++++++ 6 files changed, 47 insertions(+) create mode 100644 test/runtime/samples/component-not-constructor/Sub.svelte create mode 100644 test/runtime/samples/component-not-constructor/_config.js create mode 100644 test/runtime/samples/component-not-constructor/main.svelte create mode 100644 test/runtime/samples/component-not-constructor2/Sub.svelte create mode 100644 test/runtime/samples/component-not-constructor2/_config.js create mode 100644 test/runtime/samples/component-not-constructor2/main.svelte diff --git a/test/runtime/samples/component-not-constructor/Sub.svelte b/test/runtime/samples/component-not-constructor/Sub.svelte new file mode 100644 index 0000000000..dd6d0bb1a9 --- /dev/null +++ b/test/runtime/samples/component-not-constructor/Sub.svelte @@ -0,0 +1 @@ +
Sub
\ No newline at end of file diff --git a/test/runtime/samples/component-not-constructor/_config.js b/test/runtime/samples/component-not-constructor/_config.js new file mode 100644 index 0000000000..facdcccd25 --- /dev/null +++ b/test/runtime/samples/component-not-constructor/_config.js @@ -0,0 +1,11 @@ +export default { + skip_if_ssr: true, + skip_if_hydrate_from_ssr: true, + compileOptions: { + dev: true + }, + props: { + selected: false + }, + error: 'this={...} of should specify a Svelte component.' +}; diff --git a/test/runtime/samples/component-not-constructor/main.svelte b/test/runtime/samples/component-not-constructor/main.svelte new file mode 100644 index 0000000000..dec7e2af79 --- /dev/null +++ b/test/runtime/samples/component-not-constructor/main.svelte @@ -0,0 +1,9 @@ + + + diff --git a/test/runtime/samples/component-not-constructor2/Sub.svelte b/test/runtime/samples/component-not-constructor2/Sub.svelte new file mode 100644 index 0000000000..dd6d0bb1a9 --- /dev/null +++ b/test/runtime/samples/component-not-constructor2/Sub.svelte @@ -0,0 +1 @@ +
Sub
\ No newline at end of file diff --git a/test/runtime/samples/component-not-constructor2/_config.js b/test/runtime/samples/component-not-constructor2/_config.js new file mode 100644 index 0000000000..13ed09cecc --- /dev/null +++ b/test/runtime/samples/component-not-constructor2/_config.js @@ -0,0 +1,16 @@ +export default { + compileOptions: { + dev: true + }, + props: { + selected: true + }, + test({ assert, component }) { + try { + component.selected = false; + throw new Error('Expected an error'); + } catch (err) { + assert.equal(err.message, 'this={...} of should specify a Svelte component.'); + } + } +}; diff --git a/test/runtime/samples/component-not-constructor2/main.svelte b/test/runtime/samples/component-not-constructor2/main.svelte new file mode 100644 index 0000000000..dec7e2af79 --- /dev/null +++ b/test/runtime/samples/component-not-constructor2/main.svelte @@ -0,0 +1,9 @@ + + +