diff --git a/test/validator/index.js b/test/validator/index.js index 9f991df4f2..8bf0400d7c 100644 --- a/test/validator/index.js +++ b/test/validator/index.js @@ -27,7 +27,8 @@ describe("validate", () => { const { warnings } = svelte.compile(input, { dev: config.dev, legacy: config.legacy, - generate: false + generate: false, + customElement: config.customElement }); assert.deepEqual(warnings.map(w => ({ diff --git a/test/validator/samples/tag-custom-element-options-missing/input.svelte b/test/validator/samples/tag-custom-element-options-missing/input.svelte new file mode 100644 index 0000000000..f5f5d74270 --- /dev/null +++ b/test/validator/samples/tag-custom-element-options-missing/input.svelte @@ -0,0 +1 @@ + diff --git a/test/validator/samples/tag-custom-element-options-missing/warnings.json b/test/validator/samples/tag-custom-element-options-missing/warnings.json new file mode 100644 index 0000000000..185c6c3179 --- /dev/null +++ b/test/validator/samples/tag-custom-element-options-missing/warnings.json @@ -0,0 +1,15 @@ +[{ + "code": "missing-custom-element-compile-options", + "message": "The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?", + "start": { + "line": 1, + "column": 16, + "character": 16 + }, + "end": { + "line": 1, + "column": 36, + "character": 36 + }, + "pos": 16 +}] diff --git a/test/validator/samples/tag-custom-element-options-true/_config.js b/test/validator/samples/tag-custom-element-options-true/_config.js new file mode 100644 index 0000000000..ec3c350d46 --- /dev/null +++ b/test/validator/samples/tag-custom-element-options-true/_config.js @@ -0,0 +1,3 @@ +export default { + customElement: true +}; diff --git a/test/validator/samples/tag-custom-element-options-true/input.svelte b/test/validator/samples/tag-custom-element-options-true/input.svelte new file mode 100644 index 0000000000..f5f5d74270 --- /dev/null +++ b/test/validator/samples/tag-custom-element-options-true/input.svelte @@ -0,0 +1 @@ +