diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 6871094f5c..7daff3f1ab 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,10 +8,13 @@ the issue. One way we prioritize issues is by the number of :+1: reactions on their descriptions. Please DO NOT add `+1` or :+1: comments. ### Feature requests and proposals + We're excited to hear how we can make Svelte better. Please add as much detail -as you can on your use case. +as you can on your use case. To propose an implementation of a large feature or +change, please create an [RFC](https://github.com/sveltejs/rfcs). ### Bugs + If you're filing an issue about a bug please include as much information as you can including the following. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f5369e9991..94f0340e8e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,6 +7,8 @@ assignees: '' --- +## Is this about svelte@next? This project is currently in a pre-release stage and breaking changes may occur at any time. Please do not post any kind of bug reports or questions on GitHub about it. + **Describe the bug** A clear and concise description of what the bug is. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e533c21c96..923bfdb50c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,6 +7,11 @@ assignees: '' --- + + **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. For example: I'm always frustrated when [...] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7bd900ac33..d14a0f9fe4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,7 @@ - - ### Before submitting the PR, please make sure you do the following -- [ ] It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases, features are absent for a reason. -- [ ] This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them. -- [ ] Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to `npm run lint`!) +- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs +- [ ] This message body should clearly illustrate what problems it solves. +- [ ] Ideally, include a test that fails without this PR but passes with it. + ### Tests -- [ ] Run the tests with `npm test` or `yarn test`) +- [ ] Run the tests with `npm test` and lint the project with `npm run lint` diff --git a/.gitignore b/.gitignore index f7fac04eba..a471c3aaa2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,10 +18,6 @@ node_modules /coverage/ /coverage.lcov /test/*/samples/_ -/test/sourcemaps/samples/*/output.js -/test/sourcemaps/samples/*/output.js.map -/test/sourcemaps/samples/*/output.css -/test/sourcemaps/samples/*/output.css.map /yarn-error.log _actual*.* _output diff --git a/.mocharc.js b/.mocharc.js new file mode 100644 index 0000000000..e55f26099e --- /dev/null +++ b/.mocharc.js @@ -0,0 +1,14 @@ +module.exports = { + file: [ + 'test/test.ts' + ], + require: [ + 'sucrase/register' + ] +}; + +// add coverage options when running 'npx c8 mocha' +if (process.env.NODE_V8_COVERAGE) { + module.exports.fullTrace = true; + module.exports.require.push('source-map-support/register'); +} diff --git a/CHANGELOG.md b/CHANGELOG.md index bd070862f3..cfff198368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,92 @@ ## Unreleased +* Fix `$$props` and `$$restProps` when compiling to a custom element ([#5482](https://github.com/sveltejs/svelte/issues/5482)) +* Add `Element` and `Node` to known globals ([#5586](https://github.com/sveltejs/svelte/issues/5586)) + +## 3.29.4 + +* Fix code generation error with `??` alongside logical operators ([#5558](https://github.com/sveltejs/svelte/issues/5558)) + +## 3.29.3 + +* Hopefully actually republish with proper UMD build for use in the REPL + +## 3.29.2 + +* Republish with proper UMD build for use in the REPL + +## 3.29.1 + +* Fix compiler hanging on `` ([#5475](https://github.com/sveltejs/svelte/issues/5475)) +* Fix types on `get` function in `svelte/store` ([#5483](https://github.com/sveltejs/svelte/pull/5483)) +* Add missing `end` field on ASTs for non-top-level ` \ No newline at end of file diff --git a/site/content/tutorial/13-classes/01-classes/app-b/App.svelte b/site/content/tutorial/13-classes/01-classes/app-b/App.svelte index 4da386991d..a8861ad537 100644 --- a/site/content/tutorial/13-classes/01-classes/app-b/App.svelte +++ b/site/content/tutorial/13-classes/01-classes/app-b/App.svelte @@ -7,23 +7,23 @@ display: block; } - .active { + .selected { background-color: #ff3e00; color: white; } \ No newline at end of file diff --git a/site/content/tutorial/13-classes/01-classes/text.md b/site/content/tutorial/13-classes/01-classes/text.md index 7ad3045399..6e5b3b3c0d 100644 --- a/site/content/tutorial/13-classes/01-classes/text.md +++ b/site/content/tutorial/13-classes/01-classes/text.md @@ -6,7 +6,7 @@ Like any other attribute, you can specify classes with a JavaScript attribute, s ```html ``` @@ -15,9 +15,9 @@ This is such a common pattern in UI development that Svelte includes a special d ```html ``` -The `active` class is added to the element whenever the value of the expression is truthy, and removed when it's falsy. \ No newline at end of file +The `selected` class is added to the element whenever the value of the expression is truthy, and removed when it's falsy. diff --git a/site/content/tutorial/16-special-elements/01-svelte-self/text.md b/site/content/tutorial/16-special-elements/01-svelte-self/text.md index 773dded83e..c7946f6c6d 100644 --- a/site/content/tutorial/16-special-elements/01-svelte-self/text.md +++ b/site/content/tutorial/16-special-elements/01-svelte-self/text.md @@ -14,7 +14,7 @@ It's useful for things like this folder tree view, where folders can contain *ot {/if} ``` -...but that's impossible, because a file can't import itself. Instead, we use ``: +...but that's impossible, because a module can't import itself. Instead, we use ``: ```html {#if file.type === 'folder'} @@ -22,4 +22,4 @@ It's useful for things like this folder tree view, where folders can contain *ot {:else} {/if} -``` \ No newline at end of file +``` diff --git a/site/package-lock.json b/site/package-lock.json index 1132b9f324..93932806f8 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -315,6 +315,12 @@ "@babel/types": "^7.4.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/helper-wrap-function": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", @@ -1270,6 +1276,168 @@ "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.9.tgz", "integrity": "sha512-VZqSaulg2kVQYMulmuZcvapPwH5/y81YHANiFIKz1GNZoG/F4o1JSeLlrvXJ8tC+RPUjxdrebfT3Qn+bnMi0bA==" }, + "@rollup/plugin-babel": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.2.0.tgz", + "integrity": "sha512-CPABsajaKjINgBQ3it+yMnfVO3ibsrMBxRzbUOUw2cL1hsZJ7aogU8mgglQm3S2hHJgjnAmxPz0Rq7DVdmHsTw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.10.4", + "@rollup/pluginutils": "^3.1.0" + }, + "dependencies": { + "@babel/helper-module-imports": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz", + "integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==", + "dev": true, + "requires": { + "@babel/types": "^7.10.4" + } + }, + "@babel/types": { + "version": "7.11.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", + "integrity": "sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + } + } + }, + "@rollup/plugin-commonjs": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-15.0.0.tgz", + "integrity": "sha512-8uAdikHqVyrT32w1zB9VhW6uGwGjhKgnDNP4pQJsjdnyF4FgCj6/bmv24c7v2CuKhq32CcyCwRzMPEElaKkn0w==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.1.tgz", + "integrity": "sha512-tF0hv+Yi2Ot1cwj9eYHtxC0jB9bmjacjQs6ZBTj82H8JwUywFuc+7E83NWfNMwHXZc11mjfFcVXPe9gEP4B8dg==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8" + } + }, + "@rollup/plugin-node-resolve": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-9.0.0.tgz", + "integrity": "sha512-gPz+utFHLRrd41WMP13Jq5mqqzHL3OXrfj3/MkSyB6UBIcuNt9j60GCbarzMzdf1VHFpOxfQh/ez7wyadLMqkg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.17.0" + }, + "dependencies": { + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "@rollup/plugin-replace": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.3.3.tgz", + "integrity": "sha512-XPmVXZ7IlaoWaJLkSCDaa0Y6uVo5XQYHhiMFzOd5qSv5rE+t/UJToPIOE56flKIxBFQI27ONsxb7dqHnwSsjKQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8", + "magic-string": "^0.25.5" + }, + "dependencies": { + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + } + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, "@sindresorhus/slugify": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-0.9.1.tgz", @@ -1281,9 +1449,9 @@ } }, "@sveltejs/site-kit": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@sveltejs/site-kit/-/site-kit-1.2.0.tgz", - "integrity": "sha512-C7puq+1so3fKPPZAnQJQlKfyCG6FsnSSFSS2LRIhWD8VK2FL5j8Eq7DIKSxUvWbGw1AsxnzO3dIHJWPB7fwjKg==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@sveltejs/site-kit/-/site-kit-1.2.5.tgz", + "integrity": "sha512-fA1YWW4tYOxPRVocx+jF4S2LGamku8xeKx/+J5aY7ZCbwuo/c4VF+T0K7WuQRI8U6Dw3pJqdiCra+xH4TnCGRw==", "dev": true, "requires": { "@sindresorhus/slugify": "^0.9.1", @@ -1291,9 +1459,9 @@ } }, "@sveltejs/svelte-repl": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.2.0.tgz", - "integrity": "sha512-2vLQnOVrsmn2d2K4a6urGm8OulGGSPhZCGNySSb1H8nOPsgKrdcTt5qoaxNYXgcyVp55Yow2SvXYXsyJKd4KEQ==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@sveltejs/svelte-repl/-/svelte-repl-0.2.1.tgz", + "integrity": "sha512-ShNjMdsEAzGLu2PoogJEuWcV47E+1CsO8dNJ2wZcs7xyPsvuswp6KV1jFsBQmWZ+jLqtnRhlo6w2Mf43XOS/Dg==", "dev": true, "requires": { "codemirror": "^5.49.2", @@ -1356,20 +1524,14 @@ } }, "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", "dev": true, "requires": { "@types/node": "*" } }, - "acorn": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true - }, "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -1556,9 +1718,9 @@ "dev": true }, "clean-css": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz", - "integrity": "sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.3.tgz", + "integrity": "sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==", "dev": true, "requires": { "source-map": "~0.6.0" @@ -1573,9 +1735,9 @@ } }, "clipboard": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", - "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz", + "integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==", "optional": true, "requires": { "good-listener": "^1.2.2", @@ -1601,9 +1763,9 @@ "dev": true }, "codemirror": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.55.0.tgz", - "integrity": "sha512-TumikSANlwiGkdF/Blnu/rqovZ0Y3Jh8yy9TqrPbSM0xxSucq3RgnpVDQ+mD9q6JERJEIT2FMuF/fBGfkhIR/g==", + "version": "5.57.0", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.57.0.tgz", + "integrity": "sha512-WGc6UL7Hqt+8a6ZAsj/f1ApQl3NPvHY/UQSzG6fB6l4BjExgVdhFaxd7mRTw1UCiYe/6q86zHP+kfvBQcZGvUg==", "dev": true }, "color-convert": { @@ -1622,9 +1784,15 @@ "dev": true }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, "concat-map": { @@ -1693,12 +1861,6 @@ } } }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -1727,6 +1889,12 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1865,9 +2033,9 @@ "dev": true }, "estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", "dev": true }, "esutils": { @@ -1950,6 +2118,13 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -2178,15 +2353,6 @@ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, - "is-reference": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz", - "integrity": "sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==", - "dev": true, - "requires": { - "@types/estree": "0.0.39" - } - }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -2211,12 +2377,6 @@ "has-symbols": "^1.0.0" } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2224,22 +2384,29 @@ "dev": true }, "jest-worker": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", - "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.3.0.tgz", + "integrity": "sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw==", "dev": true, "requires": { - "merge-stream": "^1.0.1", - "supports-color": "^6.1.0" + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" }, "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } @@ -2474,15 +2641,6 @@ "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", "dev": true }, - "magic-string": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.2.tgz", - "integrity": "sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg==", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -2493,9 +2651,9 @@ } }, "marked": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", - "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/marked/-/marked-1.1.1.tgz", + "integrity": "sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw==" }, "mem": { "version": "4.3.0", @@ -2515,18 +2673,15 @@ "dev": true }, "merge-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", - "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "mime": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", - "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" }, "mimic-fn": { "version": "2.1.0", @@ -2702,9 +2857,9 @@ } }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true }, "node-pg-migrate": { @@ -3105,6 +3260,12 @@ "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "pidtree": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz", @@ -3170,9 +3331,9 @@ "integrity": "sha512-plS7uY0WWiTBwWZs9KM3M88ZxHWKbrbMUDf52CPum6BqAxiLmKROmaTnmhXtv0krQ0l0HRLcFS8JDwOFyPt/OQ==" }, "prismjs": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.17.1.tgz", - "integrity": "sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.21.0.tgz", + "integrity": "sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw==", "requires": { "clipboard": "^2.0.0" } @@ -3189,12 +3350,6 @@ "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=", "dev": true }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -3205,6 +3360,15 @@ "once": "^1.3.1" } }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -3216,21 +3380,6 @@ "path-type": "^3.0.0" } }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -3361,121 +3510,74 @@ } }, "rollup": { - "version": "1.21.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.21.2.tgz", - "integrity": "sha512-sCAHlcQ/PExU5t/kRwkEWHdhGmQrZ2IgdQzbjPVNfhWbKHMMZGYqkASVTpQqRPLtQKg15xzEscc+BnIK/TE7/Q==", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "@types/node": "^12.7.4", - "acorn": "^7.0.0" - }, - "dependencies": { - "@types/node": { - "version": "12.7.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.4.tgz", - "integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ==", - "dev": true - } - } - }, - "rollup-plugin-babel": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz", - "integrity": "sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "rollup-pluginutils": "^2.8.1" - } - }, - "rollup-plugin-commonjs": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", - "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", + "version": "2.26.10", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.26.10.tgz", + "integrity": "sha512-dUnjCWOA0h9qNX6qtcHidyatz8FAFZxVxt1dbcGtKdlJkpSxGK3G9+DLCYvtZr9v94D129ij9zUhG+xbRoqepw==", "dev": true, "requires": { - "estree-walker": "^0.6.1", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0", - "rollup-pluginutils": "^2.8.1" + "fsevents": "~2.1.2" } }, - "rollup-plugin-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz", - "integrity": "sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==", + "rollup-plugin-svelte": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-6.0.0.tgz", + "integrity": "sha512-y9qtWa+iNYwXdOZqaEqz3i6k3gzofC9JXzv+WVKDOt0DLiJxJaSrlKKf4YkKG91RzTK5Lo+0fW8in9QH/DxEhA==", "dev": true, "requires": { - "rollup-pluginutils": "^2.5.0" + "require-relative": "^0.8.7", + "rollup-pluginutils": "^2.8.2", + "sourcemap-codec": "^1.4.8" } }, - "rollup-plugin-node-resolve": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", - "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", + "rollup-plugin-terser": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.1.tgz", + "integrity": "sha512-HL0dgzSxBYG/Ly9i/E5Sc+PuKKZ0zBzk11VmLCfdUtpqH4yYqkLclPkTqRy85FU9246yetImOClaQ/ufnj08vg==", "dev": true, "requires": { - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1", - "rollup-pluginutils": "^2.8.1" + "@babel/code-frame": "^7.10.4", + "jest-worker": "^26.2.1", + "serialize-javascript": "^4.0.0", + "terser": "^5.0.0" }, "dependencies": { - "resolve": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", - "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", "dev": true, "requires": { - "path-parse": "^1.0.6" + "@babel/highlight": "^7.10.4" + } + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" } } } }, - "rollup-plugin-replace": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz", - "integrity": "sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA==", - "dev": true, - "requires": { - "magic-string": "^0.25.2", - "rollup-pluginutils": "^2.6.0" - } - }, - "rollup-plugin-svelte": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-5.1.0.tgz", - "integrity": "sha512-4MRZG29dAWDpoxEs5uIHzDnYafQEOLaKIJAuDYUtFIzEm1F1IGSTlFyjd8/qk4wltlHdu6V7YfZY53+CKryhMg==", - "dev": true, - "requires": { - "require-relative": "^0.8.7", - "rollup-pluginutils": "^2.3.3", - "sourcemap-codec": "^1.4.4" - } - }, - "rollup-plugin-terser": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.1.1.tgz", - "integrity": "sha512-McIMCDEY8EU6Y839C09UopeRR56wXHGdvKKjlfiZG/GrP6wvZQ62u2ko/Xh1MNH2M9WDL+obAAHySljIZYCuPQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "jest-worker": "^24.6.0", - "rollup-pluginutils": "^2.8.1", - "serialize-javascript": "^1.7.0", - "terser": "^4.1.0" - } - }, "rollup-pluginutils": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz", - "integrity": "sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", "dev": true, "requires": { "estree-walker": "^0.6.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + } } }, "safe-buffer": { @@ -3495,9 +3597,9 @@ } }, "sapper": { - "version": "0.27.11", - "resolved": "https://registry.npmjs.org/sapper/-/sapper-0.27.11.tgz", - "integrity": "sha512-5EaPZhlc8OnyN3UCI6dRSM1Gz5sxyzLZG/1z5nMvZhg9Ng+rSvEvJx/rW/tSHcnQPa8or7+YcbfvQHKS5oPHiw==", + "version": "0.27.16", + "resolved": "https://registry.npmjs.org/sapper/-/sapper-0.27.16.tgz", + "integrity": "sha512-q8dohkbhga6xO+0a8h84odFyoilQ0D0vJtF8NHra/DQmSeN2R2MXUfwhw3EyvLms3T1x8H3v+qw642Qf5JXA9g==", "dev": true, "requires": { "html-minifier": "^4.0.0", @@ -3505,14 +3607,6 @@ "shimport": "^1.0.1", "sourcemap-codec": "^1.4.6", "string-hash": "^1.1.3" - }, - "dependencies": { - "sourcemap-codec": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", - "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", - "dev": true - } } }, "sax": { @@ -3533,10 +3627,13 @@ "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" }, "serialize-javascript": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.7.0.tgz", - "integrity": "sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA==", - "dev": true + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } }, "set-blocking": { "version": "2.0.0", @@ -3595,9 +3692,9 @@ "dev": true }, "sirv": { - "version": "1.0.0-next.2", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.0-next.2.tgz", - "integrity": "sha512-hWp0todr4jSb1BFBiANRmqYRXzX02l36/X4tyHPYKqMZ+e1hrDZKUjIIXrAOBRWlAE/G5cGImUciMrUcU8DeOg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.6.tgz", + "integrity": "sha512-LRGu7Op4Xl9hhigOy2kcB53zAYTjNDdpooey49dIU0cMdpOv9ithVf7nstk3jvs8EhMiT/VORoyazZYGgw4vnA==", "requires": { "@polka/url": "^1.0.0-next.9", "mime": "^2.3.1", @@ -3611,9 +3708,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -3629,9 +3726,9 @@ } }, "sourcemap-codec": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz", - "integrity": "sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg==", + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, "spdx-correct": { @@ -3718,15 +3815,6 @@ "function-bind": "^1.1.1" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", @@ -3791,9 +3879,9 @@ } }, "terser": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.1.2.tgz", - "integrity": "sha512-jvNoEQSPXJdssFwqPSgWjsOrb+ELoE+ILpHPKXC83tIxOlh2U75F1KuB2luLD/3a6/7K3Vw5pDn+hvu0C4AzSw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.0.tgz", + "integrity": "sha512-XTT3D3AwxC54KywJijmY2mxZ8nJiEjBHVYzq8l9OaYuRFWeQNBwvipuzzYEP4e+/AVcd1hqG/CqgsdIRyT45Fg==", "dev": true, "requires": { "commander": "^2.20.0", @@ -3839,9 +3927,9 @@ "dev": true }, "totalist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/totalist/-/totalist-1.0.1.tgz", - "integrity": "sha512-HuAt9bWDCdLkebrIQr+i63NgQSvjeD2VTNUIEBqof/4pG4Gb6omuBOMUX0vF371cbfImXQzmb4Ue/0c9MUWGew==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz", + "integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==" }, "trim-right": { "version": "1.0.1", @@ -3858,22 +3946,10 @@ } }, "uglify-js": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", - "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", - "dev": true, - "requires": { - "commander": "~2.20.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } + "version": "3.10.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.4.tgz", + "integrity": "sha512-kBFT3U4Dcj4/pJ52vfjCSfyLyvG9VYYuGYPmrPvAxRw/i7xHiT4VvCev+uiEMcEEiu6UNB6KgWmGtSUYIWScbw==", + "dev": true }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", @@ -3918,12 +3994,6 @@ "pako": "^1.0.5" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, "util.promisify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", diff --git a/site/package.json b/site/package.json index 30075c9f37..6e00636476 100644 --- a/site/package.json +++ b/site/package.json @@ -4,9 +4,9 @@ "description": "Docs and examples for Svelte", "scripts": { "dev": "npm run copy-workers && sapper dev", - "copy-workers": "rm -rf static/workers && cp -r node_modules/@sveltejs/svelte-repl/workers static", + "copy-workers": "node scripts/copy-workers.js", "migrate": "node-pg-migrate -r dotenv/config", - "sapper": "npm run copy-workers && sapper build --legacy", + "build": "npm run copy-workers && sapper build --legacy", "update": "node scripts/update_template.js && node scripts/get-contributors.js && node scripts/update_whos_using.js", "start": "node __sapper__/build", "test": "mocha -r esm test/**", @@ -21,12 +21,12 @@ "flru": "^1.0.2", "httpie": "^1.1.2", "jsonwebtoken": "^8.5.1", - "marked": "^0.7.0", + "marked": "^1.0.0", "pg": "^7.12.1", "polka": "^1.0.0-next.9", "prism-svelte": "^0.4.3", - "prismjs": "^1.17.1", - "sirv": "^1.0.0-next.2", + "prismjs": "^1.21.0", + "sirv": "^1.0.0", "yootils": "0.0.16" }, "devDependencies": { @@ -35,26 +35,26 @@ "@babel/plugin-transform-runtime": "^7.6.0", "@babel/preset-env": "^7.6.0", "@babel/runtime": "^7.6.0", + "@rollup/plugin-babel": "^5.0.0", + "@rollup/plugin-commonjs": "^15.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^9.0.0", + "@rollup/plugin-replace": "^2.2.0", "@sindresorhus/slugify": "^0.9.1", - "@sveltejs/site-kit": "^1.2.0", - "@sveltejs/svelte-repl": "^0.2.0", + "@sveltejs/site-kit": "^1.2.5", + "@sveltejs/svelte-repl": "^0.2.1", "degit": "^2.1.4", "dotenv": "^8.1.0", "esm": "^3.2.25", "jimp": "^0.8.0", "mocha": "^6.2.0", - "node-fetch": "^2.6.0", + "node-fetch": "^2.6.1", "node-pg-migrate": "^3.22.0", "npm-run-all": "^4.1.5", - "rollup": "^1.21.2", - "rollup-plugin-babel": "^4.3.3", - "rollup-plugin-commonjs": "^10.1.0", - "rollup-plugin-json": "^4.0.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-svelte": "^5.1.0", - "rollup-plugin-terser": "^5.1.1", - "sapper": "^0.27.11", + "rollup": "^2.26.10", + "rollup-plugin-svelte": "^6.0.0", + "rollup-plugin-terser": "^7.0.0", + "sapper": "^0.27.16", "shelljs": "^0.8.3", "svelte": "^3.12.0" }, diff --git a/site/rollup.config.js b/site/rollup.config.js index d4efb4eb29..0078711c7a 100644 --- a/site/rollup.config.js +++ b/site/rollup.config.js @@ -1,10 +1,10 @@ import 'dotenv/config'; -import resolve from 'rollup-plugin-node-resolve'; -import replace from 'rollup-plugin-replace'; -import commonjs from 'rollup-plugin-commonjs'; +import babel from '@rollup/plugin-babel'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import replace from '@rollup/plugin-replace'; +import resolve from '@rollup/plugin-node-resolve'; import svelte from 'rollup-plugin-svelte'; -import babel from 'rollup-plugin-babel'; -import json from 'rollup-plugin-json'; import { terser } from 'rollup-plugin-terser'; import config from 'sapper/config/rollup.js'; import pkg from './package.json'; @@ -44,7 +44,7 @@ export default { legacy && babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], - runtimeHelpers: true, + babelHelpers: 'runtime', exclude: ['node_modules/@babel/**'], presets: [ ['@babel/preset-env', { @@ -63,6 +63,8 @@ export default { module: true }) ], + + preserveEntrySignatures: false, onwarn }, @@ -91,6 +93,8 @@ export default { require('module').builtinModules || Object.keys(process.binding('natives')) ) ], + + preserveEntrySignatures: 'strict', onwarn }, @@ -105,6 +109,9 @@ export default { }), commonjs(), !dev && terser() - ] + ], + + preserveEntrySignatures: false, + onwarn } }; diff --git a/site/scripts/copy-workers.js b/site/scripts/copy-workers.js new file mode 100644 index 0000000000..4856764ad0 --- /dev/null +++ b/site/scripts/copy-workers.js @@ -0,0 +1,4 @@ +const sh = require('shelljs'); + +sh.rm('-rf', 'static/workers'); +sh.cp('-r', 'node_modules/@sveltejs/svelte-repl/workers', 'static'); diff --git a/site/src/components/Repl/InputOutputToggle.svelte b/site/src/components/Repl/InputOutputToggle.svelte index dc4db92269..8233ee58b2 100644 --- a/site/src/components/Repl/InputOutputToggle.svelte +++ b/site/src/components/Repl/InputOutputToggle.svelte @@ -5,8 +5,8 @@ diff --git a/site/src/utils/highlight.js b/site/src/utils/highlight.js index d9e4fe5ec8..124af2e6be 100644 --- a/site/src/utils/highlight.js +++ b/site/src/utils/highlight.js @@ -1,6 +1,7 @@ import { langs } from '@sveltejs/site-kit/utils/markdown.js'; import PrismJS from 'prismjs'; import 'prismjs/components/prism-bash'; +import 'prismjs/components/prism-diff'; import 'prism-svelte'; export function highlight(source, lang) { diff --git a/site/static/examples/thumbnails/file-inputs.jpg b/site/static/examples/thumbnails/file-inputs.jpg new file mode 100644 index 0000000000..d302633f6b Binary files /dev/null and b/site/static/examples/thumbnails/file-inputs.jpg differ diff --git a/site/static/media/svelte-ts.png b/site/static/media/svelte-ts.png new file mode 100644 index 0000000000..ed562822c3 Binary files /dev/null and b/site/static/media/svelte-ts.png differ diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 88fe197993..d2542c9830 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -8,7 +8,7 @@ import { create_scopes, extract_names, Scope, - extract_identifiers, + extract_identifiers } from './utils/scope'; import Stylesheet from './css/Stylesheet'; import { test } from '../config'; @@ -29,6 +29,7 @@ import add_to_set from './utils/add_to_set'; import check_graph_for_cycles from './utils/check_graph_for_cycles'; import { print, x, b } from 'code-red'; import { is_reserved_keyword } from './utils/reserved_keywords'; +import Element from './nodes/Element'; interface ComponentOptions { namespace?: string; @@ -85,6 +86,7 @@ export default class Component { file: string; locate: (c: number) => { line: number; column: number }; + elements: Element[] = []; stylesheet: Stylesheet; aliases: Map = new Map(); @@ -155,7 +157,7 @@ export default class Component { ) || { start: 0, end: 0 }; this.warn(svelteOptions, { code: 'custom-element-no-tag', - message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use `, + message: 'No custom element \'tag\' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ' }); } this.tag = this.component_options.tag || compile_options.tag; @@ -171,8 +173,8 @@ export default class Component { this.walk_instance_js_post_template(); + this.elements.forEach(element => this.stylesheet.apply(element)); if (!compile_options.customElement) this.stylesheet.reify(); - this.stylesheet.warn_on_unused_selectors(this); } @@ -190,7 +192,7 @@ export default class Component { this.add_var({ name, injected: true, - referenced: true, + referenced: true }); } else if (name[0] === '$') { this.add_var({ @@ -198,7 +200,7 @@ export default class Component { injected: true, referenced: true, mutated: true, - writable: true, + writable: true }); const subscribable_name = name.slice(1); @@ -221,6 +223,10 @@ export default class Component { return this.aliases.get(name); } + apply_stylesheet(element: Element) { + this.elements.push(element); + } + global(name: string) { const alias = this.alias(name); this.globals.set(name, alias); @@ -235,7 +241,7 @@ export default class Component { const { compile_options, name } = this; const { format = 'esm' } = compile_options; - const banner = `${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'}`; + const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'__VERSION__'}`; const program: any = { type: 'Program', body: result.js }; @@ -289,7 +295,7 @@ export default class Component { } const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({ name, - alias, + alias })); create_module( @@ -305,7 +311,7 @@ export default class Component { .filter(variable => variable.module && variable.export_name) .map(variable => ({ name: variable.name, - as: variable.export_name, + as: variable.export_name })) ); @@ -342,9 +348,9 @@ export default class Component { reassigned: v.reassigned || false, referenced: v.referenced || false, writable: v.writable || false, - referenced_from_script: v.referenced_from_script || false, + referenced_from_script: v.referenced_from_script || false })), - stats: this.stats.render(), + stats: this.stats.render() }; } @@ -409,7 +415,7 @@ export default class Component { source: this.source, start: pos.start, end: pos.end, - filename: this.compile_options.filename, + filename: this.compile_options.filename }); } @@ -441,7 +447,7 @@ export default class Component { pos: pos.start, filename: this.compile_options.filename, toString: () => - `${warning.message} (${start.line}:${start.column})\n${frame}`, + `${warning.message} (${start.line}:${start.column})\n${frame}` }); } @@ -452,16 +458,16 @@ export default class Component { extract_exports(node) { if (node.type === 'ExportDefaultDeclaration') { this.error(node, { - code: `default-export`, - message: `A component cannot have a default export`, + code: 'default-export', + message: 'A component cannot have a default export' }); } if (node.type === 'ExportNamedDeclaration') { if (node.source) { this.error(node, { - code: `not-implemented`, - message: `A component currently cannot have an export ... from`, + code: 'not-implemented', + message: 'A component currently cannot have an export ... from' }); } if (node.declaration) { @@ -472,7 +478,7 @@ export default class Component { variable.export_name = name; if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { this.warn(declarator, { - code: `unused-export-let`, + code: 'unused-export-let', message: `${this.name.name} has unused export property '${name}'. If it is for external reference only, please consider using \`export const ${name}\`` }); } @@ -495,7 +501,7 @@ export default class Component { if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { this.warn(specifier, { - code: `unused-export-let`, + code: 'unused-export-let', message: `${this.name.name} has unused export property '${specifier.exported.name}'. If it is for external reference only, please consider using \`export const ${specifier.exported.name}\`` }); } @@ -515,8 +521,7 @@ export default class Component { if (this.hoistable_nodes.has(node)) return false; if (this.reactive_declaration_nodes.has(node)) return false; if (node.type === 'ImportDeclaration') return false; - if (node.type === 'ExportDeclaration' && node.specifiers.length > 0) - return false; + if (node.type === 'ExportDeclaration' && node.specifiers.length > 0) return false; return true; }); } @@ -531,10 +536,10 @@ export default class Component { if (node.type === 'LabeledStatement' && node.label.name === '$') { component.warn(node as any, { code: 'module-script-reactive-declaration', - message: '$: has no effect in a module script', + message: '$: has no effect in a module script' }); } - }, + } }); const { scope, globals } = create_scopes(script.content); @@ -544,7 +549,7 @@ export default class Component { if (name[0] === '$') { this.error(node as any, { code: 'illegal-declaration', - message: `The $ prefix is reserved, and cannot be used for variable and import names`, + message: 'The $ prefix is reserved, and cannot be used for variable and import names' }); } @@ -562,7 +567,7 @@ export default class Component { if (name[0] === '$') { this.error(node as any, { code: 'illegal-subscription', - message: `Cannot reference store value inside ', true); + parser.eat(``, true); element.end = parser.index; - } else if (name === 'style') { - // special case - const start = parser.index; - const data = parser.read_until(/<\/style>/); - const end = parser.index; - element.children.push({ start, end, type: 'Text', data }); - parser.eat('', true); } else { parser.stack.push(element); } @@ -249,8 +255,8 @@ function read_tag_name(parser: Parser) { if (!legal) { parser.error({ - code: `invalid-self-placement`, - message: ` components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components` + code: 'invalid-self-placement', + message: ' components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components' }, start); } @@ -277,8 +283,8 @@ function read_tag_name(parser: Parser) { if (!valid_tag_name.test(name)) { parser.error({ - code: `invalid-tag-name`, - message: `Expected valid tag name` + code: 'invalid-tag-name', + message: 'Expected valid tag name' }, start); } @@ -291,7 +297,7 @@ function read_attribute(parser: Parser, unique_names: Set) { function check_unique(name: string) { if (unique_names.has(name)) { parser.error({ - code: `duplicate-attribute`, + code: 'duplicate-attribute', message: 'Attributes need to be unique' }, start); } @@ -360,8 +366,8 @@ function read_attribute(parser: Parser, unique_names: Set) { end = parser.index; } else if (parser.match_regex(/["']/)) { parser.error({ - code: `unexpected-token`, - message: `Expected =` + code: 'unexpected-token', + message: 'Expected =' }, parser.index); } @@ -376,7 +382,7 @@ function read_attribute(parser: Parser, unique_names: Set) { if (type === 'Ref') { parser.error({ - code: `invalid-ref-directive`, + code: 'invalid-ref-directive', message: `The ref directive is no longer supported — use \`bind:this={${directive_name}}\` instead` }, start); } @@ -384,8 +390,8 @@ function read_attribute(parser: Parser, unique_names: Set) { if (value[0]) { if ((value as any[]).length > 1 || value[0].type === 'Text') { parser.error({ - code: `invalid-directive-value`, - message: `Directive value must be a JavaScript expression enclosed in curly braces` + code: 'invalid-directive-value', + message: 'Directive value must be a JavaScript expression enclosed in curly braces' }, value[0].start); } } @@ -424,7 +430,7 @@ function read_attribute(parser: Parser, unique_names: Set) { end, type: 'Attribute', name, - value, + value }; } @@ -440,11 +446,11 @@ function get_directive_type(name: string): DirectiveType { } function read_attribute_value(parser: Parser) { - const quote_mark = parser.eat(`'`) ? `'` : parser.eat(`"`) ? `"` : null; + const quote_mark = parser.eat("'") ? "'" : parser.eat('"') ? '"' : null; const regex = ( - quote_mark === `'` ? /'/ : - quote_mark === `"` ? /"/ : + quote_mark === "'" ? /'/ : + quote_mark === '"' ? /"/ : /(\/>|[\s"'=<>`])/ ); @@ -491,7 +497,7 @@ function read_sequence(parser: Parser, done: () => boolean): TemplateNode[] { start: index, end: parser.index, type: 'MustacheTag', - expression, + expression }); current_chunk = { @@ -507,7 +513,7 @@ function read_sequence(parser: Parser, done: () => boolean): TemplateNode[] { } parser.error({ - code: `unexpected-eof`, - message: `Unexpected end of input` + code: 'unexpected-eof', + message: 'Unexpected end of input' }); } diff --git a/src/compiler/parse/state/text.ts b/src/compiler/parse/state/text.ts index 56be592ca9..a2275c9653 100644 --- a/src/compiler/parse/state/text.ts +++ b/src/compiler/parse/state/text.ts @@ -19,7 +19,7 @@ export default function text(parser: Parser) { end: parser.index, type: 'Text', raw: data, - data: decode_character_references(data), + data: decode_character_references(data) }; parser.current().children.push(node); diff --git a/src/compiler/parse/utils/bracket.ts b/src/compiler/parse/utils/bracket.ts index ffbb9e4952..30e522c305 100644 --- a/src/compiler/parse/utils/bracket.ts +++ b/src/compiler/parse/utils/bracket.ts @@ -1,7 +1,7 @@ -const SQUARE_BRACKET_OPEN = "[".charCodeAt(0); -const SQUARE_BRACKET_CLOSE = "]".charCodeAt(0); -const CURLY_BRACKET_OPEN = "{".charCodeAt(0); -const CURLY_BRACKET_CLOSE = "}".charCodeAt(0); +const SQUARE_BRACKET_OPEN = '['.charCodeAt(0); +const SQUARE_BRACKET_CLOSE = ']'.charCodeAt(0); +const CURLY_BRACKET_OPEN = '{'.charCodeAt(0); +const CURLY_BRACKET_CLOSE = '}'.charCodeAt(0); export function is_bracket_open(code) { return code === SQUARE_BRACKET_OPEN || code === CURLY_BRACKET_OPEN; @@ -25,4 +25,4 @@ export function get_bracket_close(open) { if (open === CURLY_BRACKET_OPEN) { return CURLY_BRACKET_CLOSE; } -} \ No newline at end of file +} diff --git a/src/compiler/parse/utils/entities.ts b/src/compiler/parse/utils/entities.ts index 91689c5f30..7b43ced2c1 100644 --- a/src/compiler/parse/utils/entities.ts +++ b/src/compiler/parse/utils/entities.ts @@ -2030,5 +2030,5 @@ export default { sc: 8827, wp: 8472, wr: 8768, - xi: 958, + xi: 958 }; diff --git a/src/compiler/parse/utils/html.ts b/src/compiler/parse/utils/html.ts index 2b8c4213b7..0148361929 100644 --- a/src/compiler/parse/utils/html.ts +++ b/src/compiler/parse/utils/html.ts @@ -32,7 +32,7 @@ const windows_1252 = [ 339, 157, 382, - 376, + 376 ]; const entity_pattern = new RegExp( @@ -124,7 +124,7 @@ const disallowed_contents = new Map([ 'address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul'.split( ' ' ) - ), + ) ], ['rt', new Set(['rt', 'rp'])], ['rp', new Set(['rt', 'rp'])], @@ -135,7 +135,7 @@ const disallowed_contents = new Map([ ['tfoot', new Set(['tbody'])], ['tr', new Set(['tr', 'tbody'])], ['td', new Set(['td', 'th', 'tr'])], - ['th', new Set(['td', 'th', 'tr'])], + ['th', new Set(['td', 'th', 'tr'])] ]); // can this be a child of the parent element, or does it implicitly diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index d90d4814d7..1d7d74ceac 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -26,7 +26,7 @@ function parse_attributes(str: string) { if (p === -1) { attrs[attr] = true; } else { - attrs[attr.slice(0, p)] = `'"`.includes(attr[p + 1]) ? + attrs[attr.slice(0, p)] = '\'"'.includes(attr[p + 1]) ? attr.slice(p + 2, -1) : attr.slice(p + 1); } @@ -49,7 +49,7 @@ async function replace_async(str: string, re: RegExp, func: (...any) => Promise< ({ offset: args[args.length - 2], length: args[0].length, - replacement: res, + replacement: res }) as Replacement ) ); diff --git a/src/compiler/utils/error.ts b/src/compiler/utils/error.ts index e05ea66df1..882ff54ebe 100644 --- a/src/compiler/utils/error.ts +++ b/src/compiler/utils/error.ts @@ -37,4 +37,4 @@ export default function error(message: string, props: { error.frame = get_code_frame(props.source, start.line - 1, start.column); throw error; -} \ No newline at end of file +} diff --git a/src/compiler/utils/full_char_code_at.ts b/src/compiler/utils/full_char_code_at.ts index b5187693eb..0469b537fc 100644 --- a/src/compiler/utils/full_char_code_at.ts +++ b/src/compiler/utils/full_char_code_at.ts @@ -7,4 +7,4 @@ export default function full_char_code_at(str: string, i: number): number { const next = str.charCodeAt(i + 1); return (code << 10) + next - 0x35fdc00; -} \ No newline at end of file +} diff --git a/src/compiler/utils/fuzzymatch.ts b/src/compiler/utils/fuzzymatch.ts index 2efadc3847..8b22a4175d 100644 --- a/src/compiler/utils/fuzzymatch.ts +++ b/src/compiler/utils/fuzzymatch.ts @@ -13,8 +13,9 @@ const GRAM_SIZE_UPPER = 3; // return an edit distance from 0 to 1 function _distance(str1: string, str2: string) { - if (str1 === null && str2 === null) + if (str1 === null && str2 === null) { throw 'Trying to compare two null values'; + } if (str1 === null || str2 === null) return 0; str1 = String(str1); str2 = String(str2); @@ -206,7 +207,7 @@ class FuzzySet { match_score = matches[match_index]; results.push([ match_score / (vector_normal * items[match_index][0]), - items[match_index][1], + items[match_index][1] ]); } @@ -218,7 +219,7 @@ class FuzzySet { for (let i = 0; i < end_index; ++i) { new_results.push([ _distance(results[i][1], normalized_value), - results[i][1], + results[i][1] ]); } results = new_results; diff --git a/src/compiler/utils/names.ts b/src/compiler/utils/names.ts index 02cc12e087..255d56a218 100644 --- a/src/compiler/utils/names.ts +++ b/src/compiler/utils/names.ts @@ -13,11 +13,13 @@ export const globals = new Set([ 'decodeURI', 'decodeURIComponent', 'document', + 'Element', 'encodeURI', 'encodeURIComponent', 'Error', 'EvalError', 'Event', + 'EventSource', 'fetch', 'global', 'globalThis', @@ -35,6 +37,7 @@ export const globals = new Set([ 'NaN', 'navigator', 'Number', + 'Node', 'Object', 'parseFloat', 'parseInt', @@ -105,7 +108,7 @@ export const reserved = new Set([ 'void', 'while', 'with', - 'yield', + 'yield' ]); const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/; diff --git a/src/compiler/utils/namespaces.ts b/src/compiler/utils/namespaces.ts index 3bde3ee308..3db7bc3fae 100644 --- a/src/compiler/utils/namespaces.ts +++ b/src/compiler/utils/namespaces.ts @@ -17,7 +17,7 @@ export const valid_namespaces = [ svg, xlink, xml, - xmlns, + xmlns ]; export const namespaces: Record = { html, mathml, svg, xlink, xml, xmlns }; diff --git a/src/compiler/utils/nodes_match.ts b/src/compiler/utils/nodes_match.ts index 2b6f998c19..ff841d5f02 100644 --- a/src/compiler/utils/nodes_match.ts +++ b/src/compiler/utils/nodes_match.ts @@ -29,4 +29,4 @@ export function nodes_match(a, b) { } return a === b; -} \ No newline at end of file +} diff --git a/src/runtime/internal/await_block.ts b/src/runtime/internal/await_block.ts index f70cbd6c2c..4b7ca6fd21 100644 --- a/src/runtime/internal/await_block.ts +++ b/src/runtime/internal/await_block.ts @@ -62,6 +62,9 @@ export function handle_promise(promise, info) { set_current_component(current_component); update(info.catch, 2, info.error, error); set_current_component(null); + if (!info.hasCatch) { + throw error; + } }); // if we previously had a then/catch block, destroy it diff --git a/src/runtime/internal/dev.ts b/src/runtime/internal/dev.ts index 28daa03ae8..708b393601 100644 --- a/src/runtime/internal/dev.ts +++ b/src/runtime/internal/dev.ts @@ -6,17 +6,17 @@ export function dispatch_dev(type: string, detail?: T) { } export function append_dev(target: Node, node: Node) { - dispatch_dev("SvelteDOMInsert", { target, node }); + dispatch_dev('SvelteDOMInsert', { target, node }); append(target, node); } export function insert_dev(target: Node, node: Node, anchor?: Node) { - dispatch_dev("SvelteDOMInsert", { target, node, anchor }); + dispatch_dev('SvelteDOMInsert', { target, node, anchor }); insert(target, node, anchor); } export function detach_dev(node: Node) { - dispatch_dev("SvelteDOMRemove", { node }); + dispatch_dev('SvelteDOMRemove', { node }); detach(node); } @@ -39,15 +39,15 @@ export function detach_after_dev(before: Node) { } export function listen_dev(node: Node, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | EventListenerOptions, has_prevent_default?: boolean, has_stop_propagation?: boolean) { - const modifiers = options === true ? [ "capture" ] : options ? Array.from(Object.keys(options)) : []; + const modifiers = options === true ? [ 'capture' ] : options ? Array.from(Object.keys(options)) : []; if (has_prevent_default) modifiers.push('preventDefault'); if (has_stop_propagation) modifiers.push('stopPropagation'); - dispatch_dev("SvelteDOMAddEventListener", { node, event, handler, modifiers }); + dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); const dispose = listen(node, event, handler, options); return () => { - dispatch_dev("SvelteDOMRemoveEventListener", { node, event, handler, modifiers }); + dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); dispose(); }; } @@ -55,27 +55,27 @@ export function listen_dev(node: Node, event: string, handler: EventListenerOrEv export function attr_dev(node: Element, attribute: string, value?: string) { attr(node, attribute, value); - if (value == null) dispatch_dev("SvelteDOMRemoveAttribute", { node, attribute }); - else dispatch_dev("SvelteDOMSetAttribute", { node, attribute, value }); + if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); + else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); } export function prop_dev(node: Element, property: string, value?: any) { node[property] = value; - dispatch_dev("SvelteDOMSetProperty", { node, property, value }); + dispatch_dev('SvelteDOMSetProperty', { node, property, value }); } export function dataset_dev(node: HTMLElement, property: string, value?: any) { node.dataset[property] = value; - dispatch_dev("SvelteDOMSetDataset", { node, property, value }); + dispatch_dev('SvelteDOMSetDataset', { node, property, value }); } export function set_data_dev(text, data) { data = '' + data; if (text.wholeText === data) return; - dispatch_dev("SvelteDOMSetData", { node: text, data }); + dispatch_dev('SvelteDOMSetData', { node: text, data }); text.data = data; } @@ -115,7 +115,7 @@ export class SvelteComponentDev extends SvelteComponent { $$inline?: boolean; }) { if (!options || (!options.target && !options.$$inline)) { - throw new Error(`'target' is a required option`); + throw new Error("'target' is a required option"); } super(); @@ -124,7 +124,7 @@ export class SvelteComponentDev extends SvelteComponent { $destroy() { super.$destroy(); this.$destroy = () => { - console.warn(`Component was already destroyed`); // eslint-disable-line no-console + console.warn('Component was already destroyed'); // eslint-disable-line no-console }; } @@ -137,7 +137,7 @@ export function loop_guard(timeout) { const start = Date.now(); return () => { if (Date.now() - start > timeout) { - throw new Error(`Infinite loop detected`); + throw new Error('Infinite loop detected'); } }; } diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 7087336a6b..ad06d6ff08 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -1,4 +1,4 @@ -import { has_prop } from "./utils"; +import { has_prop } from './utils'; export function append(target: Node, node: Node) { target.appendChild(node); @@ -138,7 +138,7 @@ export function get_binding_group_value(group, __value, checked) { } export function to_number(value) { - return value === '' ? undefined : +value; + return value === '' ? null : +value; } export function time_ranges_to_array(ranges) { @@ -269,7 +269,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) { const iframe = element('iframe'); iframe.setAttribute('style', - `display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ` + + 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' + `overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${z_index};` ); iframe.setAttribute('aria-hidden', 'true'); @@ -280,7 +280,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) { let unsubscribe: () => void; if (crossorigin) { - iframe.src = `data:text/html,`; + iframe.src = "data:text/html,"; unsubscribe = listen(window, 'message', (event: MessageEvent) => { if (event.source === iframe.contentWindow) fn(); }); @@ -360,3 +360,11 @@ export class HtmlTag { this.n.forEach(detach); } } + +export function attribute_to_object(attributes) { + const result = {}; + for (const attribute of attributes) { + result[attribute.name] = attribute.value; + } + return result; +} diff --git a/src/runtime/internal/keyed_each.ts b/src/runtime/internal/keyed_each.ts index b397335c87..6e333da1a4 100644 --- a/src/runtime/internal/keyed_each.ts +++ b/src/runtime/internal/keyed_each.ts @@ -113,7 +113,7 @@ export function validate_each_keys(ctx, list, get_context, get_key) { for (let i = 0; i < list.length; i++) { const key = get_key(get_context(ctx, list, i)); if (keys.has(key)) { - throw new Error(`Cannot have duplicate keys in a keyed each`); + throw new Error('Cannot have duplicate keys in a keyed each'); } keys.add(key); } diff --git a/src/runtime/internal/lifecycle.ts b/src/runtime/internal/lifecycle.ts index a8e37e9632..4a7616bdea 100644 --- a/src/runtime/internal/lifecycle.ts +++ b/src/runtime/internal/lifecycle.ts @@ -7,27 +7,29 @@ export function set_current_component(component) { } export function get_current_component() { - if (!current_component) throw new Error(`Function called outside component initialization`); + if (!current_component) throw new Error('Function called outside component initialization'); return current_component; } -export function beforeUpdate(fn) { +export function beforeUpdate(fn: () => any) { get_current_component().$$.before_update.push(fn); } -export function onMount(fn) { +export function onMount(fn: () => any) { get_current_component().$$.on_mount.push(fn); } -export function afterUpdate(fn) { +export function afterUpdate(fn: () => any) { get_current_component().$$.after_update.push(fn); } -export function onDestroy(fn) { +export function onDestroy(fn: () => any) { get_current_component().$$.on_destroy.push(fn); } -export function createEventDispatcher() { +export function createEventDispatcher< + EventMap extends {} = any +>(): >(type: EventKey, detail?: EventMap[EventKey]) => void { const component = get_current_component(); return (type: string, detail?: any) => { @@ -44,11 +46,11 @@ export function createEventDispatcher() { }; } -export function setContext(key, context) { +export function setContext(key, context: T) { get_current_component().$$.context.set(key, context); } -export function getContext(key) { +export function getContext(key): T { return get_current_component().$$.context.get(key); } @@ -61,4 +63,4 @@ export function bubble(component, event) { if (callbacks) { callbacks.slice().forEach(fn => fn(event)); } -} \ No newline at end of file +} diff --git a/src/runtime/internal/scheduler.ts b/src/runtime/internal/scheduler.ts index b0db71035a..568739e4f8 100644 --- a/src/runtime/internal/scheduler.ts +++ b/src/runtime/internal/scheduler.ts @@ -45,6 +45,7 @@ export function flush() { set_current_component(component); update(component.$$); } + set_current_component(null); dirty_components.length = 0; diff --git a/src/runtime/internal/spread.ts b/src/runtime/internal/spread.ts index 203b0b11e9..2acb98fd3f 100644 --- a/src/runtime/internal/spread.ts +++ b/src/runtime/internal/spread.ts @@ -38,4 +38,4 @@ export function get_spread_update(levels, updates) { export function get_spread_object(spread_props) { return typeof spread_props === 'object' && spread_props !== null ? spread_props : {}; -} \ No newline at end of file +} diff --git a/src/runtime/internal/ssr.ts b/src/runtime/internal/ssr.ts index 646a81d817..2d843abb2f 100644 --- a/src/runtime/internal/ssr.ts +++ b/src/runtime/internal/ssr.ts @@ -21,9 +21,9 @@ export function spread(args, classes_to_add) { if (invalid_attribute_name_character.test(name)) return; const value = attributes[name]; - if (value === true) str += " " + name; + if (value === true) str += ' ' + name; else if (boolean_attributes.has(name.toLowerCase())) { - if (value) str += " " + name; + if (value) str += ' ' + name; } else if (value != null) { str += ` ${name}="${String(value).replace(/"/g, '"').replace(/'/g, ''')}"`; } @@ -133,5 +133,5 @@ export function add_attribute(name, value, boolean) { } export function add_classes(classes) { - return classes ? ` class="${classes}"` : ``; -} \ No newline at end of file + return classes ? ` class="${classes}"` : ''; +} diff --git a/src/runtime/internal/style_manager.ts b/src/runtime/internal/style_manager.ts index 31d7573a76..8060e65a5d 100644 --- a/src/runtime/internal/style_manager.ts +++ b/src/runtime/internal/style_manager.ts @@ -40,7 +40,7 @@ export function create_rule(node: Element & ElementCSSInlineStyle, a: number, b: } const animation = node.style.animation || ''; - node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; + node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`; active += 1; return name; diff --git a/src/runtime/internal/transitions.ts b/src/runtime/internal/transitions.ts index ed23d3c1dd..343a8c82e4 100644 --- a/src/runtime/internal/transitions.ts +++ b/src/runtime/internal/transitions.ts @@ -1,5 +1,5 @@ import { identity as linear, is_function, noop, run_all } from './utils'; -import { now } from "./environment"; +import { now } from './environment'; import { loop } from './loop'; import { create_rule, delete_rule } from './style_manager'; import { custom_event } from './dom'; @@ -273,7 +273,7 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline outros.r += 1; } - if (running_program) { + if (running_program || pending_program) { pending_program = program; } else { // if this is an intro, and there's a delay, we need to do diff --git a/src/runtime/internal/utils.ts b/src/runtime/internal/utils.ts index 3fd0a2b701..3b8815cb1d 100644 --- a/src/runtime/internal/utils.ts +++ b/src/runtime/internal/utils.ts @@ -1,3 +1,5 @@ +import { Readable } from 'svelte/store'; + export function noop() {} export const identity = x => x; @@ -60,7 +62,7 @@ export function subscribe(store, ...callbacks) { return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; } -export function get_store_value(store) { +export function get_store_value(store: Readable): T { let value; subscribe(store, _ => value = _)(); return value; @@ -128,6 +130,14 @@ export function compute_rest_props(props, keys) { return rest; } +export function compute_slots(slots) { + const result = {}; + for (const key in slots) { + result[key] = true; + } + return result; +} + export function once(fn) { let ran = false; return function(this: any, ...args) { @@ -150,4 +160,4 @@ export const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, export function action_destroyer(action_result) { return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; -} \ No newline at end of file +} diff --git a/src/runtime/motion/spring.ts b/src/runtime/motion/spring.ts index 5845a13a57..8d2056256c 100644 --- a/src/runtime/motion/spring.ts +++ b/src/runtime/motion/spring.ts @@ -34,9 +34,10 @@ function tick_spring(ctx: TickContext, last_value: T, current_value: T, ta tick_spring(ctx, last_value[i], current_value[i], target_value[i])); } else if (typeof current_value === 'object') { const next_value = {}; - for (const k in current_value) + for (const k in current_value) { // @ts-ignore next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]); + } // @ts-ignore return next_value; } else { @@ -121,8 +122,9 @@ export function spring(value?: T, opts: SpringOpts = {}): Spring { last_value = value; store.set(value = next_value); - if (ctx.settled) + if (ctx.settled) { task = null; + } return !ctx.settled; }); } diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index 2bbfdfcd60..09040487f0 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -52,7 +52,7 @@ const subscriber_queue = []; */ export function readable(value: T, start: StartStopNotifier): Readable { return { - subscribe: writable(value, start).subscribe, + subscribe: writable(value, start).subscribe }; } @@ -184,7 +184,7 @@ export function derived(stores: Stores, fn: Function, initial_value?: T): Rea }, () => { pending |= (1 << i); - }), + }) ); inited = true; @@ -201,4 +201,4 @@ export function derived(stores: Stores, fn: Function, initial_value?: T): Rea * Get the current value from a store by subscribing and immediately unsubscribing. * @param store readable */ -export { get_store_value as get }; \ No newline at end of file +export { get_store_value as get }; diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index f1197c0b17..7e879cb941 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -120,7 +120,7 @@ export function slide(node: Element, { duration, easing, css: t => - `overflow: hidden;` + + 'overflow: hidden;' + `opacity: ${Math.min(t * 20, 1) * opacity};` + `height: ${t * height}px;` + `padding-top: ${t * padding_top}px;` + diff --git a/test/.eslintrc.json b/test/.eslintrc.json index d5ba8f9d9c..fc493fa889 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -1,5 +1,6 @@ { "rules": { - "no-console": "off" + "no-console": "off", + "@typescript-eslint/no-var-requires": "off" } } diff --git a/test/css/index.js b/test/css/index.ts similarity index 97% rename from test/css/index.js rename to test/css/index.ts index 81d27a94bf..65b43322b1 100644 --- a/test/css/index.js +++ b/test/css/index.ts @@ -1,6 +1,5 @@ -import * as assert from 'assert'; import * as fs from 'fs'; -import { env, svelte, setupHtmlEqual, shouldUpdateExpected } from '../helpers.js'; +import { assert, env, svelte, setupHtmlEqual, shouldUpdateExpected } from '../helpers'; function try_require(file) { try { @@ -157,4 +156,4 @@ function read(file) { } catch (err) { return null; } -} \ No newline at end of file +} diff --git a/test/css/samples/attribute-selector-details-open/expected.css b/test/css/samples/attribute-selector-details-open/expected.css new file mode 100644 index 0000000000..20543c5c8e --- /dev/null +++ b/test/css/samples/attribute-selector-details-open/expected.css @@ -0,0 +1 @@ +details[open].svelte-xyz{color:red} \ No newline at end of file diff --git a/test/css/samples/attribute-selector-details-open/input.svelte b/test/css/samples/attribute-selector-details-open/input.svelte new file mode 100644 index 0000000000..f8cb70eff7 --- /dev/null +++ b/test/css/samples/attribute-selector-details-open/input.svelte @@ -0,0 +1,7 @@ +
Hello
+ + diff --git a/test/css/samples/child-combinator/expected.css b/test/css/samples/child-combinator/expected.css new file mode 100644 index 0000000000..5d50ae16d7 --- /dev/null +++ b/test/css/samples/child-combinator/expected.css @@ -0,0 +1 @@ +main.svelte-xyz button.svelte-xyz.svelte-xyz{background-color:red}main.svelte-xyz div.svelte-xyz>button.svelte-xyz{background-color:blue} \ No newline at end of file diff --git a/test/css/samples/child-combinator/input.svelte b/test/css/samples/child-combinator/input.svelte new file mode 100644 index 0000000000..9d5d8d27e0 --- /dev/null +++ b/test/css/samples/child-combinator/input.svelte @@ -0,0 +1,14 @@ + +
+
+ +
+
\ No newline at end of file diff --git a/test/css/samples/empty-class/_config.js b/test/css/samples/empty-class/_config.js index cc766d9478..ef5c5c1cc5 100644 --- a/test/css/samples/empty-class/_config.js +++ b/test/css/samples/empty-class/_config.js @@ -1,8 +1,8 @@ export default { warnings: [{ - filename: "SvelteComponent.svelte", - code: `css-unused-selector`, - message: "Unused CSS selector", + filename: 'SvelteComponent.svelte', + code: 'css-unused-selector', + message: 'Unused CSS selector ".x"', start: { line: 4, column: 1, @@ -22,4 +22,4 @@ export default { 5: color: red; 6: }` }] -}; \ No newline at end of file +}; diff --git a/test/css/samples/empty-rule-dev/_config.js b/test/css/samples/empty-rule-dev/_config.js index bdadb774d1..5b9d5ecf1a 100644 --- a/test/css/samples/empty-rule-dev/_config.js +++ b/test/css/samples/empty-rule-dev/_config.js @@ -2,4 +2,4 @@ export default { compileOptions: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/css/samples/general-siblings-combinator-await-not-exhaustive/_config.js b/test/css/samples/general-siblings-combinator-await-not-exhaustive/_config.js new file mode 100644 index 0000000000..c81f1a9f82 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await-not-exhaustive/_config.js @@ -0,0 +1,3 @@ +export default { + warnings: [] +}; diff --git a/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.css b/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.css new file mode 100644 index 0000000000..54eefc6088 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.h.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.e.svelte-xyz~.f.svelte-xyz~.h.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.html b/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.html new file mode 100644 index 0000000000..de97b02a5e --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await-not-exhaustive/expected.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-await-not-exhaustive/input.svelte b/test/css/samples/general-siblings-combinator-await-not-exhaustive/input.svelte new file mode 100644 index 0000000000..a677077c33 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await-not-exhaustive/input.svelte @@ -0,0 +1,41 @@ + + + + +
+ +{#await promise then value} +
+{:catch error} +
+{/await} + +{#await promise} +
+{:catch error} +
+{/await} + +{#await promise} +
+{:then error} +
+{/await} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-await/_config.js b/test/css/samples/general-siblings-combinator-await/_config.js new file mode 100644 index 0000000000..5892e32972 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await/_config.js @@ -0,0 +1,46 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 13: + 14: /* no match */ + 15: .b ~ .c { color: green; } + ^ + 16: .c ~ .d { color: green; } + 17: .b ~ .d { color: green; }`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 269, + start: { character: 269, column: 1, line: 15 }, + end: { character: 276, column: 8, line: 15 } + }, + { + code: 'css-unused-selector', + frame: ` + 14: /* no match */ + 15: .b ~ .c { color: green; } + 16: .c ~ .d { color: green; } + ^ + 17: .b ~ .d { color: green; } + 18: `, + message: 'Unused CSS selector ".c ~ .d"', + pos: 296, + start: { character: 296, column: 1, line: 16 }, + end: { character: 303, column: 8, line: 16 } + }, + { + code: 'css-unused-selector', + frame: ` + 15: .b ~ .c { color: green; } + 16: .c ~ .d { color: green; } + 17: .b ~ .d { color: green; } + ^ + 18: + 19:`, + message: 'Unused CSS selector ".b ~ .d"', + pos: 323, + start: { character: 323, column: 1, line: 17 }, + end: { character: 330, column: 8, line: 17 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-await/expected.css b/test/css/samples/general-siblings-combinator-await/expected.css new file mode 100644 index 0000000000..94a5494597 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz{color:green}.b.svelte-xyz~.e.svelte-xyz{color:green}.c.svelte-xyz~.e.svelte-xyz{color:green}.d.svelte-xyz~.e.svelte-xyz{color:green}.a.svelte-xyz~.e.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-await/expected.html b/test/css/samples/general-siblings-combinator-await/expected.html new file mode 100644 index 0000000000..3d8ac9f966 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-await/input.svelte b/test/css/samples/general-siblings-combinator-await/input.svelte new file mode 100644 index 0000000000..8aeadab170 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-await/input.svelte @@ -0,0 +1,30 @@ + + + + +
+ +{#await promise} +
+{:then value} +
+{:catch error} +
+{/await} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-2/_config.js b/test/css/samples/general-siblings-combinator-each-2/_config.js new file mode 100644 index 0000000000..c81f1a9f82 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-2/_config.js @@ -0,0 +1,3 @@ +export default { + warnings: [] +}; diff --git a/test/css/samples/general-siblings-combinator-each-2/expected.css b/test/css/samples/general-siblings-combinator-each-2/expected.css new file mode 100644 index 0000000000..d197058b24 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-2/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz{color:green}.c.svelte-xyz~.b.svelte-xyz{color:green}.b.svelte-xyz~.c.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-2/expected.html b/test/css/samples/general-siblings-combinator-each-2/expected.html new file mode 100644 index 0000000000..331a5e4317 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-2/expected.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-2/input.svelte b/test/css/samples/general-siblings-combinator-each-2/input.svelte new file mode 100644 index 0000000000..5bbdbdef66 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-2/input.svelte @@ -0,0 +1,37 @@ + + + + +
+ +{#each array as item} +
+
+{/each} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else-nested/_config.js b/test/css/samples/general-siblings-combinator-each-else-nested/_config.js new file mode 100644 index 0000000000..cd5cb14a66 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else-nested/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 33: + 34: /* no match */ + 35: .e ~ .f { color: green; } + ^ + 36: + 37:`, + message: 'Unused CSS selector ".e ~ .f"', + pos: 812, + start: { character: 812, column: 1, line: 35 }, + end: { character: 819, column: 8, line: 35 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-each-else-nested/expected.css b/test/css/samples/general-siblings-combinator-each-else-nested/expected.css new file mode 100644 index 0000000000..b055f35ecd --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else-nested/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz~.j.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.h.svelte-xyz~.j.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.i.svelte-xyz~.j.svelte-xyz.svelte-xyz{color:green}.m.svelte-xyz~.m.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.m.svelte-xyz~.l.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz~.m.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.k.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.h.svelte-xyz~.h.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz~.i.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz~.j.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.j.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.h.svelte-xyz~.i.svelte-xyz~.j.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else-nested/expected.html b/test/css/samples/general-siblings-combinator-each-else-nested/expected.html new file mode 100644 index 0000000000..67dd05f677 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else-nested/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else-nested/input.svelte b/test/css/samples/general-siblings-combinator-each-else-nested/input.svelte new file mode 100644 index 0000000000..63a1123708 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else-nested/input.svelte @@ -0,0 +1,77 @@ + + + + +
+ +{#each array as a} +
+ {#each array as b} +
+ {:else} +
+ {/each} +{/each} + +{#each array as c} + {#each array as d} +
+ {/each} +{:else} +
+{/each} + +{#each array as x} +
+ {#each array as y} + {#each array as z} +
+ {/each} + {:else} +
+ {/each} +
+{/each} + +
+ +{#each array as item} + {#each array as item} +
+ {:else} +
+ {/each} +{/each} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else/_config.js b/test/css/samples/general-siblings-combinator-each-else/_config.js new file mode 100644 index 0000000000..410a4d0ac7 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 11: + 12: /* no match */ + 13: .b ~ .c { color: green; } + ^ + 14: + 15:`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 199, + start: { character: 199, column: 1, line: 13 }, + end: { character: 206, column: 8, line: 13 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-each-else/expected.css b/test/css/samples/general-siblings-combinator-each-else/expected.css new file mode 100644 index 0000000000..31fafa3243 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else/expected.html b/test/css/samples/general-siblings-combinator-each-else/expected.html new file mode 100644 index 0000000000..fb838a55fd --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-else/input.svelte b/test/css/samples/general-siblings-combinator-each-else/input.svelte new file mode 100644 index 0000000000..5cd78853ca --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-else/input.svelte @@ -0,0 +1,24 @@ + + + + +
+ +{#each array as item} +
+{:else} +
+{/each} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-nested/_config.js b/test/css/samples/general-siblings-combinator-each-nested/_config.js new file mode 100644 index 0000000000..c81f1a9f82 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-nested/_config.js @@ -0,0 +1,3 @@ +export default { + warnings: [] +}; diff --git a/test/css/samples/general-siblings-combinator-each-nested/expected.css b/test/css/samples/general-siblings-combinator-each-nested/expected.css new file mode 100644 index 0000000000..5bf1f832ae --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-nested/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.d.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.e.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.e.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz~.m.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz~.n.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz~.o.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz~.m.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz~.n.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz~.o.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz~.m.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz~.n.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz~.o.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.e.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz~.d.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz~.e.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.h.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.d.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz~.e.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.h.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz~.i.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz~.e.svelte-xyz~.f.svelte-xyz{color:green}.e.svelte-xyz~.e.svelte-xyz~.d.svelte-xyz{color:green}.h.svelte-xyz~.h.svelte-xyz~.i.svelte-xyz{color:green}.h.svelte-xyz~.h.svelte-xyz~.g.svelte-xyz{color:green}.a.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.i.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.h.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.i.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.f.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz~.g.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz~.i.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-nested/expected.html b/test/css/samples/general-siblings-combinator-each-nested/expected.html new file mode 100644 index 0000000000..340d6fc4c8 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-nested/expected.html @@ -0,0 +1,15 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each-nested/input.svelte b/test/css/samples/general-siblings-combinator-each-nested/input.svelte new file mode 100644 index 0000000000..b7c7377015 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each-nested/input.svelte @@ -0,0 +1,113 @@ + + + + +
+ +{#each array as item} +
+
+{/each} + +{#each array as item} + {#each array as item} + {#each array as item} +
+ {/each} +
+ {/each} +
+{/each} + +{#each array as item} +
+ {#each array as item} +
+ {#each array as item} +
+ {/each} + {/each} +{/each} + +{#each array as item} +
+ {#each array as item} +
+ {#each array as item} +
+ {/each} + {/each} +{/each} + +{#each array as item} + {#each array as item} + {#each array as item} +
+ {/each} +
+ {/each} +
+{/each} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each/expected.css b/test/css/samples/general-siblings-combinator-each/expected.css new file mode 100644 index 0000000000..8c48251bdd --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each/expected.css @@ -0,0 +1 @@ +div.svelte-xyz~span.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-each/expected.html b/test/css/samples/general-siblings-combinator-each/expected.html new file mode 100644 index 0000000000..9d0416f01b --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each/expected.html @@ -0,0 +1,6 @@ +
+ +
+ +
+ diff --git a/test/css/samples/general-siblings-combinator-each/input.svelte b/test/css/samples/general-siblings-combinator-each/input.svelte new file mode 100644 index 0000000000..ce65da109d --- /dev/null +++ b/test/css/samples/general-siblings-combinator-each/input.svelte @@ -0,0 +1,20 @@ + + + + +
+ +{#each array as item} + +
+ +
+{/each} + + \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/_config.js b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/_config.js new file mode 100644 index 0000000000..a4c915f421 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 16: + 17: /* no match */ + 18: .b ~ .c { color: green; } + ^ + 19: + 20:`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 319, + start: { character: 319, column: 1, line: 18 }, + end: { character: 326, column: 8, line: 18 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.css b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.css new file mode 100644 index 0000000000..e6a974efca --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz~.c.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz~.c.svelte-xyz~.d.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz~.c.svelte-xyz~.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.html b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.html new file mode 100644 index 0000000000..fb838a55fd --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/input.svelte b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/input.svelte new file mode 100644 index 0000000000..2b53f7b5b8 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive-with-each/input.svelte @@ -0,0 +1,31 @@ + + + + +
+ +{#if foo} +
+{:else} + {#each array as item} +
+ {/each} +{/if} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive/_config.js b/test/css/samples/general-siblings-combinator-if-not-exhaustive/_config.js new file mode 100644 index 0000000000..2f3067b262 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 12: + 13: /* no match */ + 14: .b ~ .c { color: green; } + ^ + 15: + 16:`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 215, + start: { character: 215, column: 1, line: 14 }, + end: { character: 222, column: 8, line: 14 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.css b/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.css new file mode 100644 index 0000000000..dc7ee1b62b --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz{color:green}.b.svelte-xyz~.d.svelte-xyz{color:green}.c.svelte-xyz~.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.html b/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.html new file mode 100644 index 0000000000..813e778dc6 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if-not-exhaustive/input.svelte b/test/css/samples/general-siblings-combinator-if-not-exhaustive/input.svelte new file mode 100644 index 0000000000..3e5c5af7a2 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if-not-exhaustive/input.svelte @@ -0,0 +1,25 @@ + + + + +
+ +{#if foo} +
+{:else if bar} +
+{/if} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if/_config.js b/test/css/samples/general-siblings-combinator-if/_config.js new file mode 100644 index 0000000000..c2eb0503cd --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if/_config.js @@ -0,0 +1,46 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 14: + 15: /* no match */ + 16: .b ~ .c { color: green; } + ^ + 17: .b ~ .d { color: green; } + 18: .c ~ .d { color: green; }`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 269, + start: { character: 269, column: 1, line: 16 }, + end: { character: 276, column: 8, line: 16 } + }, + { + code: 'css-unused-selector', + frame: ` + 15: /* no match */ + 16: .b ~ .c { color: green; } + 17: .b ~ .d { color: green; } + ^ + 18: .c ~ .d { color: green; } + 19: `, + message: 'Unused CSS selector ".b ~ .d"', + pos: 296, + start: { character: 296, column: 1, line: 17 }, + end: { character: 303, column: 8, line: 17 } + }, + { + code: 'css-unused-selector', + frame: ` + 16: .b ~ .c { color: green; } + 17: .b ~ .d { color: green; } + 18: .c ~ .d { color: green; } + ^ + 19: + 20:`, + message: 'Unused CSS selector ".c ~ .d"', + pos: 323, + start: { character: 323, column: 1, line: 18 }, + end: { character: 330, column: 8, line: 18 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-if/expected.css b/test/css/samples/general-siblings-combinator-if/expected.css new file mode 100644 index 0000000000..94a5494597 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz~.b.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz{color:green}.a.svelte-xyz~.d.svelte-xyz{color:green}.b.svelte-xyz~.e.svelte-xyz{color:green}.c.svelte-xyz~.e.svelte-xyz{color:green}.d.svelte-xyz~.e.svelte-xyz{color:green}.a.svelte-xyz~.e.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if/expected.html b/test/css/samples/general-siblings-combinator-if/expected.html new file mode 100644 index 0000000000..3d8ac9f966 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-if/input.svelte b/test/css/samples/general-siblings-combinator-if/input.svelte new file mode 100644 index 0000000000..fca5499f2e --- /dev/null +++ b/test/css/samples/general-siblings-combinator-if/input.svelte @@ -0,0 +1,31 @@ + + + + +
+ +{#if foo} +
+{:else if bar} +
+{:else} +
+{/if} + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-slot/_config.js b/test/css/samples/general-siblings-combinator-slot/_config.js new file mode 100644 index 0000000000..5d8747d4f1 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-slot/_config.js @@ -0,0 +1,88 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 8: + 9: /* no match */ + 10: .a ~ .b { color: green; } + ^ + 11: .b ~ .c { color: green; } + 12: .c ~ .f { color: green; }`, + message: 'Unused CSS selector ".a ~ .b"', + pos: 111, + start: { character: 111, column: 1, line: 10 }, + end: { character: 118, column: 8, line: 10 } + }, + { + code: 'css-unused-selector', + frame: ` + 9: /* no match */ + 10: .a ~ .b { color: green; } + 11: .b ~ .c { color: green; } + ^ + 12: .c ~ .f { color: green; } + 13: .f ~ .g { color: green; }`, + message: 'Unused CSS selector ".b ~ .c"', + pos: 138, + start: { character: 138, column: 1, line: 11 }, + end: { character: 145, column: 8, line: 11 } + }, + { + code: 'css-unused-selector', + frame: ` + 10: .a ~ .b { color: green; } + 11: .b ~ .c { color: green; } + 12: .c ~ .f { color: green; } + ^ + 13: .f ~ .g { color: green; } + 14: .b ~ .f { color: green; }`, + message: 'Unused CSS selector ".c ~ .f"', + pos: 165, + start: { character: 165, column: 1, line: 12 }, + end: { character: 172, column: 8, line: 12 } + }, + { + code: 'css-unused-selector', + frame: ` + 11: .b ~ .c { color: green; } + 12: .c ~ .f { color: green; } + 13: .f ~ .g { color: green; } + ^ + 14: .b ~ .f { color: green; } + 15: .b ~ .g { color: green; }`, + message: 'Unused CSS selector ".f ~ .g"', + pos: 192, + start: { character: 192, column: 1, line: 13 }, + end: { character: 199, column: 8, line: 13 } + }, + { + code: 'css-unused-selector', + frame: ` + 12: .c ~ .f { color: green; } + 13: .f ~ .g { color: green; } + 14: .b ~ .f { color: green; } + ^ + 15: .b ~ .g { color: green; } + 16: `, + message: 'Unused CSS selector ".b ~ .f"', + pos: 219, + start: { character: 219, column: 1, line: 14 }, + end: { character: 226, column: 8, line: 14 } + }, + { + code: 'css-unused-selector', + frame: ` + 13: .f ~ .g { color: green; } + 14: .b ~ .f { color: green; } + 15: .b ~ .g { color: green; } + ^ + 16: + 17:`, + message: 'Unused CSS selector ".b ~ .g"', + pos: 246, + start: { character: 246, column: 1, line: 15 }, + end: { character: 253, column: 8, line: 15 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-slot/expected.css b/test/css/samples/general-siblings-combinator-slot/expected.css new file mode 100644 index 0000000000..29325e0cef --- /dev/null +++ b/test/css/samples/general-siblings-combinator-slot/expected.css @@ -0,0 +1 @@ +.d.svelte-xyz~.e.svelte-xyz{color:green}.a.svelte-xyz~.g.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-slot/input.svelte b/test/css/samples/general-siblings-combinator-slot/input.svelte new file mode 100644 index 0000000000..e5af4c0962 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-slot/input.svelte @@ -0,0 +1,30 @@ + + + + +
+ +
+ +
+
+
+
+ +
+ + +
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-star/_config.js b/test/css/samples/general-siblings-combinator-star/_config.js new file mode 100644 index 0000000000..0079310544 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-star/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 3: margin-left: 4px; + 4: } + 5: .not-match > * ~ * { + ^ + 6: margin-left: 4px; + 7: }`, + message: 'Unused CSS selector ".not-match > * ~ *"', + pos: 50, + start: { character: 50, column: 1, line: 5 }, + end: { character: 68, column: 19, line: 5 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator-star/expected.css b/test/css/samples/general-siblings-combinator-star/expected.css new file mode 100644 index 0000000000..de947fa47e --- /dev/null +++ b/test/css/samples/general-siblings-combinator-star/expected.css @@ -0,0 +1 @@ +.match.svelte-xyz>.svelte-xyz~.svelte-xyz{margin-left:4px} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-star/expected.html b/test/css/samples/general-siblings-combinator-star/expected.html new file mode 100644 index 0000000000..1cfae6e6f7 --- /dev/null +++ b/test/css/samples/general-siblings-combinator-star/expected.html @@ -0,0 +1,7 @@ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator-star/input.svelte b/test/css/samples/general-siblings-combinator-star/input.svelte new file mode 100644 index 0000000000..a069685d4f --- /dev/null +++ b/test/css/samples/general-siblings-combinator-star/input.svelte @@ -0,0 +1,17 @@ + + +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator/_config.js b/test/css/samples/general-siblings-combinator/_config.js new file mode 100644 index 0000000000..662c01ae6c --- /dev/null +++ b/test/css/samples/general-siblings-combinator/_config.js @@ -0,0 +1,60 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 10: + 11: /* no match */ + 12: article ~ div { color: green; } + ^ + 13: span ~ article { color: green; } + 14: b ~ article { color: green; }`, + message: 'Unused CSS selector "article ~ div"', + pos: 275, + start: { character: 275, column: 1, line: 12 }, + end: { character: 288, column: 14, line: 12 } + }, + { + code: 'css-unused-selector', + frame: ` + 11: /* no match */ + 12: article ~ div { color: green; } + 13: span ~ article { color: green; } + ^ + 14: b ~ article { color: green; } + 15: span ~ div { color: green; }`, + message: 'Unused CSS selector "span ~ article"', + pos: 308, + start: { character: 308, column: 1, line: 13 }, + end: { character: 322, column: 15, line: 13 } + }, + { + code: 'css-unused-selector', + frame: ` + 12: article ~ div { color: green; } + 13: span ~ article { color: green; } + 14: b ~ article { color: green; } + ^ + 15: span ~ div { color: green; } + 16: `, + message: 'Unused CSS selector "b ~ article"', + pos: 342, + start: { character: 342, column: 1, line: 14 }, + end: { character: 353, column: 12, line: 14 } + }, + { + code: 'css-unused-selector', + frame: ` + 13: span ~ article { color: green; } + 14: b ~ article { color: green; } + 15: span ~ div { color: green; } + ^ + 16: + 17:`, + message: 'Unused CSS selector "span ~ div"', + pos: 373, + start: { character: 373, column: 1, line: 15 }, + end: { character: 383, column: 11, line: 15 } + } + ] +}; diff --git a/test/css/samples/general-siblings-combinator/expected.css b/test/css/samples/general-siblings-combinator/expected.css new file mode 100644 index 0000000000..647a53f778 --- /dev/null +++ b/test/css/samples/general-siblings-combinator/expected.css @@ -0,0 +1 @@ +div.svelte-xyz~article.svelte-xyz.svelte-xyz{color:green}span.svelte-xyz~b.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz span.svelte-xyz~b.svelte-xyz{color:green}.a.svelte-xyz~article.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz~.b.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~.c.svelte-xyz.svelte-xyz{color:green}article.svelte-xyz~details.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz~details.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator/expected.html b/test/css/samples/general-siblings-combinator/expected.html new file mode 100644 index 0000000000..01fbffcae4 --- /dev/null +++ b/test/css/samples/general-siblings-combinator/expected.html @@ -0,0 +1,7 @@ +
+ + +
+
+

+
\ No newline at end of file diff --git a/test/css/samples/general-siblings-combinator/input.svelte b/test/css/samples/general-siblings-combinator/input.svelte new file mode 100644 index 0000000000..533702a3a3 --- /dev/null +++ b/test/css/samples/general-siblings-combinator/input.svelte @@ -0,0 +1,24 @@ + + +
+ + +
+
+

+
\ No newline at end of file diff --git a/test/css/samples/global-with-unused-descendant/_config.js b/test/css/samples/global-with-unused-descendant/_config.js index 3ed2dd2728..69a69ad650 100644 --- a/test/css/samples/global-with-unused-descendant/_config.js +++ b/test/css/samples/global-with-unused-descendant/_config.js @@ -13,7 +13,7 @@ export default { 3: color: red; 4: } `, - message: 'Unused CSS selector', + message: 'Unused CSS selector ":global(.foo) .bar"', pos: 9, start: { character: 9, diff --git a/test/css/samples/nested/_config.js b/test/css/samples/nested/_config.js index e90f873ac1..5678e73bed 100644 --- a/test/css/samples/nested/_config.js +++ b/test/css/samples/nested/_config.js @@ -2,4 +2,4 @@ export default { props: { dynamic: 'x' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/_config.js b/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/_config.js index 2e954ca8e9..f0dad3b273 100644 --- a/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/_config.js +++ b/test/css/samples/omit-scoping-attribute-attribute-selector-equals-dynamic/_config.js @@ -2,4 +2,4 @@ export default { props: { dynamic: 'whatever' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-attribute-selector/expected.html b/test/css/samples/omit-scoping-attribute-attribute-selector/expected.html index 52175f98b6..f585d6bcdd 100644 --- a/test/css/samples/omit-scoping-attribute-attribute-selector/expected.html +++ b/test/css/samples/omit-scoping-attribute-attribute-selector/expected.html @@ -1,2 +1,2 @@ -
-
\ No newline at end of file +
+
diff --git a/test/css/samples/omit-scoping-attribute-attribute-selector/input.svelte b/test/css/samples/omit-scoping-attribute-attribute-selector/input.svelte index 6f4549ead8..af06836d29 100644 --- a/test/css/samples/omit-scoping-attribute-attribute-selector/input.svelte +++ b/test/css/samples/omit-scoping-attribute-attribute-selector/input.svelte @@ -1,10 +1,10 @@
- - + +
\ No newline at end of file + diff --git a/test/css/samples/omit-scoping-attribute-descendant-global-inner-class/_config.js b/test/css/samples/omit-scoping-attribute-descendant-global-inner-class/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-descendant-global-inner-class/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant-global-inner-class/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-descendant-global-inner-multiple/_config.js b/test/css/samples/omit-scoping-attribute-descendant-global-inner-multiple/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-descendant-global-inner-multiple/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant-global-inner-multiple/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-descendant-global-inner/_config.js b/test/css/samples/omit-scoping-attribute-descendant-global-inner/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-descendant-global-inner/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant-global-inner/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-descendant-global-outer-multiple/_config.js b/test/css/samples/omit-scoping-attribute-descendant-global-outer-multiple/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-descendant-global-outer-multiple/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant-global-outer-multiple/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-descendant-global-outer/_config.js b/test/css/samples/omit-scoping-attribute-descendant-global-outer/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-descendant-global-outer/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant-global-outer/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-descendant/_config.js b/test/css/samples/omit-scoping-attribute-descendant/_config.js index a4aaec7c19..4b70a48802 100644 --- a/test/css/samples/omit-scoping-attribute-descendant/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant/_config.js @@ -1,7 +1,7 @@ export default { warnings: [{ - code: `css-unused-selector`, - message: 'Unused CSS selector', + code: 'css-unused-selector', + message: 'Unused CSS selector "div > p"', start: { line: 8, column: 1, @@ -21,4 +21,4 @@ export default { 9: color: red; 10: }` }] -}; \ No newline at end of file +}; diff --git a/test/css/samples/omit-scoping-attribute-global/_config.js b/test/css/samples/omit-scoping-attribute-global/_config.js index 1ae834ca0d..50317168a6 100644 --- a/test/css/samples/omit-scoping-attribute-global/_config.js +++ b/test/css/samples/omit-scoping-attribute-global/_config.js @@ -2,4 +2,4 @@ export default { props: { raw: '

raw

' } -}; \ No newline at end of file +}; diff --git a/test/css/samples/siblings-combinator-await-not-exhaustive/_config.js b/test/css/samples/siblings-combinator-await-not-exhaustive/_config.js new file mode 100644 index 0000000000..c81f1a9f82 --- /dev/null +++ b/test/css/samples/siblings-combinator-await-not-exhaustive/_config.js @@ -0,0 +1,3 @@ +export default { + warnings: [] +}; diff --git a/test/css/samples/siblings-combinator-await-not-exhaustive/expected.css b/test/css/samples/siblings-combinator-await-not-exhaustive/expected.css new file mode 100644 index 0000000000..60bb8e92dc --- /dev/null +++ b/test/css/samples/siblings-combinator-await-not-exhaustive/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.e.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.f.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.h.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz+.e.svelte-xyz+.f.svelte-xyz+.h.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz+.h.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.g.svelte-xyz.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-await-not-exhaustive/expected.html b/test/css/samples/siblings-combinator-await-not-exhaustive/expected.html new file mode 100644 index 0000000000..de97b02a5e --- /dev/null +++ b/test/css/samples/siblings-combinator-await-not-exhaustive/expected.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-await-not-exhaustive/input.svelte b/test/css/samples/siblings-combinator-await-not-exhaustive/input.svelte new file mode 100644 index 0000000000..d3345c6edc --- /dev/null +++ b/test/css/samples/siblings-combinator-await-not-exhaustive/input.svelte @@ -0,0 +1,41 @@ + + + + +
+ +{#await promise then value} +
+{:catch error} +
+{/await} + +{#await promise} +
+{:catch error} +
+{/await} + +{#await promise} +
+{:then error} +
+{/await} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-await/_config.js b/test/css/samples/siblings-combinator-await/_config.js new file mode 100644 index 0000000000..b51eb7a83e --- /dev/null +++ b/test/css/samples/siblings-combinator-await/_config.js @@ -0,0 +1,60 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 12: + 13: /* no match */ + 14: .a + .e { color: green; } + ^ + 15: .b + .c { color: green; } + 16: .c + .d { color: green; }`, + message: 'Unused CSS selector ".a + .e"', + pos: 242, + start: { character: 242, column: 1, line: 14 }, + end: { character: 249, column: 8, line: 14 } + }, + { + code: 'css-unused-selector', + frame: ` + 13: /* no match */ + 14: .a + .e { color: green; } + 15: .b + .c { color: green; } + ^ + 16: .c + .d { color: green; } + 17: .b + .d { color: green; }`, + message: 'Unused CSS selector ".b + .c"', + pos: 269, + start: { character: 269, column: 1, line: 15 }, + end: { character: 276, column: 8, line: 15 } + }, + { + code: 'css-unused-selector', + frame: ` + 14: .a + .e { color: green; } + 15: .b + .c { color: green; } + 16: .c + .d { color: green; } + ^ + 17: .b + .d { color: green; } + 18: `, + message: 'Unused CSS selector ".c + .d"', + pos: 296, + start: { character: 296, column: 1, line: 16 }, + end: { character: 303, column: 8, line: 16 } + }, + { + code: 'css-unused-selector', + frame: ` + 15: .b + .c { color: green; } + 16: .c + .d { color: green; } + 17: .b + .d { color: green; } + ^ + 18: + 19:`, + message: 'Unused CSS selector ".b + .d"', + pos: 323, + start: { character: 323, column: 1, line: 17 }, + end: { character: 330, column: 8, line: 17 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-await/expected.css b/test/css/samples/siblings-combinator-await/expected.css new file mode 100644 index 0000000000..5ea39be7c2 --- /dev/null +++ b/test/css/samples/siblings-combinator-await/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz{color:green}.b.svelte-xyz+.e.svelte-xyz{color:green}.c.svelte-xyz+.e.svelte-xyz{color:green}.d.svelte-xyz+.e.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-await/expected.html b/test/css/samples/siblings-combinator-await/expected.html new file mode 100644 index 0000000000..3d8ac9f966 --- /dev/null +++ b/test/css/samples/siblings-combinator-await/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-await/input.svelte b/test/css/samples/siblings-combinator-await/input.svelte new file mode 100644 index 0000000000..07698c2a30 --- /dev/null +++ b/test/css/samples/siblings-combinator-await/input.svelte @@ -0,0 +1,30 @@ + + + + +
+ +{#await promise} +
+{:then value} +
+{:catch error} +
+{/await} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-2/_config.js b/test/css/samples/siblings-combinator-each-2/_config.js new file mode 100644 index 0000000000..644fe6a0ee --- /dev/null +++ b/test/css/samples/siblings-combinator-each-2/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 24: } + 25: /* not match */ + 26: .a + .c { + ^ + 27: color: green; + 28: }`, + message: 'Unused CSS selector ".a + .c"', + pos: 320, + start: { character: 320, column: 1, line: 26 }, + end: { character: 327, column: 8, line: 26 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-each-2/expected.css b/test/css/samples/siblings-combinator-each-2/expected.css new file mode 100644 index 0000000000..60fa224269 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-2/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz{color:green}.c.svelte-xyz+.b.svelte-xyz{color:green}.b.svelte-xyz+.c.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-2/expected.html b/test/css/samples/siblings-combinator-each-2/expected.html new file mode 100644 index 0000000000..331a5e4317 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-2/expected.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-2/input.svelte b/test/css/samples/siblings-combinator-each-2/input.svelte new file mode 100644 index 0000000000..bbad045fbc --- /dev/null +++ b/test/css/samples/siblings-combinator-each-2/input.svelte @@ -0,0 +1,38 @@ + + + + +
+ +{#each array as item} +
+
+{/each} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else-nested/_config.js b/test/css/samples/siblings-combinator-each-else-nested/_config.js new file mode 100644 index 0000000000..be47c1f049 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else-nested/_config.js @@ -0,0 +1,144 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 21: + 22: /* no match */ + 23: .a + .c { color: green; } + ^ + 24: .a + .g { color: green; } + 25: .b + .e { color: green; }`, + message: 'Unused CSS selector ".a + .c"', + pos: 479, + start: { character: 479, column: 1, line: 23 }, + end: { character: 486, column: 8, line: 23 } + }, + { + code: 'css-unused-selector', + frame: ` + 22: /* no match */ + 23: .a + .c { color: green; } + 24: .a + .g { color: green; } + ^ + 25: .b + .e { color: green; } + 26: .c + .g { color: green; }`, + message: 'Unused CSS selector ".a + .g"', + pos: 506, + start: { character: 506, column: 1, line: 24 }, + end: { character: 513, column: 8, line: 24 } + }, + { + code: 'css-unused-selector', + frame: ` + 23: .a + .c { color: green; } + 24: .a + .g { color: green; } + 25: .b + .e { color: green; } + ^ + 26: .c + .g { color: green; } + 27: .c + .k { color: green; }`, + message: 'Unused CSS selector ".b + .e"', + pos: 533, + start: { character: 533, column: 1, line: 25 }, + end: { character: 540, column: 8, line: 25 } + }, + { + code: 'css-unused-selector', + frame: ` + 24: .a + .g { color: green; } + 25: .b + .e { color: green; } + 26: .c + .g { color: green; } + ^ + 27: .c + .k { color: green; } + 28: .d + .d { color: green; }`, + message: 'Unused CSS selector ".c + .g"', + pos: 560, + start: { character: 560, column: 1, line: 26 }, + end: { character: 567, column: 8, line: 26 } + }, + { + code: 'css-unused-selector', + frame: ` + 25: .b + .e { color: green; } + 26: .c + .g { color: green; } + 27: .c + .k { color: green; } + ^ + 28: .d + .d { color: green; } + 29: .e + .f { color: green; }`, + message: 'Unused CSS selector ".c + .k"', + pos: 587, + start: { character: 587, column: 1, line: 27 }, + end: { character: 594, column: 8, line: 27 } + }, + { + code: 'css-unused-selector', + frame: ` + 26: .c + .g { color: green; } + 27: .c + .k { color: green; } + 28: .d + .d { color: green; } + ^ + 29: .e + .f { color: green; } + 30: .f + .f { color: green; }`, + message: 'Unused CSS selector ".d + .d"', + pos: 614, + start: { character: 614, column: 1, line: 28 }, + end: { character: 621, column: 8, line: 28 } + }, + { + code: 'css-unused-selector', + frame: ` + 27: .c + .k { color: green; } + 28: .d + .d { color: green; } + 29: .e + .f { color: green; } + ^ + 30: .f + .f { color: green; } + 31: .g + .j { color: green; }`, + message: 'Unused CSS selector ".e + .f"', + pos: 641, + start: { character: 641, column: 1, line: 29 }, + end: { character: 648, column: 8, line: 29 } + }, + { + code: 'css-unused-selector', + frame: ` + 28: .d + .d { color: green; } + 29: .e + .f { color: green; } + 30: .f + .f { color: green; } + ^ + 31: .g + .j { color: green; } + 32: .g + .h + .i + .j { color: green; }`, + message: 'Unused CSS selector ".f + .f"', + pos: 668, + start: { character: 668, column: 1, line: 30 }, + end: { character: 675, column: 8, line: 30 } + }, + { + code: 'css-unused-selector', + frame: ` + 29: .e + .f { color: green; } + 30: .f + .f { color: green; } + 31: .g + .j { color: green; } + ^ + 32: .g + .h + .i + .j { color: green; } + 33: `, + message: 'Unused CSS selector ".g + .j"', + pos: 695, + start: { character: 695, column: 1, line: 31 }, + end: { character: 702, column: 8, line: 31 } + }, + { + code: 'css-unused-selector', + frame: ` + 30: .f + .f { color: green; } + 31: .g + .j { color: green; } + 32: .g + .h + .i + .j { color: green; } + ^ + 33: + 34:`, + message: 'Unused CSS selector ".g + .h + .i + .j"', + pos: 722, + start: { character: 722, column: 1, line: 32 }, + end: { character: 739, column: 18, line: 32 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-each-else-nested/expected.css b/test/css/samples/siblings-combinator-each-else-nested/expected.css new file mode 100644 index 0000000000..aa4e04081d --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else-nested/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz+.c.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz+.j.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz+.h.svelte-xyz+.j.svelte-xyz{color:green}.g.svelte-xyz+.i.svelte-xyz+.j.svelte-xyz{color:green}.m.svelte-xyz+.m.svelte-xyz.svelte-xyz{color:green}.m.svelte-xyz+.l.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz+.m.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else-nested/expected.html b/test/css/samples/siblings-combinator-each-else-nested/expected.html new file mode 100644 index 0000000000..5f25a2d38a --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else-nested/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else-nested/input.svelte b/test/css/samples/siblings-combinator-each-else-nested/input.svelte new file mode 100644 index 0000000000..bee9c6b1dc --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else-nested/input.svelte @@ -0,0 +1,74 @@ + + + + +
+ +{#each array as a} +
+ {#each array as b} +
+ {:else} +
+ {/each} +{/each} + +{#each array as c} + {#each array as d} +
+ {/each} +{:else} +
+{/each} + +{#each array as item} +
+ {#each array as item} + {#each array as item} +
+ {/each} + {:else} +
+ {/each} +
+{/each} + +
+ +{#each array as item} + {#each array as item} +
+ {:else} +
+ {/each} +{/each} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else/_config.js b/test/css/samples/siblings-combinator-each-else/_config.js new file mode 100644 index 0000000000..89cbd9ef1a --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else/_config.js @@ -0,0 +1,32 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 10: + 11: /* no match */ + 12: .a + .d { color: green; } + ^ + 13: .b + .c { color: green; } + 14: `, + message: 'Unused CSS selector ".a + .d"', + pos: 172, + start: { character: 172, column: 1, line: 12 }, + end: { character: 179, column: 8, line: 12 } + }, + { + code: 'css-unused-selector', + frame: ` + 11: /* no match */ + 12: .a + .d { color: green; } + 13: .b + .c { color: green; } + ^ + 14: + 15:`, + message: 'Unused CSS selector ".b + .c"', + pos: 199, + start: { character: 199, column: 1, line: 13 }, + end: { character: 206, column: 8, line: 13 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-each-else/expected.css b/test/css/samples/siblings-combinator-each-else/expected.css new file mode 100644 index 0000000000..f82bca8215 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else/expected.html b/test/css/samples/siblings-combinator-each-else/expected.html new file mode 100644 index 0000000000..fb838a55fd --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-else/input.svelte b/test/css/samples/siblings-combinator-each-else/input.svelte new file mode 100644 index 0000000000..ecd48968c2 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-else/input.svelte @@ -0,0 +1,24 @@ + + + + +
+ +{#each array as item} +
+{:else} +
+{/each} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-nested/_config.js b/test/css/samples/siblings-combinator-each-nested/_config.js new file mode 100644 index 0000000000..6d58e6a4ec --- /dev/null +++ b/test/css/samples/siblings-combinator-each-nested/_config.js @@ -0,0 +1,116 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 56: + 57: /* no match */ + 58: .a + .h { color: green; } + ^ + 59: .a + .i { color: green; } + 60: .c + .h { color: green; }`, + message: 'Unused CSS selector ".a + .h"', + pos: 1229, + start: { character: 1229, column: 1, line: 58 }, + end: { character: 1236, column: 8, line: 58 } + }, + { + code: 'css-unused-selector', + frame: ` + 57: /* no match */ + 58: .a + .h { color: green; } + 59: .a + .i { color: green; } + ^ + 60: .c + .h { color: green; } + 61: .c + .i { color: green; }`, + message: 'Unused CSS selector ".a + .i"', + pos: 1256, + start: { character: 1256, column: 1, line: 59 }, + end: { character: 1263, column: 8, line: 59 } + }, + { + code: 'css-unused-selector', + frame: ` + 58: .a + .h { color: green; } + 59: .a + .i { color: green; } + 60: .c + .h { color: green; } + ^ + 61: .c + .i { color: green; } + 62: .d + .f { color: green; }`, + message: 'Unused CSS selector ".c + .h"', + pos: 1283, + start: { character: 1283, column: 1, line: 60 }, + end: { character: 1290, column: 8, line: 60 } + }, + { + code: 'css-unused-selector', + frame: ` + 59: .a + .i { color: green; } + 60: .c + .h { color: green; } + 61: .c + .i { color: green; } + ^ + 62: .d + .f { color: green; } + 63: .d + .g { color: green; }`, + message: 'Unused CSS selector ".c + .i"', + pos: 1310, + start: { character: 1310, column: 1, line: 61 }, + end: { character: 1317, column: 8, line: 61 } + }, + { + code: 'css-unused-selector', + frame: ` + 60: .c + .h { color: green; } + 61: .c + .i { color: green; } + 62: .d + .f { color: green; } + ^ + 63: .d + .g { color: green; } + 64: .e + .g { color: green; }`, + message: 'Unused CSS selector ".d + .f"', + pos: 1337, + start: { character: 1337, column: 1, line: 62 }, + end: { character: 1344, column: 8, line: 62 } + }, + { + code: 'css-unused-selector', + frame: ` + 61: .c + .i { color: green; } + 62: .d + .f { color: green; } + 63: .d + .g { color: green; } + ^ + 64: .e + .g { color: green; } + 65: .g + .i { color: green; }`, + message: 'Unused CSS selector ".d + .g"', + pos: 1364, + start: { character: 1364, column: 1, line: 63 }, + end: { character: 1371, column: 8, line: 63 } + }, + { + code: 'css-unused-selector', + frame: ` + 62: .d + .f { color: green; } + 63: .d + .g { color: green; } + 64: .e + .g { color: green; } + ^ + 65: .g + .i { color: green; } + 66: `, + message: 'Unused CSS selector ".e + .g"', + pos: 1391, + start: { character: 1391, column: 1, line: 64 }, + end: { character: 1398, column: 8, line: 64 } + }, + { + code: 'css-unused-selector', + frame: ` + 63: .d + .g { color: green; } + 64: .e + .g { color: green; } + 65: .g + .i { color: green; } + ^ + 66: + 67:`, + message: 'Unused CSS selector ".g + .i"', + pos: 1418, + start: { character: 1418, column: 1, line: 65 }, + end: { character: 1425, column: 8, line: 65 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-each-nested/expected.css b/test/css/samples/siblings-combinator-each-nested/expected.css new file mode 100644 index 0000000000..616d739670 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-nested/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.g.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.g.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz+.m.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz+.n.svelte-xyz.svelte-xyz{color:green}.j.svelte-xyz+.o.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz+.m.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz+.n.svelte-xyz.svelte-xyz{color:green}.k.svelte-xyz+.o.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz+.m.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz+.n.svelte-xyz.svelte-xyz{color:green}.l.svelte-xyz+.o.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz+.h.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.h.svelte-xyz+.g.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz+.h.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz+.g.svelte-xyz.svelte-xyz{color:green}.d.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz+.e.svelte-xyz.svelte-xyz{color:green}.f.svelte-xyz+.f.svelte-xyz.svelte-xyz{color:green}.g.svelte-xyz+.g.svelte-xyz.svelte-xyz{color:green}.h.svelte-xyz+.h.svelte-xyz.svelte-xyz{color:green}.i.svelte-xyz+.i.svelte-xyz.svelte-xyz{color:green}.e.svelte-xyz+.e.svelte-xyz+.f.svelte-xyz{color:green}.e.svelte-xyz+.e.svelte-xyz+.d.svelte-xyz{color:green}.h.svelte-xyz+.h.svelte-xyz+.i.svelte-xyz{color:green}.h.svelte-xyz+.h.svelte-xyz+.g.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-nested/expected.html b/test/css/samples/siblings-combinator-each-nested/expected.html new file mode 100644 index 0000000000..340d6fc4c8 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-nested/expected.html @@ -0,0 +1,15 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each-nested/input.svelte b/test/css/samples/siblings-combinator-each-nested/input.svelte new file mode 100644 index 0000000000..b5b9242675 --- /dev/null +++ b/test/css/samples/siblings-combinator-each-nested/input.svelte @@ -0,0 +1,113 @@ + + + + +
+ +{#each array as item} +
+
+{/each} + +{#each array as item} + {#each array as item} + {#each array as item} +
+ {/each} +
+ {/each} +
+{/each} + +{#each array as item} +
+ {#each array as item} +
+ {#each array as item} +
+ {/each} + {/each} +{/each} + +{#each array as item} +
+ {#each array as item} +
+ {#each array as item} +
+ {/each} + {/each} +{/each} + +{#each array as item} + {#each array as item} + {#each array as item} +
+ {/each} +
+ {/each} +
+{/each} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each/expected.css b/test/css/samples/siblings-combinator-each/expected.css new file mode 100644 index 0000000000..a46fc4ed4e --- /dev/null +++ b/test/css/samples/siblings-combinator-each/expected.css @@ -0,0 +1 @@ +div.svelte-xyz+span.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-each/expected.html b/test/css/samples/siblings-combinator-each/expected.html new file mode 100644 index 0000000000..9d0416f01b --- /dev/null +++ b/test/css/samples/siblings-combinator-each/expected.html @@ -0,0 +1,6 @@ +
+ +
+ +
+ diff --git a/test/css/samples/siblings-combinator-each/input.svelte b/test/css/samples/siblings-combinator-each/input.svelte new file mode 100644 index 0000000000..de77a25180 --- /dev/null +++ b/test/css/samples/siblings-combinator-each/input.svelte @@ -0,0 +1,20 @@ + + + + +
+ +{#each array as item} + +
+ +
+{/each} + + \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/_config.js b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/_config.js new file mode 100644 index 0000000000..6648dec55d --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 16: + 17: /* no match */ + 18: .b + .c { color: green; } + ^ + 19: + 20:`, + message: 'Unused CSS selector ".b + .c"', + pos: 319, + start: { character: 319, column: 1, line: 18 }, + end: { character: 326, column: 8, line: 18 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.css b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.css new file mode 100644 index 0000000000..93cd539f00 --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz+.c.svelte-xyz.svelte-xyz{color:green}.c.svelte-xyz+.c.svelte-xyz+.d.svelte-xyz.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz+.c.svelte-xyz+.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.html b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.html new file mode 100644 index 0000000000..fb838a55fd --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/input.svelte b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/input.svelte new file mode 100644 index 0000000000..ff9f10dc1c --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive-with-each/input.svelte @@ -0,0 +1,31 @@ + + + + +
+ +{#if foo} +
+{:else} + {#each array as item} +
+ {/each} +{/if} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive/_config.js b/test/css/samples/siblings-combinator-if-not-exhaustive/_config.js new file mode 100644 index 0000000000..51ca551055 --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 12: + 13: /* no match */ + 14: .b + .c { color: green; } + ^ + 15: + 16:`, + message: 'Unused CSS selector ".b + .c"', + pos: 215, + start: { character: 215, column: 1, line: 14 }, + end: { character: 222, column: 8, line: 14 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive/expected.css b/test/css/samples/siblings-combinator-if-not-exhaustive/expected.css new file mode 100644 index 0000000000..b1225e36a1 --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz{color:green}.b.svelte-xyz+.d.svelte-xyz{color:green}.c.svelte-xyz+.d.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive/expected.html b/test/css/samples/siblings-combinator-if-not-exhaustive/expected.html new file mode 100644 index 0000000000..813e778dc6 --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if-not-exhaustive/input.svelte b/test/css/samples/siblings-combinator-if-not-exhaustive/input.svelte new file mode 100644 index 0000000000..4f832b3b47 --- /dev/null +++ b/test/css/samples/siblings-combinator-if-not-exhaustive/input.svelte @@ -0,0 +1,25 @@ + + + + +
+ +{#if foo} +
+{:else if bar} +
+{/if} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if/_config.js b/test/css/samples/siblings-combinator-if/_config.js new file mode 100644 index 0000000000..bc8e32f5fd --- /dev/null +++ b/test/css/samples/siblings-combinator-if/_config.js @@ -0,0 +1,60 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 13: + 14: /* no match */ + 15: .a + .e { color: green; } + ^ + 16: .b + .c { color: green; } + 17: .b + .d { color: green; }`, + message: 'Unused CSS selector ".a + .e"', + pos: 242, + start: { character: 242, column: 1, line: 15 }, + end: { character: 249, column: 8, line: 15 } + }, + { + code: 'css-unused-selector', + frame: ` + 14: /* no match */ + 15: .a + .e { color: green; } + 16: .b + .c { color: green; } + ^ + 17: .b + .d { color: green; } + 18: .c + .d { color: green; }`, + message: 'Unused CSS selector ".b + .c"', + pos: 269, + start: { character: 269, column: 1, line: 16 }, + end: { character: 276, column: 8, line: 16 } + }, + { + code: 'css-unused-selector', + frame: ` + 15: .a + .e { color: green; } + 16: .b + .c { color: green; } + 17: .b + .d { color: green; } + ^ + 18: .c + .d { color: green; } + 19: `, + message: 'Unused CSS selector ".b + .d"', + pos: 296, + start: { character: 296, column: 1, line: 17 }, + end: { character: 303, column: 8, line: 17 } + }, + { + code: 'css-unused-selector', + frame: ` + 16: .b + .c { color: green; } + 17: .b + .d { color: green; } + 18: .c + .d { color: green; } + ^ + 19: + 20:`, + message: 'Unused CSS selector ".c + .d"', + pos: 323, + start: { character: 323, column: 1, line: 18 }, + end: { character: 330, column: 8, line: 18 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-if/expected.css b/test/css/samples/siblings-combinator-if/expected.css new file mode 100644 index 0000000000..5ea39be7c2 --- /dev/null +++ b/test/css/samples/siblings-combinator-if/expected.css @@ -0,0 +1 @@ +.a.svelte-xyz+.b.svelte-xyz{color:green}.a.svelte-xyz+.c.svelte-xyz{color:green}.a.svelte-xyz+.d.svelte-xyz{color:green}.b.svelte-xyz+.e.svelte-xyz{color:green}.c.svelte-xyz+.e.svelte-xyz{color:green}.d.svelte-xyz+.e.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if/expected.html b/test/css/samples/siblings-combinator-if/expected.html new file mode 100644 index 0000000000..3d8ac9f966 --- /dev/null +++ b/test/css/samples/siblings-combinator-if/expected.html @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-if/input.svelte b/test/css/samples/siblings-combinator-if/input.svelte new file mode 100644 index 0000000000..6cfc436876 --- /dev/null +++ b/test/css/samples/siblings-combinator-if/input.svelte @@ -0,0 +1,31 @@ + + + + +
+ +{#if foo} +
+{:else if bar} +
+{:else} +
+{/if} + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-slot/_config.js b/test/css/samples/siblings-combinator-slot/_config.js new file mode 100644 index 0000000000..8dbb714bd3 --- /dev/null +++ b/test/css/samples/siblings-combinator-slot/_config.js @@ -0,0 +1,46 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 7: + 8: /* no match */ + 9: .a + .b { color: green; } + ^ + 10: .b + .c { color: green; } + 11: .c + .f { color: green; }`, + message: 'Unused CSS selector ".a + .b"', + pos: 84, + start: { character: 84, column: 1, line: 9 }, + end: { character: 91, column: 8, line: 9 } + }, + { + code: 'css-unused-selector', + frame: ` + 8: /* no match */ + 9: .a + .b { color: green; } + 10: .b + .c { color: green; } + ^ + 11: .c + .f { color: green; } + 12: `, + message: 'Unused CSS selector ".b + .c"', + pos: 111, + start: { character: 111, column: 1, line: 10 }, + end: { character: 118, column: 8, line: 10 } + }, + { + code: 'css-unused-selector', + frame: ` + 9: .a + .b { color: green; } + 10: .b + .c { color: green; } + 11: .c + .f { color: green; } + ^ + 12: + 13:`, + message: 'Unused CSS selector ".c + .f"', + pos: 138, + start: { character: 138, column: 1, line: 11 }, + end: { character: 145, column: 8, line: 11 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-slot/expected.css b/test/css/samples/siblings-combinator-slot/expected.css new file mode 100644 index 0000000000..bbdd03f274 --- /dev/null +++ b/test/css/samples/siblings-combinator-slot/expected.css @@ -0,0 +1 @@ +.d.svelte-xyz+.e.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-slot/input.svelte b/test/css/samples/siblings-combinator-slot/input.svelte new file mode 100644 index 0000000000..42fe0e4c30 --- /dev/null +++ b/test/css/samples/siblings-combinator-slot/input.svelte @@ -0,0 +1,24 @@ + + + + +
+ +
+ +
+
+
+
+ + +
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-star/_config.js b/test/css/samples/siblings-combinator-star/_config.js new file mode 100644 index 0000000000..687331e41c --- /dev/null +++ b/test/css/samples/siblings-combinator-star/_config.js @@ -0,0 +1,18 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 3: margin-left: 4px; + 4: } + 5: .not-match > * + * { + ^ + 6: margin-left: 4px; + 7: }`, + message: 'Unused CSS selector ".not-match > * + *"', + pos: 50, + start: { character: 50, column: 1, line: 5 }, + end: { character: 68, column: 19, line: 5 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator-star/expected.css b/test/css/samples/siblings-combinator-star/expected.css new file mode 100644 index 0000000000..c1a06945f9 --- /dev/null +++ b/test/css/samples/siblings-combinator-star/expected.css @@ -0,0 +1 @@ +.match.svelte-xyz>.svelte-xyz+.svelte-xyz{margin-left:4px} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-star/expected.html b/test/css/samples/siblings-combinator-star/expected.html new file mode 100644 index 0000000000..1cfae6e6f7 --- /dev/null +++ b/test/css/samples/siblings-combinator-star/expected.html @@ -0,0 +1,7 @@ +
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-star/input.svelte b/test/css/samples/siblings-combinator-star/input.svelte new file mode 100644 index 0000000000..ca837f2239 --- /dev/null +++ b/test/css/samples/siblings-combinator-star/input.svelte @@ -0,0 +1,17 @@ + + +
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-with-spread/_config.js b/test/css/samples/siblings-combinator-with-spread/_config.js new file mode 100644 index 0000000000..c81f1a9f82 --- /dev/null +++ b/test/css/samples/siblings-combinator-with-spread/_config.js @@ -0,0 +1,3 @@ +export default { + warnings: [] +}; diff --git a/test/css/samples/siblings-combinator-with-spread/expected.css b/test/css/samples/siblings-combinator-with-spread/expected.css new file mode 100644 index 0000000000..aacf6e7db5 --- /dev/null +++ b/test/css/samples/siblings-combinator-with-spread/expected.css @@ -0,0 +1 @@ +input.svelte-xyz:focus+div.svelte-xyz{color:red}input.svelte-xyz:focus~div.svelte-xyz{color:red} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator-with-spread/expected.html b/test/css/samples/siblings-combinator-with-spread/expected.html new file mode 100644 index 0000000000..d732739701 --- /dev/null +++ b/test/css/samples/siblings-combinator-with-spread/expected.html @@ -0,0 +1,2 @@ + +
Should be red, when input is focused
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator-with-spread/input.svelte b/test/css/samples/siblings-combinator-with-spread/input.svelte new file mode 100644 index 0000000000..45c889c1ae --- /dev/null +++ b/test/css/samples/siblings-combinator-with-spread/input.svelte @@ -0,0 +1,11 @@ + + + + + +
Should be red, when input is focused
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator/_config.js b/test/css/samples/siblings-combinator/_config.js new file mode 100644 index 0000000000..b54cd28190 --- /dev/null +++ b/test/css/samples/siblings-combinator/_config.js @@ -0,0 +1,62 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + frame: ` + 3: color: green; + 4: } + 5: article + div { + ^ + 6: color: green; + 7: }`, + message: 'Unused CSS selector "article + div"', + pos: 45, + start: { character: 45, column: 1, line: 5 }, + end: { character: 58, column: 14, line: 5 } + }, + { + code: 'css-unused-selector', + + frame:` + 6: color: green; + 7: } + 8: span + article { + ^ + 9: color: green; + 10: }`, + message: 'Unused CSS selector "span + article"', + pos: 81, + start: { character: 81, column: 1, line: 8 }, + end: { character: 95, column: 15, line: 8 } + }, + { + code: 'css-unused-selector', + + frame: ` + 9: color: green; + 10: } + 11: b + article { + ^ + 12: color: green; + 13: }`, + message: 'Unused CSS selector "b + article"', + pos: 118, + start: { character: 118, column: 1, line: 11 }, + end: { character: 129, column: 12, line: 11 } + }, + { + code: 'css-unused-selector', + frame: ` + 12: color: green; + 13: } + 14: span + div { + ^ + 15: color: green; + 16: }`, + message: 'Unused CSS selector "span + div"', + pos: 152, + start: { character: 152, column: 1, line: 14 }, + end: { character: 162, column: 11, line: 14 } + } + ] +}; diff --git a/test/css/samples/siblings-combinator/expected.css b/test/css/samples/siblings-combinator/expected.css new file mode 100644 index 0000000000..be01048cf1 --- /dev/null +++ b/test/css/samples/siblings-combinator/expected.css @@ -0,0 +1 @@ +div.svelte-xyz+article.svelte-xyz.svelte-xyz{color:green}span.svelte-xyz+b.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz span.svelte-xyz+b.svelte-xyz{color:green}.a.svelte-xyz+article.svelte-xyz.svelte-xyz{color:green}div.svelte-xyz+.b.svelte-xyz.svelte-xyz{color:green} \ No newline at end of file diff --git a/test/css/samples/siblings-combinator/expected.html b/test/css/samples/siblings-combinator/expected.html new file mode 100644 index 0000000000..f4692365dd --- /dev/null +++ b/test/css/samples/siblings-combinator/expected.html @@ -0,0 +1,5 @@ +
+ + +
+
\ No newline at end of file diff --git a/test/css/samples/siblings-combinator/input.svelte b/test/css/samples/siblings-combinator/input.svelte new file mode 100644 index 0000000000..3e22076d52 --- /dev/null +++ b/test/css/samples/siblings-combinator/input.svelte @@ -0,0 +1,35 @@ + + +
+ + +
+
\ No newline at end of file diff --git a/test/css/samples/unused-selector-child-combinator/_config.js b/test/css/samples/unused-selector-child-combinator/_config.js new file mode 100644 index 0000000000..603e0d1fd0 --- /dev/null +++ b/test/css/samples/unused-selector-child-combinator/_config.js @@ -0,0 +1,45 @@ +export default { + warnings: [ + { + code: 'css-unused-selector', + message: 'Unused CSS selector "article > *"', + frame: ` + 1: + +
+

+ Svelte REPLs are svelte. +

+
\ No newline at end of file diff --git a/test/css/samples/unused-selector-leading/_config.js b/test/css/samples/unused-selector-leading/_config.js index 20310a5847..8d1c41af1c 100644 --- a/test/css/samples/unused-selector-leading/_config.js +++ b/test/css/samples/unused-selector-leading/_config.js @@ -1,9 +1,9 @@ export default { warnings: [ { - filename: "SvelteComponent.svelte", - code: `css-unused-selector`, - message: "Unused CSS selector", + filename: 'SvelteComponent.svelte', + code: 'css-unused-selector', + message: 'Unused CSS selector ".foo"', start: { line: 4, column: 1, @@ -25,9 +25,9 @@ export default { }, { - filename: "SvelteComponent.svelte", - code: `css-unused-selector`, - message: "Unused CSS selector", + filename: 'SvelteComponent.svelte', + code: 'css-unused-selector', + message: 'Unused CSS selector ".baz"', start: { line: 4, column: 13, @@ -48,4 +48,4 @@ export default { 6: }` } ] -}; \ No newline at end of file +}; diff --git a/test/css/samples/unused-selector-string-concat/_config.js b/test/css/samples/unused-selector-string-concat/_config.js index 81318fd3ac..78fce87b69 100644 --- a/test/css/samples/unused-selector-string-concat/_config.js +++ b/test/css/samples/unused-selector-string-concat/_config.js @@ -2,7 +2,7 @@ export default { warnings: [ { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".fooaa"', frame: ` 9: `, start: { line: 28, column: 2, character: 595 }, end: { line: 28, column: 9, character: 602 }, - pos: 595, - }, - ], + pos: 595 + } + ] }; diff --git a/test/css/samples/unused-selector-ternary-bailed/_config.js b/test/css/samples/unused-selector-ternary-bailed/_config.js index e5f82e4a85..c81f1a9f82 100644 --- a/test/css/samples/unused-selector-ternary-bailed/_config.js +++ b/test/css/samples/unused-selector-ternary-bailed/_config.js @@ -1,3 +1,3 @@ export default { - warnings: [], + warnings: [] }; diff --git a/test/css/samples/unused-selector-ternary-concat/_config.js b/test/css/samples/unused-selector-ternary-concat/_config.js index 5015fccb25..c95b76e440 100644 --- a/test/css/samples/unused-selector-ternary-concat/_config.js +++ b/test/css/samples/unused-selector-ternary-concat/_config.js @@ -5,7 +5,7 @@ export default { end: { character: 205, column: 9, - line: 14, + line: 14 }, frame: ` 12: .thing.active {color: blue;} @@ -13,13 +13,13 @@ export default { 14: .unused {color: blue;} ^ 15: `, - message: 'Unused CSS selector', + message: 'Unused CSS selector ".unused"', pos: 198, start: { character: 198, column: 2, - line: 14, - }, - }, - ], + line: 14 + } + } + ] }; diff --git a/test/css/samples/unused-selector-ternary-nested/_config.js b/test/css/samples/unused-selector-ternary-nested/_config.js index afee5ac822..1898599950 100644 --- a/test/css/samples/unused-selector-ternary-nested/_config.js +++ b/test/css/samples/unused-selector-ternary-nested/_config.js @@ -2,7 +2,7 @@ export default { warnings: [ { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".hover.unused"', frame: ` 13: .thing.active {color: blue;} 14: .hover { color: blue; } @@ -12,11 +12,11 @@ export default { 17: .unused {color: blue;}`, start: { line: 15, column: 2, character: 261 }, end: { line: 15, column: 15, character: 274 }, - pos: 261, + pos: 261 }, { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".unused"', frame: ` 15: .hover.unused { color: blue; } 16: @@ -25,7 +25,7 @@ export default { 18: `, start: { line: 17, column: 2, character: 295 }, end: { line: 17, column: 9, character: 302 }, - pos: 295, - }, - ], + pos: 295 + } + ] }; diff --git a/test/css/samples/unused-selector-ternary/_config.js b/test/css/samples/unused-selector-ternary/_config.js index 4ff2713108..7009e60cc0 100644 --- a/test/css/samples/unused-selector-ternary/_config.js +++ b/test/css/samples/unused-selector-ternary/_config.js @@ -4,9 +4,9 @@ export default { }, warnings: [{ - filename: "SvelteComponent.svelte", - code: `css-unused-selector`, - message: "Unused CSS selector", + filename: 'SvelteComponent.svelte', + code: 'css-unused-selector', + message: 'Unused CSS selector ".maybeactive"', start: { line: 16, column: 1, @@ -26,4 +26,4 @@ export default { 17: color: green; 18: }` }] -}; \ No newline at end of file +}; diff --git a/test/css/samples/unused-selector/_config.js b/test/css/samples/unused-selector/_config.js index 49fb3a27e7..ed1a2032ca 100644 --- a/test/css/samples/unused-selector/_config.js +++ b/test/css/samples/unused-selector/_config.js @@ -1,8 +1,8 @@ export default { warnings: [{ - filename: "SvelteComponent.svelte", - code: `css-unused-selector`, - message: "Unused CSS selector", + filename: 'SvelteComponent.svelte', + code: 'css-unused-selector', + message: 'Unused CSS selector ".bar"', start: { line: 8, column: 1, @@ -22,4 +22,4 @@ export default { 9: color: blue; 10: }` }] -}; \ No newline at end of file +}; diff --git a/test/custom-elements/assert.js b/test/custom-elements/assert.js index 0edbd31124..4ee8d9dda0 100644 --- a/test/custom-elements/assert.js +++ b/test/custom-elements/assert.js @@ -30,4 +30,25 @@ export function equal(a, b, message) { export function ok(condition, message) { if (!condition) throw new Error(message || `Expected ${condition} to be truthy`); -} \ No newline at end of file +} + +export function htmlEqual(actual, expected, message) { + return deepEqual( + normalizeHtml(window, actual), + normalizeHtml(window, expected), + message + ); +} + +function normalizeHtml(window, html) { + try { + const node = window.document.createElement('div'); + node.innerHTML = html + .replace(//g, '') + .replace(/>[\s\r\n]+<') + .trim(); + return node.innerHTML.replace(/<\/?noscript\/?>/g, ''); + } catch (err) { + throw new Error(`Failed to normalize HTML:\n${html}`); + } +} diff --git a/test/custom-elements/index.js b/test/custom-elements/index.ts similarity index 93% rename from test/custom-elements/index.js rename to test/custom-elements/index.ts index 1329dbd2cf..d3644a3142 100644 --- a/test/custom-elements/index.js +++ b/test/custom-elements/index.ts @@ -2,9 +2,9 @@ import * as fs from 'fs'; import * as path from 'path'; import * as http from 'http'; import { rollup } from 'rollup'; -import * as virtual from '@rollup/plugin-virtual'; -import * as puppeteer from 'puppeteer'; -import { addLineNumbers, loadConfig, loadSvelte } from "../helpers.js"; +import virtual from '@rollup/plugin-virtual'; +import puppeteer from 'puppeteer'; +import { addLineNumbers, loadConfig, loadSvelte } from '../helpers'; import { deepEqual } from 'assert'; const page = ` @@ -87,7 +87,7 @@ describe('custom-elements', function() { transform(code, id) { if (id.endsWith('.svelte')) { - const compiled = svelte.compile(code.replace(/\r/g, ""), { + const compiled = svelte.compile(code.replace(/\r/g, ''), { customElement: true, dev: config.dev }); diff --git a/test/custom-elements/samples/$$props/main.svelte b/test/custom-elements/samples/$$props/main.svelte new file mode 100644 index 0000000000..68931e22db --- /dev/null +++ b/test/custom-elements/samples/$$props/main.svelte @@ -0,0 +1,10 @@ + + + + +

name: {name}

+

$$props: {JSON.stringify($$props)}

+

$$restProps: {JSON.stringify($$restProps)}

+ diff --git a/test/custom-elements/samples/$$props/test.js b/test/custom-elements/samples/$$props/test.js new file mode 100644 index 0000000000..94cad86577 --- /dev/null +++ b/test/custom-elements/samples/$$props/test.js @@ -0,0 +1,13 @@ +import * as assert from 'assert'; +import './main.svelte'; + +export default function (target) { + target.innerHTML = ''; + const el = target.querySelector('custom-element'); + + assert.htmlEqual(el.shadowRoot.innerHTML, ` +

name: world

+

$$props: {"name":"world","answer":"42","test":"svelte"}

+

$$restProps: {"answer":"42","test":"svelte"}

+ `); +} diff --git a/test/custom-elements/samples/custom-method/test.js b/test/custom-elements/samples/custom-method/test.js index e274786079..08c58c3383 100644 --- a/test/custom-elements/samples/custom-method/test.js +++ b/test/custom-elements/samples/custom-method/test.js @@ -9,4 +9,4 @@ export default async function (target) { const p = el.shadowRoot.querySelector('p'); assert.equal(p.textContent, '42'); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/escaped-css/test.js b/test/custom-elements/samples/escaped-css/test.js index 3696ee8c1b..6277ccba32 100644 --- a/test/custom-elements/samples/escaped-css/test.js +++ b/test/custom-elements/samples/escaped-css/test.js @@ -10,4 +10,4 @@ export default function (target) { const before = getComputedStyle(icon, '::before'); assert.equal(before.content, JSON.stringify(String.fromCharCode(0xff))); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/extended-builtin/_config.js b/test/custom-elements/samples/extended-builtin/_config.js index cbd57acc65..932460335f 100644 --- a/test/custom-elements/samples/extended-builtin/_config.js +++ b/test/custom-elements/samples/extended-builtin/_config.js @@ -1,6 +1,6 @@ export default { warnings: [{ - code: "avoid-is", + code: 'avoid-is', message: "The 'is' attribute is not supported cross-browser and should be avoided", pos: 98, start: { diff --git a/test/custom-elements/samples/extended-builtin/custom-button.js b/test/custom-elements/samples/extended-builtin/custom-button.js index 9134b2af9f..19fe4aa0e7 100644 --- a/test/custom-elements/samples/extended-builtin/custom-button.js +++ b/test/custom-elements/samples/extended-builtin/custom-button.js @@ -1,2 +1,2 @@ class CustomButton extends HTMLButtonElement {} -customElements.define('custom-button', CustomButton, { extends: 'button' }); \ No newline at end of file +customElements.define('custom-button', CustomButton, { extends: 'button' }); diff --git a/test/custom-elements/samples/extended-builtin/test.js b/test/custom-elements/samples/extended-builtin/test.js index 3886ae1149..a2f253e5d4 100644 --- a/test/custom-elements/samples/extended-builtin/test.js +++ b/test/custom-elements/samples/extended-builtin/test.js @@ -12,4 +12,4 @@ export default function (target) { const button = el.shadowRoot.querySelector('button'); assert.ok(button instanceof customElements.get('custom-button')); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/html-slots/test.js b/test/custom-elements/samples/html-slots/test.js index bb38a83eab..06d18d9944 100644 --- a/test/custom-elements/samples/html-slots/test.js +++ b/test/custom-elements/samples/html-slots/test.js @@ -14,4 +14,4 @@ export default function (target) { assert.equal(slot0.assignedNodes()[1], target.querySelector('strong')); assert.equal(slot1.assignedNodes().length, 0); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/html/test.js b/test/custom-elements/samples/html/test.js index 1638ead784..4e38fd6c2d 100644 --- a/test/custom-elements/samples/html/test.js +++ b/test/custom-elements/samples/html/test.js @@ -9,4 +9,4 @@ export default function (target) { const h1 = el.shadowRoot.querySelector('h1'); assert.equal(h1.textContent, 'Hello world!'); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/nested.skip/test.js b/test/custom-elements/samples/nested.skip/test.js index 85320297ea..09edc38f54 100644 --- a/test/custom-elements/samples/nested.skip/test.js +++ b/test/custom-elements/samples/nested.skip/test.js @@ -8,10 +8,10 @@ export default async function (target) { const button = counter.shadowRoot.querySelector('button'); assert.equal(counter.count, 0); - assert.equal(counter.shadowRoot.innerHTML, ``); + assert.equal(counter.shadowRoot.innerHTML, ''); await button.dispatchEvent(new MouseEvent('click')); assert.equal(counter.count, 1); - assert.equal(counter.shadowRoot.innerHTML, ``); -} \ No newline at end of file + assert.equal(counter.shadowRoot.innerHTML, ''); +} diff --git a/test/custom-elements/samples/new-styled/test.js b/test/custom-elements/samples/new-styled/test.js index f027121009..72c2cecd10 100644 --- a/test/custom-elements/samples/new-styled/test.js +++ b/test/custom-elements/samples/new-styled/test.js @@ -16,4 +16,4 @@ export default function (target) { assert.equal(getComputedStyle(unstyled).color, 'rgb(0, 0, 0)'); assert.equal(getComputedStyle(styled).color, 'rgb(255, 0, 0)'); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/new/test.js b/test/custom-elements/samples/new/test.js index 1137495e35..88ba69ab69 100644 --- a/test/custom-elements/samples/new/test.js +++ b/test/custom-elements/samples/new/test.js @@ -15,4 +15,4 @@ export default function (target) { const h1 = el.shadowRoot.querySelector('h1'); assert.equal(h1.textContent, 'Hello world!'); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/no-missing-prop-warnings/_config.js b/test/custom-elements/samples/no-missing-prop-warnings/_config.js index e26996239d..083edcd210 100644 --- a/test/custom-elements/samples/no-missing-prop-warnings/_config.js +++ b/test/custom-elements/samples/no-missing-prop-warnings/_config.js @@ -1,3 +1,3 @@ export default { dev: true -}; \ No newline at end of file +}; diff --git a/test/custom-elements/samples/no-missing-prop-warnings/test.js b/test/custom-elements/samples/no-missing-prop-warnings/test.js index 1909e7aef9..6f15b63920 100644 --- a/test/custom-elements/samples/no-missing-prop-warnings/test.js +++ b/test/custom-elements/samples/no-missing-prop-warnings/test.js @@ -12,8 +12,8 @@ export default function (target) { target.innerHTML = ''; assert.deepEqual(warnings, [ - ` was created without expected prop 'bar'` + " was created without expected prop 'bar'" ]); console.warn = warn; -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/no-svelte-options/_config.js b/test/custom-elements/samples/no-svelte-options/_config.js index e45582a127..98273f767f 100644 --- a/test/custom-elements/samples/no-svelte-options/_config.js +++ b/test/custom-elements/samples/no-svelte-options/_config.js @@ -1,6 +1,6 @@ export default { warnings: [{ - code: "custom-element-no-tag", + code: 'custom-element-no-tag', message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ", pos: 0, start: { diff --git a/test/custom-elements/samples/no-svelte-options/test.js b/test/custom-elements/samples/no-svelte-options/test.js index c77f035088..e6ce82d1a4 100644 --- a/test/custom-elements/samples/no-svelte-options/test.js +++ b/test/custom-elements/samples/no-svelte-options/test.js @@ -3,7 +3,7 @@ import CustomElement from './main.svelte'; export default function (target) { customElements.define('no-tag', CustomElement); - target.innerHTML = ``; + target.innerHTML = ''; const el = target.querySelector('no-tag'); const h1 = el.shadowRoot.querySelector('h1'); diff --git a/test/custom-elements/samples/no-tag-warning/_config.js b/test/custom-elements/samples/no-tag-warning/_config.js index 7cdfdbaec6..fb476a7b5b 100644 --- a/test/custom-elements/samples/no-tag-warning/_config.js +++ b/test/custom-elements/samples/no-tag-warning/_config.js @@ -1,6 +1,6 @@ export default { warnings: [{ - code: "custom-element-no-tag", + code: 'custom-element-no-tag', message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ", pos: 0, start: { diff --git a/test/custom-elements/samples/no-tag-warning/test.js b/test/custom-elements/samples/no-tag-warning/test.js index c77f035088..e6ce82d1a4 100644 --- a/test/custom-elements/samples/no-tag-warning/test.js +++ b/test/custom-elements/samples/no-tag-warning/test.js @@ -3,7 +3,7 @@ import CustomElement from './main.svelte'; export default function (target) { customElements.define('no-tag', CustomElement); - target.innerHTML = ``; + target.innerHTML = ''; const el = target.querySelector('no-tag'); const h1 = el.shadowRoot.querySelector('h1'); diff --git a/test/custom-elements/samples/no-tag/test.js b/test/custom-elements/samples/no-tag/test.js index c77f035088..e6ce82d1a4 100644 --- a/test/custom-elements/samples/no-tag/test.js +++ b/test/custom-elements/samples/no-tag/test.js @@ -3,7 +3,7 @@ import CustomElement from './main.svelte'; export default function (target) { customElements.define('no-tag', CustomElement); - target.innerHTML = ``; + target.innerHTML = ''; const el = target.querySelector('no-tag'); const h1 = el.shadowRoot.querySelector('h1'); diff --git a/test/custom-elements/samples/oncreate/test.js b/test/custom-elements/samples/oncreate/test.js index 11d76078f2..c33f8a6a10 100644 --- a/test/custom-elements/samples/oncreate/test.js +++ b/test/custom-elements/samples/oncreate/test.js @@ -5,4 +5,4 @@ export default function (target) { target.innerHTML = ''; const el = target.querySelector('my-app'); assert.ok(el.wasCreated); -} \ No newline at end of file +} diff --git a/test/custom-elements/samples/props/test.js b/test/custom-elements/samples/props/test.js index 9c7e44c3a3..fc8c01c623 100644 --- a/test/custom-elements/samples/props/test.js +++ b/test/custom-elements/samples/props/test.js @@ -20,4 +20,4 @@ export default function (target) { assert.equal(p1.textContent, '5 items'); assert.equal(p2.textContent, 'd, e, f, g, h'); -} \ No newline at end of file +} diff --git a/test/helpers.js b/test/helpers.ts similarity index 95% rename from test/helpers.js rename to test/helpers.ts index a764d43f96..78f000c274 100644 --- a/test/helpers.js +++ b/test/helpers.ts @@ -1,9 +1,10 @@ +import * as assert$1 from 'assert'; import * as jsdom from 'jsdom'; -import * as assert from 'assert'; -import * as glob from 'tiny-glob/sync.js'; +import glob from 'tiny-glob/sync'; import * as path from 'path'; import * as fs from 'fs'; import * as colors from 'kleur'; +export const assert = (assert$1 as unknown) as typeof assert$1 & { htmlEqual: (actual, expected, message?) => void }; // for coverage purposes, we need to test source files, // but for sanity purposes, we need to test dist files @@ -63,7 +64,7 @@ global.window = window; // add missing ecmascript globals to window for (const key of Object.getOwnPropertyNames(global)) { - window[key] = window[key] || global[key]; + if (!(key in window)) window[key] = global[key]; } // implement mock scroll @@ -153,6 +154,7 @@ export function normalizeHtml(window, html) { export function setupHtmlEqual() { const window = env(); + // eslint-disable-next-line no-import-assign assert.htmlEqual = (actual, expected, message) => { assert.deepEqual( normalizeHtml(window, actual), @@ -257,4 +259,4 @@ export function mkdirp(dir) { } catch (err) { // do nothing } -} \ No newline at end of file +} diff --git a/test/hydration/index.js b/test/hydration/index.ts similarity index 91% rename from test/hydration/index.js rename to test/hydration/index.ts index f57a0cdc1a..2eefee3fac 100644 --- a/test/hydration/index.js +++ b/test/hydration/index.ts @@ -1,15 +1,15 @@ -import * as assert from 'assert'; import * as path from 'path'; import * as fs from 'fs'; import { + assert, showOutput, loadConfig, loadSvelte, env, setupHtmlEqual, shouldUpdateExpected -} from '../helpers.js'; +} from '../helpers'; let compileOptions = null; @@ -58,13 +58,7 @@ describe('hydration', () => { try { global.window = window; - let SvelteComponent; - - try { - SvelteComponent = require(`${cwd}/main.svelte`).default; - } catch (err) { - throw err; - } + const SvelteComponent = require(`${cwd}/main.svelte`).default; const target = window.document.body; const head = window.document.head; @@ -75,7 +69,9 @@ describe('hydration', () => { try { before_head = fs.readFileSync(`${cwd}/_before_head.html`, 'utf-8'); head.innerHTML = before_head; - } catch (err) {} + } catch (err) { + // continue regardless of error + } const snapshot = config.snapshot ? config.snapshot(target) : {}; @@ -122,9 +118,11 @@ describe('hydration', () => { throw err; } - if (config.show) showOutput(cwd, { - hydratable: true - }); + if (config.show) { + showOutput(cwd, { + hydratable: true + }); + } }); } diff --git a/test/hydration/samples/basic/_config.js b/test/hydration/samples/basic/_config.js index 79d91d0d8a..81d01322e4 100644 --- a/test/hydration/samples/basic/_config.js +++ b/test/hydration/samples/basic/_config.js @@ -14,4 +14,4 @@ export default { assert.equal(h1, snapshot.h1); assert.equal(h1.childNodes[0], snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/binding-input/_config.js b/test/hydration/samples/binding-input/_config.js index 9004d06490..ac3a6be43a 100644 --- a/test/hydration/samples/binding-input/_config.js +++ b/test/hydration/samples/binding-input/_config.js @@ -26,4 +26,4 @@ export default {

Hello everybody!

`); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/component-in-element/_config.js b/test/hydration/samples/component-in-element/_config.js index 790b026400..557fe068c4 100644 --- a/test/hydration/samples/component-in-element/_config.js +++ b/test/hydration/samples/component-in-element/_config.js @@ -18,4 +18,4 @@ export default { assert.equal(p, snapshot.p); assert.equal(p.childNodes[0], snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/component/_config.js b/test/hydration/samples/component/_config.js index c26b3c7ad0..4435b2f86e 100644 --- a/test/hydration/samples/component/_config.js +++ b/test/hydration/samples/component/_config.js @@ -14,4 +14,4 @@ export default { assert.equal(p, snapshot.p); assert.equal(p.childNodes[0], snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/dynamic-text-changed/_config.js b/test/hydration/samples/dynamic-text-changed/_config.js index 467aef49ac..c42e251464 100644 --- a/test/hydration/samples/dynamic-text-changed/_config.js +++ b/test/hydration/samples/dynamic-text-changed/_config.js @@ -18,4 +18,4 @@ export default { assert.equal(h1, snapshot.h1); assert.equal(h1.childNodes[0], snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/dynamic-text-nil/_config.js b/test/hydration/samples/dynamic-text-nil/_config.js index 0f98a704b0..b4d013b777 100644 --- a/test/hydration/samples/dynamic-text-nil/_config.js +++ b/test/hydration/samples/dynamic-text-nil/_config.js @@ -7,7 +7,7 @@ export default { return { nullText, - undefinedText, + undefinedText }; }, @@ -17,5 +17,5 @@ export default { assert.equal(nullText, snapshot.nullText); assert.equal(undefinedText, snapshot.undefinedText); - }, + } }; diff --git a/test/hydration/samples/dynamic-text/_config.js b/test/hydration/samples/dynamic-text/_config.js index a7f0fc3d8b..47e095d4ca 100644 --- a/test/hydration/samples/dynamic-text/_config.js +++ b/test/hydration/samples/dynamic-text/_config.js @@ -18,4 +18,4 @@ export default { assert.equal(h1, snapshot.h1); assert.equal(h1.childNodes[0], snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/each-block/_config.js b/test/hydration/samples/each-block/_config.js index 5c58a4c232..81f0a75831 100644 --- a/test/hydration/samples/each-block/_config.js +++ b/test/hydration/samples/each-block/_config.js @@ -26,4 +26,4 @@ export default { assert.equal(lis[1], snapshot.lis[1]); assert.equal(lis[2], snapshot.lis[2]); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-attribute-added/_config.js b/test/hydration/samples/element-attribute-added/_config.js index fb4a90bd3d..a662743c2c 100644 --- a/test/hydration/samples/element-attribute-added/_config.js +++ b/test/hydration/samples/element-attribute-added/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(div, snapshot.div); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-attribute-changed/_config.js b/test/hydration/samples/element-attribute-changed/_config.js index 05881f748f..d402e35d7b 100644 --- a/test/hydration/samples/element-attribute-changed/_config.js +++ b/test/hydration/samples/element-attribute-changed/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(div, snapshot.div); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-attribute-removed/_config.js b/test/hydration/samples/element-attribute-removed/_config.js index 05881f748f..d402e35d7b 100644 --- a/test/hydration/samples/element-attribute-removed/_config.js +++ b/test/hydration/samples/element-attribute-removed/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(div, snapshot.div); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-attribute-unchanged/_config.js b/test/hydration/samples/element-attribute-unchanged/_config.js index d41f5db0fb..d9d220b6e5 100644 --- a/test/hydration/samples/element-attribute-unchanged/_config.js +++ b/test/hydration/samples/element-attribute-unchanged/_config.js @@ -12,4 +12,4 @@ export default { assert.equal(div, snapshot.div); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-nested/_config.js b/test/hydration/samples/element-nested/_config.js index 0965bc39c6..cd34008c04 100644 --- a/test/hydration/samples/element-nested/_config.js +++ b/test/hydration/samples/element-nested/_config.js @@ -14,4 +14,4 @@ export default { assert.equal(div, snapshot.div); assert.equal(div.querySelector('p'), snapshot.p); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/element-ref/_config.js b/test/hydration/samples/element-ref/_config.js index 772fad9827..80d681f7c5 100644 --- a/test/hydration/samples/element-ref/_config.js +++ b/test/hydration/samples/element-ref/_config.js @@ -3,7 +3,7 @@ export default { const h1 = target.querySelector('h1'); return { - h1, + h1 }; }, @@ -13,4 +13,4 @@ export default { assert.equal(h1, snapshot.h1); assert.equal(component.h1, h1); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/event-handler/_config.js b/test/hydration/samples/event-handler/_config.js index cdf7431836..027b2bd15b 100644 --- a/test/hydration/samples/event-handler/_config.js +++ b/test/hydration/samples/event-handler/_config.js @@ -23,4 +23,4 @@ export default {

clicked!

`); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/if-block-anchor/_config.js b/test/hydration/samples/if-block-anchor/_config.js index ee5ed39ad9..ab519c913b 100644 --- a/test/hydration/samples/if-block-anchor/_config.js +++ b/test/hydration/samples/if-block-anchor/_config.js @@ -23,4 +23,4 @@ export default { assert.equal(ps[0], snapshot.p0); assert.equal(ps[1], snapshot.p1); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/if-block-false/_config.js b/test/hydration/samples/if-block-false/_config.js index 6be30614f8..a11d800e45 100644 --- a/test/hydration/samples/if-block-false/_config.js +++ b/test/hydration/samples/if-block-false/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(p, snapshot.p); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/if-block-update/_config.js b/test/hydration/samples/if-block-update/_config.js index 75d056e04d..fb4a723145 100644 --- a/test/hydration/samples/if-block-update/_config.js +++ b/test/hydration/samples/if-block-update/_config.js @@ -19,6 +19,6 @@ export default { component.foo = false; component.bar = true; - assert.htmlEqual(target.innerHTML, `

bar!

`); + assert.htmlEqual(target.innerHTML, '

bar!

'); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/if-block/_config.js b/test/hydration/samples/if-block/_config.js index 7aca2ce55d..bd89748dc0 100644 --- a/test/hydration/samples/if-block/_config.js +++ b/test/hydration/samples/if-block/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(p, snapshot.p); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/raw/_config.js b/test/hydration/samples/raw/_config.js index 4af36b099e..f4fb2889cd 100644 --- a/test/hydration/samples/raw/_config.js +++ b/test/hydration/samples/raw/_config.js @@ -2,7 +2,7 @@ export default { skip: true, // existing nodes are blown away props: { - raw: `

this is some html

and so is this

` + raw: '

this is some html

and so is this

' }, snapshot(target) { @@ -24,4 +24,4 @@ export default { assert.equal(ps[1], snapshot.p1); assert.equal(ps[1].firstChild, snapshot.text1); } -}; \ No newline at end of file +}; diff --git a/test/hydration/samples/top-level-text/_config.js b/test/hydration/samples/top-level-text/_config.js index e8a81e7ca1..2ccf126555 100644 --- a/test/hydration/samples/top-level-text/_config.js +++ b/test/hydration/samples/top-level-text/_config.js @@ -10,4 +10,4 @@ export default { assert.equal(text, snapshot.text); } -}; \ No newline at end of file +}; diff --git a/test/js/index.js b/test/js/index.ts similarity index 70% rename from test/js/index.js rename to test/js/index.ts index 8aa4cc76a9..b94c9c01d6 100644 --- a/test/js/index.js +++ b/test/js/index.ts @@ -1,18 +1,18 @@ -import * as assert from "assert"; -import * as fs from "fs"; -import * as path from "path"; -import * as colors from "kleur"; -import { loadConfig, svelte, shouldUpdateExpected } from "../helpers.js"; +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; +import * as colors from 'kleur'; +import { loadConfig, svelte, shouldUpdateExpected } from '../helpers'; -describe("js", () => { +describe('js', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { - if (dir[0] === ".") return; + if (dir[0] === '.') return; // add .solo to a sample directory name to only run that test const solo = /\.solo/.test(dir); if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); + throw new Error('Forgot to remove `solo: true` from test'); } const resolved = path.resolve(`${__dirname}/samples`, dir); @@ -25,7 +25,7 @@ describe("js", () => { (solo ? it.only : it)(dir, () => { const config = loadConfig(`${resolved}/_config.js`); - const input = fs.readFileSync(`${resolved}/input.svelte`, "utf-8").replace(/\s+$/, "").replace(/\r/g, ""); + const input = fs.readFileSync(`${resolved}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, ''); let actual; @@ -45,7 +45,7 @@ describe("js", () => { let expected = ''; try { - expected = fs.readFileSync(expectedPath, "utf-8"); + expected = fs.readFileSync(expectedPath, 'utf-8'); } catch (error) { console.log(error); if (error.code === 'ENOENT') { @@ -56,8 +56,8 @@ describe("js", () => { try { assert.equal( - actual.trim().replace(/^[ \t]+$/gm, "").replace(/\r/g, ""), - expected.trim().replace(/^[ \t]+$/gm, "").replace(/\r/g, "") + actual.trim().replace(/^[ \t]+$/gm, '').replace(/\r/g, ''), + expected.trim().replace(/^[ \t]+$/gm, '').replace(/\r/g, '') ); } catch (error) { if (shouldUpdateExpected()) { diff --git a/test/js/samples/capture-inject-dev-only/_config.js b/test/js/samples/capture-inject-dev-only/_config.js index 1e0819f22e..1f2b217a9a 100644 --- a/test/js/samples/capture-inject-dev-only/_config.js +++ b/test/js/samples/capture-inject-dev-only/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: false } -}; \ No newline at end of file +}; diff --git a/test/js/samples/capture-inject-state/expected.js b/test/js/samples/capture-inject-state/expected.js index 6aa93b9c5a..6a0351ae44 100644 --- a/test/js/samples/capture-inject-state/expected.js +++ b/test/js/samples/capture-inject-state/expected.js @@ -103,6 +103,8 @@ function instance($$self, $$props, $$invalidate) { $$subscribe_prop = () => ($$unsubscribe_prop(), $$unsubscribe_prop = subscribe(prop, $$value => $$invalidate(2, $prop = $$value)), prop); $$self.$$.on_destroy.push(() => $$unsubscribe_prop()); + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let { prop } = $$props; validate_store(prop, "prop"); $$subscribe_prop(); @@ -115,9 +117,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - $$self.$$set = $$props => { if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop)); if ("alias" in $$props) $$invalidate(1, realName = $$props.alias); diff --git a/test/js/samples/component-static-immutable/_config.js b/test/js/samples/component-static-immutable/_config.js index 06713941e0..e9026d8223 100644 --- a/test/js/samples/component-static-immutable/_config.js +++ b/test/js/samples/component-static-immutable/_config.js @@ -2,4 +2,4 @@ export default { options: { immutable: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/component-static-immutable2/_config.js b/test/js/samples/component-static-immutable2/_config.js index 06713941e0..e9026d8223 100644 --- a/test/js/samples/component-static-immutable2/_config.js +++ b/test/js/samples/component-static-immutable2/_config.js @@ -2,4 +2,4 @@ export default { options: { immutable: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/component-store-file-invalidate/store.js b/test/js/samples/component-store-file-invalidate/store.js index 99e27e5584..b799c0ffc4 100644 --- a/test/js/samples/component-store-file-invalidate/store.js +++ b/test/js/samples/component-store-file-invalidate/store.js @@ -1,3 +1,3 @@ import { writable } from '../../../../store'; -export const count = writable(0); \ No newline at end of file +export const count = writable(0); diff --git a/test/js/samples/css-shadow-dom-keyframes/_config.js b/test/js/samples/css-shadow-dom-keyframes/_config.js index 735dd07e62..e8a05d399c 100644 --- a/test/js/samples/css-shadow-dom-keyframes/_config.js +++ b/test/js/samples/css-shadow-dom-keyframes/_config.js @@ -2,4 +2,4 @@ export default { options: { customElement: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/css-shadow-dom-keyframes/expected.js b/test/js/samples/css-shadow-dom-keyframes/expected.js index a0a0ebe021..82a39e5924 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected.js @@ -1,6 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { SvelteElement, + attribute_to_object, detach, element, init, @@ -34,7 +35,18 @@ class Component extends SvelteElement { constructor(options) { super(); this.shadowRoot.innerHTML = ``; - init(this, { target: this.shadowRoot }, null, create_fragment, safe_not_equal, {}); + + init( + this, + { + target: this.shadowRoot, + props: attribute_to_object(this.attributes) + }, + null, + create_fragment, + safe_not_equal, + {} + ); if (options) { if (options.target) { diff --git a/test/js/samples/debug-empty/_config.js b/test/js/samples/debug-empty/_config.js index b1f2518e8a..414b026a97 100644 --- a/test/js/samples/debug-empty/_config.js +++ b/test/js/samples/debug-empty/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/debug-empty/expected.js b/test/js/samples/debug-empty/expected.js index 6781e5333c..f427f1bf45 100644 --- a/test/js/samples/debug-empty/expected.js +++ b/test/js/samples/debug-empty/expected.js @@ -69,6 +69,8 @@ function create_fragment(ctx) { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let { name } = $$props; const writable_props = ["name"]; @@ -76,9 +78,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - $$self.$$set = $$props => { if ("name" in $$props) $$invalidate(0, name = $$props.name); }; diff --git a/test/js/samples/debug-foo-bar-baz-things/_config.js b/test/js/samples/debug-foo-bar-baz-things/_config.js index b1f2518e8a..414b026a97 100644 --- a/test/js/samples/debug-foo-bar-baz-things/_config.js +++ b/test/js/samples/debug-foo-bar-baz-things/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 087d2e399d..7439b3310b 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -170,6 +170,8 @@ function create_fragment(ctx) { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let { things } = $$props; let { foo } = $$props; let { bar } = $$props; @@ -180,9 +182,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - $$self.$$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); diff --git a/test/js/samples/debug-foo/_config.js b/test/js/samples/debug-foo/_config.js index b1f2518e8a..414b026a97 100644 --- a/test/js/samples/debug-foo/_config.js +++ b/test/js/samples/debug-foo/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/debug-foo/expected.js b/test/js/samples/debug-foo/expected.js index 9f12bfb807..d869a5cf9e 100644 --- a/test/js/samples/debug-foo/expected.js +++ b/test/js/samples/debug-foo/expected.js @@ -164,6 +164,8 @@ function create_fragment(ctx) { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let { things } = $$props; let { foo } = $$props; const writable_props = ["things", "foo"]; @@ -172,9 +174,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - $$self.$$set = $$props => { if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); diff --git a/test/js/samples/debug-hoisted/expected.js b/test/js/samples/debug-hoisted/expected.js index 0e634297f0..c6257ac90d 100644 --- a/test/js/samples/debug-hoisted/expected.js +++ b/test/js/samples/debug-hoisted/expected.js @@ -49,6 +49,8 @@ function create_fragment(ctx) { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let obj = { x: 5 }; let kobzol = 5; const writable_props = []; @@ -57,8 +59,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); $$self.$capture_state = () => ({ obj, kobzol }); $$self.$inject_state = $$props => { diff --git a/test/js/samples/debug-no-dependencies/_config.js b/test/js/samples/debug-no-dependencies/_config.js index b1f2518e8a..414b026a97 100644 --- a/test/js/samples/debug-no-dependencies/_config.js +++ b/test/js/samples/debug-no-dependencies/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index 76068e8cf4..4d8d05d3aa 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -136,14 +136,14 @@ function create_fragment(ctx) { } function instance($$self, $$props) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); const writable_props = []; Object.keys($$props).forEach(key => { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); return []; } diff --git a/test/js/samples/debug-ssr-foo/_config.js b/test/js/samples/debug-ssr-foo/_config.js index 39bfbe7e62..c4070b9a3b 100644 --- a/test/js/samples/debug-ssr-foo/_config.js +++ b/test/js/samples/debug-ssr-foo/_config.js @@ -3,4 +3,4 @@ export default { generate: 'ssr', dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/debug-ssr-foo/expected.js b/test/js/samples/debug-ssr-foo/expected.js index fe34a6a4fd..69da37b2d9 100644 --- a/test/js/samples/debug-ssr-foo/expected.js +++ b/test/js/samples/debug-ssr-foo/expected.js @@ -1,7 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { create_ssr_component, debug, each, escape } from "svelte/internal"; -const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { +const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => { let { things } = $$props; let { foo } = $$props; if ($$props.things === void 0 && $$bindings.things && things !== void 0) $$bindings.things(things); diff --git a/test/js/samples/dev-warning-missing-data-computed/_config.js b/test/js/samples/dev-warning-missing-data-computed/_config.js index b1f2518e8a..414b026a97 100644 --- a/test/js/samples/dev-warning-missing-data-computed/_config.js +++ b/test/js/samples/dev-warning-missing-data-computed/_config.js @@ -2,4 +2,4 @@ export default { options: { dev: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/dev-warning-missing-data-computed/expected.js b/test/js/samples/dev-warning-missing-data-computed/expected.js index fd34778f8d..8c7f8bb1cf 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected.js @@ -65,6 +65,8 @@ function create_fragment(ctx) { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let { foo } = $$props; let bar; const writable_props = ["foo"]; @@ -73,9 +75,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - $$self.$$set = $$props => { if ("foo" in $$props) $$invalidate(0, foo = $$props.foo); }; diff --git a/test/js/samples/event-modifiers/expected.js b/test/js/samples/event-modifiers/expected.js index 6aa3c161f9..3901753661 100644 --- a/test/js/samples/event-modifiers/expected.js +++ b/test/js/samples/event-modifiers/expected.js @@ -16,41 +16,49 @@ import { } from "svelte/internal"; function create_fragment(ctx) { - let div; - let button0; + let div1; + let div0; let t1; - let button1; + let button0; let t3; + let button1; + let t5; let button2; let mounted; let dispose; return { c() { - div = element("div"); + div1 = element("div"); + div0 = element("div"); + div0.textContent = "touch me"; + t1 = space(); button0 = element("button"); button0.textContent = "click me"; - t1 = space(); + t3 = space(); button1 = element("button"); button1.textContent = "or me"; - t3 = space(); + t5 = space(); button2 = element("button"); button2.textContent = "or me!"; }, m(target, anchor) { - insert(target, div, anchor); - append(div, button0); - append(div, t1); - append(div, button1); - append(div, t3); - append(div, button2); + insert(target, div1, anchor); + append(div1, div0); + append(div1, t1); + append(div1, button0); + append(div1, t3); + append(div1, button1); + append(div1, t5); + append(div1, button2); if (!mounted) { dispose = [ + listen(div0, "touchstart", handleTouchstart, { passive: false }), listen(button0, "click", stop_propagation(prevent_default(handleClick))), listen(button1, "click", handleClick, { once: true, capture: true }), listen(button2, "click", handleClick, true), - listen(div, "touchstart", handleTouchstart, { passive: true }) + listen(div1, "touchstart", handleTouchstart, { passive: true }) ]; mounted = true; @@ -60,7 +68,7 @@ function create_fragment(ctx) { i: noop, o: noop, d(detaching) { - if (detaching) detach(div); + if (detaching) detach(div1); mounted = false; run_all(dispose); } diff --git a/test/js/samples/event-modifiers/input.svelte b/test/js/samples/event-modifiers/input.svelte index 225134f598..c72d58dabb 100644 --- a/test/js/samples/event-modifiers/input.svelte +++ b/test/js/samples/event-modifiers/input.svelte @@ -9,6 +9,7 @@
+
touch me
diff --git a/test/js/samples/hydrated-void-element/_config.js b/test/js/samples/hydrated-void-element/_config.js index 84c0d733ef..af1bf11a52 100644 --- a/test/js/samples/hydrated-void-element/_config.js +++ b/test/js/samples/hydrated-void-element/_config.js @@ -2,4 +2,4 @@ export default { options: { hydratable: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/import-meta/expected.js b/test/js/samples/import-meta/expected.js new file mode 100644 index 0000000000..ba77398321 --- /dev/null +++ b/test/js/samples/import-meta/expected.js @@ -0,0 +1,53 @@ +/* generated by Svelte vX.Y.Z */ +import { + SvelteComponent, + detach, + init, + insert, + noop, + safe_not_equal, + space, + text +} from "svelte/internal"; + +function create_fragment(ctx) { + let t0; + let t1; + let t2_value = import.meta.url + ""; + let t2; + + return { + c() { + t0 = text(/*url*/ ctx[0]); + t1 = space(); + t2 = text(t2_value); + }, + m(target, anchor) { + insert(target, t0, anchor); + insert(target, t1, anchor); + insert(target, t2, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(t0); + if (detaching) detach(t1); + if (detaching) detach(t2); + } + }; +} + +function instance($$self) { + const url = import.meta.url; + return [url]; +} + +class Component extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} + +export default Component; \ No newline at end of file diff --git a/test/js/samples/import-meta/input.svelte b/test/js/samples/import-meta/input.svelte new file mode 100644 index 0000000000..a5ce32dd77 --- /dev/null +++ b/test/js/samples/import-meta/input.svelte @@ -0,0 +1,6 @@ + + +{url} +{import.meta.url} diff --git a/test/js/samples/legacy-input-type/_config.js b/test/js/samples/legacy-input-type/_config.js index b5141be9ab..67924a4ffe 100644 --- a/test/js/samples/legacy-input-type/_config.js +++ b/test/js/samples/legacy-input-type/_config.js @@ -2,4 +2,4 @@ export default { options: { legacy: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/loop-protect/_config.js b/test/js/samples/loop-protect/_config.js index fcbf8be09b..1dc927b4da 100644 --- a/test/js/samples/loop-protect/_config.js +++ b/test/js/samples/loop-protect/_config.js @@ -1,6 +1,6 @@ export default { options: { dev: true, - loopGuardTimeout: 100, - }, + loopGuardTimeout: 100 + } }; diff --git a/test/js/samples/loop-protect/expected.js b/test/js/samples/loop-protect/expected.js index 2ee7d90f17..1042b20823 100644 --- a/test/js/samples/loop-protect/expected.js +++ b/test/js/samples/loop-protect/expected.js @@ -67,6 +67,8 @@ function foo() { } function instance($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + validate_slots("Component", slots, []); let node; { @@ -111,9 +113,6 @@ function instance($$self, $$props, $$invalidate) { if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(` was created with unknown prop '${key}'`); }); - let { $$slots = {}, $$scope } = $$props; - validate_slots("Component", $$slots, []); - function div_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { node = $$value; diff --git a/test/js/samples/src-attribute-check/_config.js b/test/js/samples/src-attribute-check/_config.js index 84c0d733ef..af1bf11a52 100644 --- a/test/js/samples/src-attribute-check/_config.js +++ b/test/js/samples/src-attribute-check/_config.js @@ -2,4 +2,4 @@ export default { options: { hydratable: true } -}; \ No newline at end of file +}; diff --git a/test/js/samples/ssr-no-oncreate-etc/_config.js b/test/js/samples/ssr-no-oncreate-etc/_config.js index 803712adec..bee4ab630c 100644 --- a/test/js/samples/ssr-no-oncreate-etc/_config.js +++ b/test/js/samples/ssr-no-oncreate-etc/_config.js @@ -2,4 +2,4 @@ export default { options: { generate: 'ssr' } -}; \ No newline at end of file +}; diff --git a/test/js/samples/ssr-no-oncreate-etc/expected.js b/test/js/samples/ssr-no-oncreate-etc/expected.js index 803f06a882..b91deb3e97 100644 --- a/test/js/samples/ssr-no-oncreate-etc/expected.js +++ b/test/js/samples/ssr-no-oncreate-etc/expected.js @@ -15,7 +15,7 @@ function swipe(node, callback) { } // TODO implement -const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { +const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => { onMount(() => { console.log("onMount"); }); diff --git a/test/js/samples/ssr-preserve-comments/expected.js b/test/js/samples/ssr-preserve-comments/expected.js index 1dc12710c0..de9fa7582e 100644 --- a/test/js/samples/ssr-preserve-comments/expected.js +++ b/test/js/samples/ssr-preserve-comments/expected.js @@ -1,7 +1,7 @@ /* generated by Svelte vX.Y.Z */ import { create_ssr_component } from "svelte/internal"; -const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { +const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => { return `
content
more content
`; diff --git a/test/js/samples/valid-inner-html-for-static-element/expected.js b/test/js/samples/valid-inner-html-for-static-element/expected.js new file mode 100644 index 0000000000..f1ced27ba4 --- /dev/null +++ b/test/js/samples/valid-inner-html-for-static-element/expected.js @@ -0,0 +1,39 @@ +/* generated by Svelte vX.Y.Z */ +import { + SvelteComponent, + detach, + element, + init, + insert, + noop, + safe_not_equal +} from "svelte/internal"; + +function create_fragment(ctx) { + let div; + + return { + c() { + div = element("div"); + div.innerHTML = `Star`; + }, + m(target, anchor) { + insert(target, div, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(div); + } + }; +} + +class Component extends SvelteComponent { + constructor(options) { + super(); + init(this, options, null, create_fragment, safe_not_equal, {}); + } +} + +export default Component; \ No newline at end of file diff --git a/test/js/samples/valid-inner-html-for-static-element/input.svelte b/test/js/samples/valid-inner-html-for-static-element/input.svelte new file mode 100644 index 0000000000..3990b2a0c2 --- /dev/null +++ b/test/js/samples/valid-inner-html-for-static-element/input.svelte @@ -0,0 +1,3 @@ +
+ Star +
\ No newline at end of file diff --git a/test/js/update.js b/test/js/update.js index fa9c834182..3e968f0e4c 100644 --- a/test/js/update.js +++ b/test/js/update.js @@ -1,13 +1,13 @@ // this file will replace all the expected.js files with their _actual // equivalents. Only use it when you're sure that you haven't // broken anything! -const fs = require("fs"); -const glob = require("tiny-glob/sync.js"); +const fs = require('fs'); +const glob = require('tiny-glob/sync.js'); -glob("samples/*/_actual.js", { cwd: __dirname }).forEach(file => { - const actual = fs.readFileSync(`${__dirname}/${file}`, "utf-8"); +glob('samples/*/_actual.js', { cwd: __dirname }).forEach(file => { + const actual = fs.readFileSync(`${__dirname}/${file}`, 'utf-8'); fs.writeFileSync( - `${__dirname}/${file.replace("_actual.js", "expected.js")}`, + `${__dirname}/${file.replace('_actual.js', 'expected.js')}`, actual ); }); diff --git a/test/motion/index.js b/test/motion/index.ts similarity index 100% rename from test/motion/index.js rename to test/motion/index.ts diff --git a/test/parser/index.js b/test/parser/index.ts similarity index 89% rename from test/parser/index.js rename to test/parser/index.ts index 2c8d516a7d..fe48737c96 100644 --- a/test/parser/index.js +++ b/test/parser/index.ts @@ -1,6 +1,6 @@ import * as assert from 'assert'; import * as fs from 'fs'; -import { svelte, tryToLoadJson, shouldUpdateExpected } from '../helpers.js'; +import { svelte, tryToLoadJson } from '../helpers'; describe('parse', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { @@ -20,7 +20,7 @@ describe('parse', () => { (skip ? it.skip : solo ? it.only : it)(dir, () => { const options = tryToLoadJson(`${__dirname}/samples/${dir}/options.json`) || {}; - const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, ""); + const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, ''); const expectedOutput = tryToLoadJson(`${__dirname}/samples/${dir}/output.json`); const expectedError = tryToLoadJson(`${__dirname}/samples/${dir}/error.json`); @@ -38,7 +38,7 @@ describe('parse', () => { } catch (err) { if (err.name !== 'ParseError') throw err; if (!expectedError) throw err; - const { code, message, pos, start } = err + const { code, message, pos, start } = err; try { assert.deepEqual({ code, message, pos, start }, expectedError); } catch (err2) { diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json new file mode 100644 index 0000000000..d24296bd96 --- /dev/null +++ b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/error.json @@ -0,0 +1,10 @@ +{ + "code": "invalid-closing-tag", + "message": "

attempted to close an element that was not open", + "pos": 38, + "start": { + "character": 38, + "column": 0, + "line": 5 + } +} diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte new file mode 100644 index 0000000000..5182577921 --- /dev/null +++ b/test/parser/samples/error-unmatched-closing-tag-autoclose-2/input.svelte @@ -0,0 +1,5 @@ +
+

+

pre tag
+
+

\ No newline at end of file diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json b/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json new file mode 100644 index 0000000000..e6532d747e --- /dev/null +++ b/test/parser/samples/error-unmatched-closing-tag-autoclose/error.json @@ -0,0 +1,10 @@ +{ + "code": "invalid-closing-tag", + "message": "

attempted to close

that was already automatically closed by

",
+	"pos": 24,
+	"start": {
+		"character": 24,
+		"column": 0,
+		"line": 3
+	}
+}
diff --git a/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte b/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte
new file mode 100644
index 0000000000..0bfd609736
--- /dev/null
+++ b/test/parser/samples/error-unmatched-closing-tag-autoclose/input.svelte
@@ -0,0 +1,3 @@
+

+

pre tag
+

\ No newline at end of file diff --git a/test/parser/samples/style-inside-head/input.svelte b/test/parser/samples/style-inside-head/input.svelte new file mode 100644 index 0000000000..512e5b2fb4 --- /dev/null +++ b/test/parser/samples/style-inside-head/input.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/parser/samples/style-inside-head/output.json b/test/parser/samples/style-inside-head/output.json new file mode 100644 index 0000000000..ae972c5fa8 --- /dev/null +++ b/test/parser/samples/style-inside-head/output.json @@ -0,0 +1,33 @@ +{ + "html": { + "start": 0, + "end": 42, + "type": "Fragment", + "children": [ + { + "start": 0, + "end": 42, + "type": "Head", + "name": "svelte:head", + "attributes": [], + "children": [ + { + "start": 13, + "end": 28, + "type": "Element", + "name": "style", + "attributes": [], + "children": [ + { + "start": 20, + "end": 20, + "type": "Text", + "data": "" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/test/parser/update.js b/test/parser/update.js deleted file mode 100644 index 0edac895b5..0000000000 --- a/test/parser/update.js +++ /dev/null @@ -1,13 +0,0 @@ -// this file will replace all the output.json files with their _actual.json -// equivalents. Only use it when you're sure that you haven't -// broken anything! -const fs = require("fs"); -const glob = require("tiny-glob/sync.js"); - -glob("samples/*/_actual.json", { cwd: __dirname }).forEach(file => { - const actual = fs.readFileSync(`${__dirname}/${file}`, "utf-8"); - fs.writeFileSync( - `${__dirname}/${file.replace("_actual.json", "output.json")}`, - actual - ); -}); diff --git a/test/parser/update.ts b/test/parser/update.ts new file mode 100644 index 0000000000..83b8cbc865 --- /dev/null +++ b/test/parser/update.ts @@ -0,0 +1,13 @@ +// this file will replace all the output.json files with their _actual.json +// equivalents. Only use it when you're sure that you haven't +// broken anything! +const fs = require('fs'); +const glob = require('tiny-glob/sync.js'); + +glob('samples/*/_actual.json', { cwd: __dirname }).forEach(file => { + const actual = fs.readFileSync(`${__dirname}/${file}`, 'utf-8'); + fs.writeFileSync( + `${__dirname}/${file.replace('_actual.json', 'output.json')}`, + actual + ); +}); diff --git a/test/preprocess/index.js b/test/preprocess/index.ts similarity index 72% rename from test/preprocess/index.js rename to test/preprocess/index.ts index 5d83bb6059..60d3acbabb 100644 --- a/test/preprocess/index.js +++ b/test/preprocess/index.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as assert from 'assert'; -import { loadConfig, svelte } from '../helpers.js'; +import { loadConfig, svelte } from '../helpers'; describe('preprocess', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { @@ -8,16 +8,21 @@ describe('preprocess', () => { const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); const solo = config.solo || /\.solo/.test(dir); + const skip = config.skip || /\.skip/.test(dir); if (solo && process.env.CI) { throw new Error('Forgot to remove `solo: true` from test'); } - (config.skip ? it.skip : solo ? it.only : it)(dir, async () => { + (skip ? it.skip : solo ? it.only : it)(dir, async () => { const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8'); const expected = fs.readFileSync(`${__dirname}/samples/${dir}/output.svelte`, 'utf-8'); - const result = await svelte.preprocess(input, config.preprocess); + const result = await svelte.preprocess( + input, + config.preprocess || {}, + config.options || { filename: 'input.svelte' } + ); fs.writeFileSync(`${__dirname}/samples/${dir}/_actual.html`, result.code); assert.equal(result.code, expected); diff --git a/test/preprocess/samples/comments/_config.js b/test/preprocess/samples/comments/_config.js index 4416d121d0..fdec377567 100644 --- a/test/preprocess/samples/comments/_config.js +++ b/test/preprocess/samples/comments/_config.js @@ -2,7 +2,7 @@ export default { preprocess: [ { script: ({ content }) => ({ code: content.replace(/one/g, 'two') }), - style: ({ content }) => ({ code: content.replace(/one/g, 'three') }), - }, - ], + style: ({ content }) => ({ code: content.replace(/one/g, 'three') }) + } + ] }; diff --git a/test/preprocess/samples/dependencies/_config.js b/test/preprocess/samples/dependencies/_config.js index fa2d8b40c9..4656cd98f9 100644 --- a/test/preprocess/samples/dependencies/_config.js +++ b/test/preprocess/samples/dependencies/_config.js @@ -12,4 +12,4 @@ export default { }, dependencies: ['./foo.css'] -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/filename/_config.js b/test/preprocess/samples/filename/_config.js index c71cdafcac..161f084730 100644 --- a/test/preprocess/samples/filename/_config.js +++ b/test/preprocess/samples/filename/_config.js @@ -1,6 +1,5 @@ export default { preprocess: { - filename: 'file.svelte', markup: ({ content, filename }) => { return { code: content.replace('__MARKUP_FILENAME__', filename) @@ -16,5 +15,8 @@ export default { code: content.replace('__SCRIPT_FILENAME__', filename) }; } + }, + options: { + filename: 'file.svelte' } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/ignores-null/_config.js b/test/preprocess/samples/ignores-null/_config.js index 042ee89aed..08ba71c748 100644 --- a/test/preprocess/samples/ignores-null/_config.js +++ b/test/preprocess/samples/ignores-null/_config.js @@ -2,4 +2,4 @@ export default { preprocess: { script: () => null } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/markup/_config.js b/test/preprocess/samples/markup/_config.js index 857da608af..13044d4132 100644 --- a/test/preprocess/samples/markup/_config.js +++ b/test/preprocess/samples/markup/_config.js @@ -6,4 +6,4 @@ export default { }; } } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/multiple-preprocessors/_config.js b/test/preprocess/samples/multiple-preprocessors/_config.js index 8a57567f6b..d6226203cc 100644 --- a/test/preprocess/samples/multiple-preprocessors/_config.js +++ b/test/preprocess/samples/multiple-preprocessors/_config.js @@ -11,4 +11,4 @@ export default { style: ({ content }) => ({ code: content.replace(/three/g, 'four') }) } ] -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/script-multiple/_config.js b/test/preprocess/samples/script-multiple/_config.js index d6656ff48e..a523efe9bc 100644 --- a/test/preprocess/samples/script-multiple/_config.js +++ b/test/preprocess/samples/script-multiple/_config.js @@ -6,4 +6,4 @@ export default { }; } } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/script-self-closing/_config.js b/test/preprocess/samples/script-self-closing/_config.js index 4baab9730e..ab87c7be1e 100644 --- a/test/preprocess/samples/script-self-closing/_config.js +++ b/test/preprocess/samples/script-self-closing/_config.js @@ -1,11 +1,11 @@ -import * as assert from "assert"; +import * as assert from 'assert'; export default { preprocess: { script: ({ content, attributes }) => { - assert.equal(content, ""); + assert.equal(content, ''); return { - code: `console.log("${attributes["the-answer"]}");` + code: `console.log("${attributes['the-answer']}");` }; } } diff --git a/test/preprocess/samples/script/_config.js b/test/preprocess/samples/script/_config.js index 8e8ac1d2f9..1a21045465 100644 --- a/test/preprocess/samples/script/_config.js +++ b/test/preprocess/samples/script/_config.js @@ -6,4 +6,4 @@ export default { }; } } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/style-async/_config.js b/test/preprocess/samples/style-async/_config.js index a91f8f4307..00298a0bfb 100644 --- a/test/preprocess/samples/style-async/_config.js +++ b/test/preprocess/samples/style-async/_config.js @@ -6,4 +6,4 @@ export default { }); } } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/style-attributes/_config.js b/test/preprocess/samples/style-attributes/_config.js index 7a619054bd..ac2955397b 100644 --- a/test/preprocess/samples/style-attributes/_config.js +++ b/test/preprocess/samples/style-attributes/_config.js @@ -11,4 +11,4 @@ export default { return { code: 'PROCESSED' }; } } -}; \ No newline at end of file +}; diff --git a/test/preprocess/samples/style-self-closing/_config.js b/test/preprocess/samples/style-self-closing/_config.js index 0a05cd3d64..af762e8da8 100644 --- a/test/preprocess/samples/style-self-closing/_config.js +++ b/test/preprocess/samples/style-self-closing/_config.js @@ -1,9 +1,9 @@ -import * as assert from "assert"; +import * as assert from 'assert'; export default { preprocess: { style: ({ content, attributes: { color } }) => { - assert.equal(content, ""); + assert.equal(content, ''); return { code: `div { color: ${color}; }` }; diff --git a/test/preprocess/samples/style/_config.js b/test/preprocess/samples/style/_config.js index 59040eccdd..19da7ea384 100644 --- a/test/preprocess/samples/style/_config.js +++ b/test/preprocess/samples/style/_config.js @@ -6,4 +6,4 @@ export default { }; } } -}; \ No newline at end of file +}; diff --git a/test/runtime/index.js b/test/runtime/index.ts similarity index 86% rename from test/runtime/index.js rename to test/runtime/index.ts index 65157196c9..153ac9dbb8 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.ts @@ -1,12 +1,12 @@ -import * as assert from "assert"; -import * as path from "path"; -import * as fs from "fs"; +import * as path from 'path'; +import * as fs from 'fs'; import { rollup } from 'rollup'; -import * as virtual from '@rollup/plugin-virtual'; -import * as glob from 'tiny-glob/sync.js'; -import { clear_loops, flush, set_now, set_raf } from "../../internal"; +import virtual from '@rollup/plugin-virtual'; +import glob from 'tiny-glob/sync.js'; +import { clear_loops, flush, set_now, set_raf } from '../../internal'; import { + assert, showOutput, loadConfig, loadSvelte, @@ -14,7 +14,7 @@ import { env, setupHtmlEqual, mkdirp -} from "../helpers.js"; +} from '../helpers'; let svelte$; let svelte; @@ -29,17 +29,17 @@ process.on('unhandledRejection', err => { unhandled_rejection = err; }); -describe("runtime", () => { +describe('runtime', () => { before(() => { svelte = loadSvelte(false); svelte$ = loadSvelte(true); - require.extensions[".svelte"] = function(module, filename) { + require.extensions['.svelte'] = function(module, filename) { const options = Object.assign({ filename }, compileOptions); - const { js: { code } } = compile(fs.readFileSync(filename, "utf-8").replace(/\r/g, ""), options); + const { js: { code } } = compile(fs.readFileSync(filename, 'utf-8').replace(/\r/g, ''), options); return module._compile(code, filename); }; @@ -50,7 +50,7 @@ describe("runtime", () => { const failed = new Set(); function runTest(dir, hydrate) { - if (dir[0] === ".") return; + if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); const solo = config.solo || /\.solo/.test(dir); @@ -58,7 +58,7 @@ describe("runtime", () => { if (hydrate && config.skip_if_hydrate) return; if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); + throw new Error('Forgot to remove `solo: true` from test'); } (config.skip ? it.skip : solo ? it.only : it)(`${dir} ${hydrate ? '(with hydration)' : ''}`, () => { @@ -103,7 +103,7 @@ describe("runtime", () => { try { const { js } = compile( - fs.readFileSync(`${cwd}/${file}`, 'utf-8').replace(/\r/g, ""), + fs.readFileSync(`${cwd}/${file}`, 'utf-8').replace(/\r/g, ''), { ...compileOptions, filename: file @@ -151,7 +151,7 @@ describe("runtime", () => { // Put things we need on window for testing window.SvelteComponent = SvelteComponent; - const target = window.document.querySelector("main"); + const target = window.document.querySelector('main'); const warnings = []; const warn = console.warn; @@ -172,14 +172,14 @@ describe("runtime", () => { if (config.error) { unintendedError = true; - throw new Error("Expected a runtime error"); + throw new Error('Expected a runtime error'); } if (config.warnings) { assert.deepEqual(warnings, config.warnings); } else if (warnings.length) { unintendedError = true; - throw new Error("Received unexpected warnings"); + throw new Error('Received unexpected warnings'); } if (config.html) { @@ -204,7 +204,7 @@ describe("runtime", () => { }); } else { component.$destroy(); - assert.htmlEqual(target.innerHTML, ""); + assert.htmlEqual(target.innerHTML, ''); if (unhandled_rejection) { throw unhandled_rejection; @@ -250,8 +250,8 @@ describe("runtime", () => { async function create_component(src = '
') { const { js } = svelte$.compile(src, { - format: "esm", - name: "SvelteComponent", + format: 'esm', + name: 'SvelteComponent', dev: true }); @@ -282,7 +282,7 @@ describe("runtime", () => { ); } - it("fails if options.target is missing in dev mode", async () => { + it('fails if options.target is missing in dev mode', async () => { const App = await create_component(); assert.throws(() => { @@ -290,7 +290,7 @@ describe("runtime", () => { }, /'target' is a required option/); }); - it("fails if options.hydrate is true but the component is non-hydratable", async () => { + it('fails if options.hydrate is true but the component is non-hydratable', async () => { const App = await create_component(); assert.throws(() => { diff --git a/test/runtime/samples/$$rest-without-props/_config.js b/test/runtime/samples/$$rest-without-props/_config.js index 017f9df561..1fb8e85a6a 100644 --- a/test/runtime/samples/$$rest-without-props/_config.js +++ b/test/runtime/samples/$$rest-without-props/_config.js @@ -11,7 +11,7 @@ export default {
`, - async test({ assert, target, window, }) { + async test({ assert, target, window }) { const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button'); const clickEvent = new window.MouseEvent('click'); diff --git a/test/runtime/samples/$$rest/_config.js b/test/runtime/samples/$$rest/_config.js index 255927f354..f00c26d712 100644 --- a/test/runtime/samples/$$rest/_config.js +++ b/test/runtime/samples/$$rest/_config.js @@ -13,7 +13,7 @@ export default { `, - async test({ assert, target, window, }) { + async test({ assert, target, window }) { const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button'); const clickEvent = new window.MouseEvent('click'); diff --git a/test/runtime/samples/$$slot/A.svelte b/test/runtime/samples/$$slot/A.svelte new file mode 100644 index 0000000000..ffa166166c --- /dev/null +++ b/test/runtime/samples/$$slot/A.svelte @@ -0,0 +1,31 @@ + + + + + +$$slots: {toString($$slots)} + +{#if $$slots.b} +
+ +
+{:else} + Slot b is not available +{/if} \ No newline at end of file diff --git a/test/runtime/samples/$$slot/_config.js b/test/runtime/samples/$$slot/_config.js new file mode 100644 index 0000000000..13b2137cdb --- /dev/null +++ b/test/runtime/samples/$$slot/_config.js @@ -0,0 +1,18 @@ +export default { + html: ` + byeworld + hello world + $$slots: {"a":true,"default":true} + Slot b is not available + + bye world + hello world + $$slots: {"a":true,"b":true,"default":true} +
hello world
+ `, + + async test({ assert, target, component }) { + assert.equal(component.getA(), ''); + assert.equal(component.getB(), 'foo'); + } +}; diff --git a/test/runtime/samples/$$slot/main.svelte b/test/runtime/samples/$$slot/main.svelte new file mode 100644 index 0000000000..8b7efae573 --- /dev/null +++ b/test/runtime/samples/$$slot/main.svelte @@ -0,0 +1,23 @@ + + + + hello world + bye + world + + + + hello world + hello world + bye world + diff --git a/test/runtime/samples/action-custom-event-handler-this/_config.js b/test/runtime/samples/action-custom-event-handler-this/_config.js index 88a30232ab..ec3fa373eb 100644 --- a/test/runtime/samples/action-custom-event-handler-this/_config.js +++ b/test/runtime/samples/action-custom-event-handler-this/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', test({ assert, component, target, window }) { const input = target.querySelector('input'); @@ -18,5 +18,5 @@ export default { input.dispatchEvent(event); assert.ok(blurred); - }, + } }; diff --git a/test/runtime/samples/action-object/_config.js b/test/runtime/samples/action-object/_config.js new file mode 100644 index 0000000000..7fdc11af2b --- /dev/null +++ b/test/runtime/samples/action-object/_config.js @@ -0,0 +1,8 @@ +export default { + html: ` + + `, + async test({ assert, target, window }) { + assert.equal(target.querySelector('button').foo, 'bar1337'); + } +}; diff --git a/test/runtime/samples/action-object/main.svelte b/test/runtime/samples/action-object/main.svelte new file mode 100644 index 0000000000..f15e319e6f --- /dev/null +++ b/test/runtime/samples/action-object/main.svelte @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/test/runtime/samples/action-ternary-template/_config.js b/test/runtime/samples/action-ternary-template/_config.js index adf23a9f68..ecb18dceec 100644 --- a/test/runtime/samples/action-ternary-template/_config.js +++ b/test/runtime/samples/action-ternary-template/_config.js @@ -1,7 +1,7 @@ export default { props: { target: 'World!', - display: true, + display: true }, html: ` @@ -16,5 +16,5 @@ export default { assert.htmlEqual(target.innerHTML, `

Hello World!

`); - }, + } }; diff --git a/test/runtime/samples/action-this/_config.js b/test/runtime/samples/action-this/_config.js index de7f834cdc..933ce993b9 100644 --- a/test/runtime/samples/action-this/_config.js +++ b/test/runtime/samples/action-this/_config.js @@ -3,9 +3,9 @@ export default { const button = target.querySelector('button'); const click = new window.MouseEvent('click'); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await button.dispatchEvent(click); await Promise.resolve(); - assert.htmlEqual(target.innerHTML, ``); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/animation-css/_config.js b/test/runtime/samples/animation-css/_config.js index 9410fb91e7..b80545de3a 100644 --- a/test/runtime/samples/animation-css/_config.js +++ b/test/runtime/samples/animation-css/_config.js @@ -54,4 +54,4 @@ export default { divs[4].style.animation ], ['', '']); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/animation-js-delay/_config.js b/test/runtime/samples/animation-js-delay/_config.js index 6bd02d17e6..931d37817b 100644 --- a/test/runtime/samples/animation-js-delay/_config.js +++ b/test/runtime/samples/animation-js-delay/_config.js @@ -57,4 +57,4 @@ export default { assert.equal(divs[0].dy, 0); assert.equal(divs[4].dy, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/animation-js-easing/_config.js b/test/runtime/samples/animation-js-easing/_config.js index 415af042a9..e466309f57 100644 --- a/test/runtime/samples/animation-js-easing/_config.js +++ b/test/runtime/samples/animation-js-easing/_config.js @@ -53,4 +53,4 @@ export default { assert.equal(divs[0].dy, 0); assert.equal(divs[4].dy, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/animation-js-easing/easing.js b/test/runtime/samples/animation-js-easing/easing.js index fecc4d96f6..6399b8858c 100644 --- a/test/runtime/samples/animation-js-easing/easing.js +++ b/test/runtime/samples/animation-js-easing/easing.js @@ -1,3 +1,3 @@ export function linear(t) { return t; -} \ No newline at end of file +} diff --git a/test/runtime/samples/animation-js/_config.js b/test/runtime/samples/animation-js/_config.js index 521753633d..5c5e874b3e 100644 --- a/test/runtime/samples/animation-js/_config.js +++ b/test/runtime/samples/animation-js/_config.js @@ -74,4 +74,4 @@ export default { assert.equal(divs[0].dy, 0); assert.equal(divs[4].dy, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/apply-directives-in-order-2/_config.js b/test/runtime/samples/apply-directives-in-order-2/_config.js index a74ce41cb6..caff97a5b9 100644 --- a/test/runtime/samples/apply-directives-in-order-2/_config.js +++ b/test/runtime/samples/apply-directives-in-order-2/_config.js @@ -1,7 +1,7 @@ const value = []; export default { props: { - value, + value }, async test({ assert, component, target, window }) { @@ -32,7 +32,7 @@ export default { '15', '16', '17', - '18', + '18' ]); - }, + } }; diff --git a/test/runtime/samples/apply-directives-in-order/_config.js b/test/runtime/samples/apply-directives-in-order/_config.js index e5e8980ed1..7c8f87ef85 100644 --- a/test/runtime/samples/apply-directives-in-order/_config.js +++ b/test/runtime/samples/apply-directives-in-order/_config.js @@ -33,5 +33,5 @@ export default {

HE

`); - }, + } }; diff --git a/test/runtime/samples/array-literal-spread-deopt/_config.js b/test/runtime/samples/array-literal-spread-deopt/_config.js index d4fdcfad85..926f462b55 100644 --- a/test/runtime/samples/array-literal-spread-deopt/_config.js +++ b/test/runtime/samples/array-literal-spread-deopt/_config.js @@ -1,3 +1,3 @@ export default { - html: `
a
b
c
` + html: '
a
b
c
' }; diff --git a/test/runtime/samples/assignment-in-init/_config.js b/test/runtime/samples/assignment-in-init/_config.js index bcf227f8e6..52428c607d 100644 --- a/test/runtime/samples/assignment-in-init/_config.js +++ b/test/runtime/samples/assignment-in-init/_config.js @@ -3,4 +3,4 @@ export default { assert.equal(component.get_foo(), 1); assert.equal(component.get_bar(), 2); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/assignment-to-computed-property/_config.js b/test/runtime/samples/assignment-to-computed-property/_config.js index 7ba090abe9..25f94c844e 100644 --- a/test/runtime/samples/assignment-to-computed-property/_config.js +++ b/test/runtime/samples/assignment-to-computed-property/_config.js @@ -2,4 +2,4 @@ export default { test({ assert, component }) { assert.deepEqual(component.foo, { baz: 1 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/attribute-boolean-case-insensitive/_config.js b/test/runtime/samples/attribute-boolean-case-insensitive/_config.js index 16e5ade6d2..99ccedb8c9 100644 --- a/test/runtime/samples/attribute-boolean-case-insensitive/_config.js +++ b/test/runtime/samples/attribute-boolean-case-insensitive/_config.js @@ -1,3 +1,3 @@ export default { - html: `` + html: '' }; diff --git a/test/runtime/samples/attribute-boolean-false/_config.js b/test/runtime/samples/attribute-boolean-false/_config.js index 14fdeb9fdc..935b709fab 100644 --- a/test/runtime/samples/attribute-boolean-false/_config.js +++ b/test/runtime/samples/attribute-boolean-false/_config.js @@ -1,7 +1,7 @@ export default { - html: ``, + html: '', test({ assert, component, target }) { const textarea = target.querySelector('textarea'); assert.ok(textarea.readOnly === false); - }, + } }; diff --git a/test/runtime/samples/attribute-boolean-indeterminate/_config.js b/test/runtime/samples/attribute-boolean-indeterminate/_config.js index 0e24f92c51..d16cb5f96b 100644 --- a/test/runtime/samples/attribute-boolean-indeterminate/_config.js +++ b/test/runtime/samples/attribute-boolean-indeterminate/_config.js @@ -18,4 +18,4 @@ export default { component.indeterminate = false; assert.ok(!input.indeterminate); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/attribute-boolean-true/_config.js b/test/runtime/samples/attribute-boolean-true/_config.js index 0e402ed1e3..ccc0814296 100644 --- a/test/runtime/samples/attribute-boolean-true/_config.js +++ b/test/runtime/samples/attribute-boolean-true/_config.js @@ -1,7 +1,7 @@ export default { - html: ``, + html: '', test({ assert, component, target }) { const textarea = target.querySelector('textarea'); assert.ok(textarea.readOnly); - }, + } }; diff --git a/test/runtime/samples/attribute-boolean-with-spread/_config.js b/test/runtime/samples/attribute-boolean-with-spread/_config.js index 270804170d..1fd2443369 100644 --- a/test/runtime/samples/attribute-boolean-with-spread/_config.js +++ b/test/runtime/samples/attribute-boolean-with-spread/_config.js @@ -1,3 +1,3 @@ export default { - html: `` + html: '' }; diff --git a/test/runtime/samples/attribute-dataset-without-value/_config.js b/test/runtime/samples/attribute-dataset-without-value/_config.js index 934f44eb06..21e60b92aa 100644 --- a/test/runtime/samples/attribute-dataset-without-value/_config.js +++ b/test/runtime/samples/attribute-dataset-without-value/_config.js @@ -1,3 +1,3 @@ export default { - html: '
', + html: '
' }; diff --git a/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js b/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js index acf3c64bdd..f1088830af 100644 --- a/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js +++ b/test/runtime/samples/attribute-dynamic-no-dependencies/_config.js @@ -1,5 +1,5 @@ export default { html: `
bar
- `, + ` }; diff --git a/test/runtime/samples/attribute-dynamic-quotemarks/_config.js b/test/runtime/samples/attribute-dynamic-quotemarks/_config.js index b9f4364624..d74a0445d2 100644 --- a/test/runtime/samples/attribute-dynamic-quotemarks/_config.js +++ b/test/runtime/samples/attribute-dynamic-quotemarks/_config.js @@ -1,3 +1,3 @@ export default { - html: `foo` + html: 'foo' }; diff --git a/test/runtime/samples/attribute-dynamic-shorthand/_config.js b/test/runtime/samples/attribute-dynamic-shorthand/_config.js index 53f474db23..ebf4dd3881 100644 --- a/test/runtime/samples/attribute-dynamic-shorthand/_config.js +++ b/test/runtime/samples/attribute-dynamic-shorthand/_config.js @@ -1,8 +1,8 @@ export default { - html: `
`, + html: '
', test({ assert, component, target }) { component.id = 'bar'; - assert.equal( target.innerHTML, `
` ); + assert.equal( target.innerHTML, '
' ); } }; diff --git a/test/runtime/samples/attribute-dynamic-type/_config.js b/test/runtime/samples/attribute-dynamic-type/_config.js index 92f6ce196d..19aa33d65e 100644 --- a/test/runtime/samples/attribute-dynamic-type/_config.js +++ b/test/runtime/samples/attribute-dynamic-type/_config.js @@ -6,7 +6,7 @@ export default { inputValue: 42 }, - html: ``, + html: '', test({ assert, component, target }) { const input = target.querySelector('input'); diff --git a/test/runtime/samples/attribute-dynamic/_config.js b/test/runtime/samples/attribute-dynamic/_config.js index 04f419145d..34323a997e 100644 --- a/test/runtime/samples/attribute-dynamic/_config.js +++ b/test/runtime/samples/attribute-dynamic/_config.js @@ -1,5 +1,5 @@ export default { - html: `
red
`, + html: '
red
', test({ assert, component, target }) { const div = target.querySelector( 'div' ); @@ -7,7 +7,7 @@ export default { assert.equal( div.style.color, 'red' ); component.color = 'blue'; - assert.equal( target.innerHTML, `
blue
` ); + assert.equal( target.innerHTML, '
blue
' ); assert.equal( div.style.color, 'blue' ); } }; diff --git a/test/runtime/samples/attribute-empty/_config.js b/test/runtime/samples/attribute-empty/_config.js index b9ce14cce1..f9aaeb39a6 100644 --- a/test/runtime/samples/attribute-empty/_config.js +++ b/test/runtime/samples/attribute-empty/_config.js @@ -1,3 +1,3 @@ export default { - html: `
` + html: '
' }; diff --git a/test/runtime/samples/attribute-false/_config.js b/test/runtime/samples/attribute-false/_config.js index 9fd08a2a48..c05d83cb3d 100644 --- a/test/runtime/samples/attribute-false/_config.js +++ b/test/runtime/samples/attribute-false/_config.js @@ -1,3 +1,3 @@ export default { - html: `
`, + html: '
' }; diff --git a/test/runtime/samples/attribute-namespaced/_config.js b/test/runtime/samples/attribute-namespaced/_config.js index f8c0cb03fb..275a198219 100644 --- a/test/runtime/samples/attribute-namespaced/_config.js +++ b/test/runtime/samples/attribute-namespaced/_config.js @@ -11,4 +11,4 @@ export default { const use = target.querySelector( 'use' ); assert.equal( use.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ), '#bar' ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/attribute-null-classname-no-style/_config.js b/test/runtime/samples/attribute-null-classname-no-style/_config.js index 4a78b680ef..6cfefc8834 100644 --- a/test/runtime/samples/attribute-null-classname-no-style/_config.js +++ b/test/runtime/samples/attribute-null-classname-no-style/_config.js @@ -1,9 +1,9 @@ export default { props: { - testName: "testClassName" + testName: 'testClassName' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); diff --git a/test/runtime/samples/attribute-null-classname-with-style/_config.js b/test/runtime/samples/attribute-null-classname-with-style/_config.js index 3ebc593b5d..d81543295e 100644 --- a/test/runtime/samples/attribute-null-classname-with-style/_config.js +++ b/test/runtime/samples/attribute-null-classname-with-style/_config.js @@ -1,5 +1,5 @@ export default { - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); diff --git a/test/runtime/samples/attribute-null-classnames-no-style/_config.js b/test/runtime/samples/attribute-null-classnames-no-style/_config.js index 917cf565c0..7281f5b637 100644 --- a/test/runtime/samples/attribute-null-classnames-no-style/_config.js +++ b/test/runtime/samples/attribute-null-classnames-no-style/_config.js @@ -1,10 +1,10 @@ export default { props: { - testName1: "test1", - testName2: "test2", + testName1: 'test1', + testName2: 'test2' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); @@ -15,11 +15,11 @@ export default { assert.equal(div.className, '0'); component.testName1 = null; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'nulltest'); component.testName1 = undefined; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'undefinedtest'); component.testName1 = undefined; diff --git a/test/runtime/samples/attribute-null-classnames-with-style/_config.js b/test/runtime/samples/attribute-null-classnames-with-style/_config.js index 5762f628fb..547e62427f 100644 --- a/test/runtime/samples/attribute-null-classnames-with-style/_config.js +++ b/test/runtime/samples/attribute-null-classnames-with-style/_config.js @@ -1,10 +1,10 @@ export default { props: { - testName1: "test1", - testName2: "test2", + testName1: 'test1', + testName2: 'test2' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); @@ -15,11 +15,11 @@ export default { assert.equal(div.className, '0 svelte-x1o6ra'); component.testName1 = null; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'nulltest svelte-x1o6ra'); component.testName1 = undefined; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'undefinedtest svelte-x1o6ra'); component.testName1 = undefined; diff --git a/test/runtime/samples/attribute-null-func-classname-no-style/_config.js b/test/runtime/samples/attribute-null-func-classname-no-style/_config.js index 4a78b680ef..6cfefc8834 100644 --- a/test/runtime/samples/attribute-null-func-classname-no-style/_config.js +++ b/test/runtime/samples/attribute-null-func-classname-no-style/_config.js @@ -1,9 +1,9 @@ export default { props: { - testName: "testClassName" + testName: 'testClassName' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); diff --git a/test/runtime/samples/attribute-null-func-classname-with-style/_config.js b/test/runtime/samples/attribute-null-func-classname-with-style/_config.js index 1ed43d05b9..435a679da7 100644 --- a/test/runtime/samples/attribute-null-func-classname-with-style/_config.js +++ b/test/runtime/samples/attribute-null-func-classname-with-style/_config.js @@ -1,9 +1,9 @@ export default { props: { - testName: "testClassName" + testName: 'testClassName' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); diff --git a/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js b/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js index 917cf565c0..7281f5b637 100644 --- a/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js +++ b/test/runtime/samples/attribute-null-func-classnames-no-style/_config.js @@ -1,10 +1,10 @@ export default { props: { - testName1: "test1", - testName2: "test2", + testName1: 'test1', + testName2: 'test2' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); @@ -15,11 +15,11 @@ export default { assert.equal(div.className, '0'); component.testName1 = null; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'nulltest'); component.testName1 = undefined; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'undefinedtest'); component.testName1 = undefined; diff --git a/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js b/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js index 5762f628fb..547e62427f 100644 --- a/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js +++ b/test/runtime/samples/attribute-null-func-classnames-with-style/_config.js @@ -1,10 +1,10 @@ export default { props: { - testName1: "test1", - testName2: "test2", + testName1: 'test1', + testName2: 'test2' }, - html: `
`, + html: '
', test({ assert, component, target }) { const div = target.querySelector('div'); @@ -15,11 +15,11 @@ export default { assert.equal(div.className, '0 svelte-x1o6ra'); component.testName1 = null; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'nulltest svelte-x1o6ra'); component.testName1 = undefined; - component.testName2 = "test"; + component.testName2 = 'test'; assert.equal(div.className, 'undefinedtest svelte-x1o6ra'); component.testName1 = undefined; diff --git a/test/runtime/samples/attribute-null/_config.js b/test/runtime/samples/attribute-null/_config.js index ae2f0a8af6..ded19eef79 100644 --- a/test/runtime/samples/attribute-null/_config.js +++ b/test/runtime/samples/attribute-null/_config.js @@ -1,3 +1,3 @@ export default { - html: `
`, + html: '
' }; diff --git a/test/runtime/samples/attribute-prefer-expression/_config.js b/test/runtime/samples/attribute-prefer-expression/_config.js index 29fcbc7f13..2388ff35df 100644 --- a/test/runtime/samples/attribute-prefer-expression/_config.js +++ b/test/runtime/samples/attribute-prefer-expression/_config.js @@ -2,7 +2,7 @@ export default { skip_if_ssr: true, props: { - foo: false, + foo: false }, test({ assert, component, target }) { @@ -15,5 +15,5 @@ export default { assert.ok(!inputs[0].checked); assert.ok(inputs[1].checked); - }, + } }; diff --git a/test/runtime/samples/attribute-static-at-symbol/_config.js b/test/runtime/samples/attribute-static-at-symbol/_config.js index 40a45579a3..0be19f091f 100644 --- a/test/runtime/samples/attribute-static-at-symbol/_config.js +++ b/test/runtime/samples/attribute-static-at-symbol/_config.js @@ -1,3 +1,3 @@ export default { - html: `email` -}; \ No newline at end of file + html: "email" +}; diff --git a/test/runtime/samples/attribute-static-boolean/_config.js b/test/runtime/samples/attribute-static-boolean/_config.js index c8b4332386..3dba036319 100644 --- a/test/runtime/samples/attribute-static-boolean/_config.js +++ b/test/runtime/samples/attribute-static-boolean/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', test({ assert, component, target }) { const textarea = target.querySelector( 'textarea' ); assert.ok( textarea.readOnly ); diff --git a/test/runtime/samples/attribute-static-quotemarks/_config.js b/test/runtime/samples/attribute-static-quotemarks/_config.js index 3d389c2273..e908052b4f 100644 --- a/test/runtime/samples/attribute-static-quotemarks/_config.js +++ b/test/runtime/samples/attribute-static-quotemarks/_config.js @@ -5,4 +5,4 @@ export default { bar ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/attribute-static/_config.js b/test/runtime/samples/attribute-static/_config.js index 5d3b9c81a8..60c3cb2fc0 100644 --- a/test/runtime/samples/attribute-static/_config.js +++ b/test/runtime/samples/attribute-static/_config.js @@ -1,3 +1,3 @@ export default { - html: `
` + html: '
' }; diff --git a/test/runtime/samples/attribute-undefined/_config.js b/test/runtime/samples/attribute-undefined/_config.js index ae2f0a8af6..ded19eef79 100644 --- a/test/runtime/samples/attribute-undefined/_config.js +++ b/test/runtime/samples/attribute-undefined/_config.js @@ -1,3 +1,3 @@ export default { - html: `
`, + html: '
' }; diff --git a/test/runtime/samples/attribute-unknown-without-value/_config.js b/test/runtime/samples/attribute-unknown-without-value/_config.js index 4f7cf1cbbf..9645e86ef4 100644 --- a/test/runtime/samples/attribute-unknown-without-value/_config.js +++ b/test/runtime/samples/attribute-unknown-without-value/_config.js @@ -1,3 +1,3 @@ export default { html: '
' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-catch-shorthand/_config.js b/test/runtime/samples/await-catch-shorthand/_config.js index 2e1574145f..fc65773107 100644 --- a/test/runtime/samples/await-catch-shorthand/_config.js +++ b/test/runtime/samples/await-catch-shorthand/_config.js @@ -9,14 +9,14 @@ export default { thePromise }, - html: ``, + html: '', test({ assert, component, target }) { fulfil(42); return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); let reject; @@ -26,7 +26,7 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); reject(new Error('something broke')); @@ -38,4 +38,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-component-oncreate/_config.js b/test/runtime/samples/await-component-oncreate/_config.js index 3cb8fa0864..1de86c9f44 100644 --- a/test/runtime/samples/await-component-oncreate/_config.js +++ b/test/runtime/samples/await-component-oncreate/_config.js @@ -13,4 +13,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-conservative-update/_config.js b/test/runtime/samples/await-conservative-update/_config.js index 4e81ff8e37..20a9448ebd 100644 --- a/test/runtime/samples/await-conservative-update/_config.js +++ b/test/runtime/samples/await-conservative-update/_config.js @@ -13,4 +13,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-conservative-update/sleep.js b/test/runtime/samples/await-conservative-update/sleep.js index 994f85f38a..be592a4ea4 100644 --- a/test/runtime/samples/await-conservative-update/sleep.js +++ b/test/runtime/samples/await-conservative-update/sleep.js @@ -8,4 +8,4 @@ export const sleep = ms => new Promise(f => { if (stopped) return; f(); }, ms); -}); \ No newline at end of file +}); diff --git a/test/runtime/samples/await-containing-if/_config.js b/test/runtime/samples/await-containing-if/_config.js index cd83585cc1..a81b040a12 100644 --- a/test/runtime/samples/await-containing-if/_config.js +++ b/test/runtime/samples/await-containing-if/_config.js @@ -24,7 +24,7 @@ export default { `); component.show = false; - assert.htmlEqual(target.innerHTML, `
`); + assert.htmlEqual(target.innerHTML, '
'); component.show = true; assert.htmlEqual(target.innerHTML, ` @@ -32,4 +32,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-in-dynamic-component/_config.js b/test/runtime/samples/await-in-dynamic-component/_config.js index 797298c554..d92757b68b 100644 --- a/test/runtime/samples/await-in-dynamic-component/_config.js +++ b/test/runtime/samples/await-in-dynamic-component/_config.js @@ -2,4 +2,4 @@ export default { test({ component }) { component.flag = false; } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-in-each/_config.js b/test/runtime/samples/await-in-each/_config.js index 6c7da69ee3..a648bbe38a 100644 --- a/test/runtime/samples/await-in-each/_config.js +++ b/test/runtime/samples/await-in-each/_config.js @@ -28,4 +28,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-in-removed-if/_config.js b/test/runtime/samples/await-in-removed-if/_config.js index 2f96f08e24..18b2ac7b74 100644 --- a/test/runtime/samples/await-in-removed-if/_config.js +++ b/test/runtime/samples/await-in-removed-if/_config.js @@ -9,7 +9,7 @@ export default { promise }, - html: ``, + html: '', async test({ assert, component, target }) { component.condition = false; @@ -17,6 +17,6 @@ export default { fulfil(); await new Promise(f => setTimeout(f, 0)); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-set-simultaneous-reactive/_config.js b/test/runtime/samples/await-set-simultaneous-reactive/_config.js index a591bf424f..0b5c0b8c74 100644 --- a/test/runtime/samples/await-set-simultaneous-reactive/_config.js +++ b/test/runtime/samples/await-set-simultaneous-reactive/_config.js @@ -1,5 +1,5 @@ export default { - html: `

wait for it...

`, + html: '

wait for it...

', test({ assert, component, target }) { return component.promise @@ -10,4 +10,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-set-simultaneous/_config.js b/test/runtime/samples/await-set-simultaneous/_config.js index f9ed64e556..fb75a9f6f0 100644 --- a/test/runtime/samples/await-set-simultaneous/_config.js +++ b/test/runtime/samples/await-set-simultaneous/_config.js @@ -6,7 +6,7 @@ export default { component.promise = promise; - assert.htmlEqual(target.innerHTML, `

wait for it...

`); + assert.htmlEqual(target.innerHTML, '

wait for it...

'); return promise .then(() => { @@ -15,4 +15,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch-event/_config.js b/test/runtime/samples/await-then-catch-event/_config.js index e42d16c4d8..0f4ce27628 100644 --- a/test/runtime/samples/await-then-catch-event/_config.js +++ b/test/runtime/samples/await-then-catch-event/_config.js @@ -42,4 +42,4 @@ export default { assert.equal(component.clicked, 43); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch-in-slot/_config.js b/test/runtime/samples/await-then-catch-in-slot/_config.js index b0600a0f27..14f3e7fdf5 100644 --- a/test/runtime/samples/await-then-catch-in-slot/_config.js +++ b/test/runtime/samples/await-then-catch-in-slot/_config.js @@ -44,4 +44,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch-multiple/_config.js b/test/runtime/samples/await-then-catch-multiple/_config.js index 2daac524a2..8d2de596df 100644 --- a/test/runtime/samples/await-then-catch-multiple/_config.js +++ b/test/runtime/samples/await-then-catch-multiple/_config.js @@ -48,4 +48,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch-no-values/_config.js b/test/runtime/samples/await-then-catch-no-values/_config.js index 2c3ce45dc1..51a79a50d0 100644 --- a/test/runtime/samples/await-then-catch-no-values/_config.js +++ b/test/runtime/samples/await-then-catch-no-values/_config.js @@ -9,14 +9,14 @@ export default { thePromise }, - html: `waiting`, + html: 'waiting', test({ assert, component, target }) { fulfil(9000); return thePromise .then(() => { - assert.htmlEqual(target.innerHTML, `resolved`); + assert.htmlEqual(target.innerHTML, 'resolved'); let reject; @@ -26,14 +26,14 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, `waiting`); + assert.htmlEqual(target.innerHTML, 'waiting'); reject(new Error('something broke')); return thePromise.catch(() => {}); }) .then(() => { - assert.htmlEqual(target.innerHTML, `rejected`); + assert.htmlEqual(target.innerHTML, 'rejected'); }); } }; diff --git a/test/runtime/samples/await-then-catch-non-promise/_config.js b/test/runtime/samples/await-then-catch-non-promise/_config.js index dbc2f5eddc..c05236cc5f 100644 --- a/test/runtime/samples/await-then-catch-non-promise/_config.js +++ b/test/runtime/samples/await-then-catch-non-promise/_config.js @@ -14,4 +14,4 @@ export default {

the value is still not a promise

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch-static/_config.js b/test/runtime/samples/await-then-catch-static/_config.js index ada0dcc75b..35fc865d44 100644 --- a/test/runtime/samples/await-then-catch-static/_config.js +++ b/test/runtime/samples/await-then-catch-static/_config.js @@ -42,4 +42,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-catch/_config.js b/test/runtime/samples/await-then-catch/_config.js index b0600a0f27..14f3e7fdf5 100644 --- a/test/runtime/samples/await-then-catch/_config.js +++ b/test/runtime/samples/await-then-catch/_config.js @@ -44,4 +44,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-destruct-object-if/_config.js b/test/runtime/samples/await-then-destruct-object-if/_config.js new file mode 100644 index 0000000000..6a29b2db37 --- /dev/null +++ b/test/runtime/samples/await-then-destruct-object-if/_config.js @@ -0,0 +1,29 @@ +export default { + props: { + thePromise: Promise.resolve({ result: 1 }) + }, + + html: '', + + async test({ assert, component, target }) { + await (component.thePromise = Promise.resolve({ result: 1 })); + + assert.htmlEqual( + target.innerHTML, + ` +

result: 1

+

count: 0

+ ` + ); + + await new Promise(resolve => setTimeout(resolve, 1)); + + assert.htmlEqual( + target.innerHTML, + ` +

result: 1

+

count: 1

+ ` + ); + } +}; diff --git a/test/runtime/samples/await-then-destruct-object-if/main.svelte b/test/runtime/samples/await-then-destruct-object-if/main.svelte new file mode 100644 index 0000000000..3425979e2c --- /dev/null +++ b/test/runtime/samples/await-then-destruct-object-if/main.svelte @@ -0,0 +1,19 @@ + + +{#await thePromise then { result }} + {#if result} +

result: {result}

+

count: {count}

+ {:else} +

result: {result}

+

count: {count}

+ {/if} +{/await} diff --git a/test/runtime/samples/await-then-destruct-object/_config.js b/test/runtime/samples/await-then-destruct-object/_config.js index 371462de97..7d08ad3711 100644 --- a/test/runtime/samples/await-then-destruct-object/_config.js +++ b/test/runtime/samples/await-then-destruct-object/_config.js @@ -8,7 +8,7 @@ export default { `, async test({ assert, component, target }) { - await (component.thePromise = Promise.resolve({ error: "error message" })); + await (component.thePromise = Promise.resolve({ error: 'error message' })); assert.htmlEqual( target.innerHTML, @@ -18,7 +18,7 @@ export default { ` ); - await (component.thePromise = Promise.resolve({ result: "42" })); + await (component.thePromise = Promise.resolve({ result: '42' })); assert.htmlEqual( target.innerHTML, @@ -30,7 +30,7 @@ export default { try { await (component.thePromise = Promise.reject({ - error: { message: "oops", code: "123" } + error: { message: 'oops', code: '123' } })); } catch (e) { // do nothing @@ -46,7 +46,7 @@ export default { try { await (component.thePromise = Promise.reject({ - error: { message: "timeout", code: "456" } + error: { message: 'timeout', code: '456' } })); } catch (e) { // do nothing diff --git a/test/runtime/samples/await-then-if/_config.js b/test/runtime/samples/await-then-if/_config.js index b26688d9f3..f9e81dd2cc 100644 --- a/test/runtime/samples/await-then-if/_config.js +++ b/test/runtime/samples/await-then-if/_config.js @@ -22,4 +22,4 @@ export default {

promise array is empty

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-then-shorthand/_config.js b/test/runtime/samples/await-then-shorthand/_config.js index 4635cf5127..ca07dd19e0 100644 --- a/test/runtime/samples/await-then-shorthand/_config.js +++ b/test/runtime/samples/await-then-shorthand/_config.js @@ -9,7 +9,7 @@ export default { thePromise }, - html: ``, + html: '', test({ assert, component, target }) { fulfil(42); @@ -28,7 +28,7 @@ export default { component.thePromise = thePromise; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); reject(new Error('something broke')); @@ -40,4 +40,4 @@ export default { `); }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/await-with-update-2/Component.svelte b/test/runtime/samples/await-with-update-2/Component.svelte new file mode 100644 index 0000000000..1301db3f99 --- /dev/null +++ b/test/runtime/samples/await-with-update-2/Component.svelte @@ -0,0 +1,7 @@ + + +
count: {count}
+
value: {value}
\ No newline at end of file diff --git a/test/runtime/samples/await-with-update-2/_config.js b/test/runtime/samples/await-with-update-2/_config.js new file mode 100644 index 0000000000..68f884c127 --- /dev/null +++ b/test/runtime/samples/await-with-update-2/_config.js @@ -0,0 +1,64 @@ +export default { + props: { + thePromise: new Promise((_) => {}), + count: 0 + }, + + html: ` +

loading...

+ `, + + async test({ assert, component, target }) { + await (component.thePromise = Promise.resolve({ value: 'success', Component: component.Component })); + + assert.htmlEqual( + target.innerHTML, + ` +
Resolved: +
count: 0
+
value: success
+
+ ` + ); + + component.count = 5; + + assert.htmlEqual( + target.innerHTML, + ` +
Resolved: +
count: 5
+
value: success
+
+ ` + ); + + try { + await (component.thePromise = Promise.reject({ value: 'failure', Component: component.Component })); + } catch (error) { + // ignore + } + + assert.htmlEqual( + target.innerHTML, + ` +
Rejected: +
count: 5
+
value: failure
+
+ ` + ); + + component.count = 10; + + assert.htmlEqual( + target.innerHTML, + ` +
Rejected: +
count: 10
+
value: failure
+
+ ` + ); + } +}; diff --git a/test/runtime/samples/await-with-update-2/main.svelte b/test/runtime/samples/await-with-update-2/main.svelte new file mode 100644 index 0000000000..b29c875f92 --- /dev/null +++ b/test/runtime/samples/await-with-update-2/main.svelte @@ -0,0 +1,16 @@ + + +
+ {#await thePromise} +

loading...

+ {:then { value: theValue, Component }} + Resolved: + {:catch { value: theError, Component } } + Rejected: + {/await} +
\ No newline at end of file diff --git a/test/runtime/samples/await-with-update/Component.svelte b/test/runtime/samples/await-with-update/Component.svelte new file mode 100644 index 0000000000..5f13c80e65 --- /dev/null +++ b/test/runtime/samples/await-with-update/Component.svelte @@ -0,0 +1,5 @@ + + +
count: {count}
\ No newline at end of file diff --git a/test/runtime/samples/await-with-update/_config.js b/test/runtime/samples/await-with-update/_config.js new file mode 100644 index 0000000000..08bf12b89e --- /dev/null +++ b/test/runtime/samples/await-with-update/_config.js @@ -0,0 +1,60 @@ +export default { + props: { + thePromise: new Promise((_) => {}), + count: 0 + }, + + html: ` +

loading...

+ `, + + async test({ assert, component, target }) { + await (component.thePromise = Promise.resolve(component.Component)); + + assert.htmlEqual( + target.innerHTML, + ` +
Resolved: +
count: 0
+
+ ` + ); + + component.count = 5; + + assert.htmlEqual( + target.innerHTML, + ` +
Resolved: +
count: 5
+
+ ` + ); + + try { + await (component.thePromise = Promise.reject(component.Component)); + } catch (error) { + // ignore + } + + assert.htmlEqual( + target.innerHTML, + ` +
Rejected: +
count: 5
+
+ ` + ); + + component.count = 10; + + assert.htmlEqual( + target.innerHTML, + ` +
Rejected: +
count: 10
+
+ ` + ); + } +}; diff --git a/test/runtime/samples/await-with-update/main.svelte b/test/runtime/samples/await-with-update/main.svelte new file mode 100644 index 0000000000..51c5b76a21 --- /dev/null +++ b/test/runtime/samples/await-with-update/main.svelte @@ -0,0 +1,16 @@ + + +
+ {#await thePromise} +

loading...

+ {:then theValue} + Resolved: + {:catch theError} + Rejected: + {/await} +
\ No newline at end of file diff --git a/test/runtime/samples/await-without-catch/_config.js b/test/runtime/samples/await-without-catch/_config.js new file mode 100644 index 0000000000..5bc291bf1f --- /dev/null +++ b/test/runtime/samples/await-without-catch/_config.js @@ -0,0 +1,45 @@ +let fulfil; + +let promise = new Promise(f => { + fulfil = f; +}); + +export default { + props: { + promise + }, + + html: ` +

loading...

+ `, + + test({ assert, component, target }) { + fulfil(42); + + return promise + .then(() => { + assert.htmlEqual(target.innerHTML, ` +

loaded

+ `); + + let reject; + + promise = new Promise((f, r) => { + reject = r; + }); + + component.promise = promise; + + assert.htmlEqual(target.innerHTML, ` +

loading...

+ `); + + reject(new Error('this error should be thrown')); + return promise; + }) + .catch((err) => { + assert.equal(err.message, 'this error should be thrown'); + assert.htmlEqual(target.innerHTML, ''); + }); + } +}; diff --git a/test/runtime/samples/await-without-catch/main.svelte b/test/runtime/samples/await-without-catch/main.svelte new file mode 100644 index 0000000000..f528a8bf69 --- /dev/null +++ b/test/runtime/samples/await-without-catch/main.svelte @@ -0,0 +1,9 @@ + + +{#await promise} +

loading...

+{:then value} +

loaded

+{/await} \ No newline at end of file diff --git a/test/runtime/samples/binding-contenteditable-html-initial/_config.js b/test/runtime/samples/binding-contenteditable-html-initial/_config.js index 9eac2c9b17..4c30a3231a 100644 --- a/test/runtime/samples/binding-contenteditable-html-initial/_config.js +++ b/test/runtime/samples/binding-contenteditable-html-initial/_config.js @@ -36,5 +36,5 @@ export default { goodbye

hello goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-contenteditable-html/_config.js b/test/runtime/samples/binding-contenteditable-html/_config.js index ceb6a75c70..639572faea 100644 --- a/test/runtime/samples/binding-contenteditable-html/_config.js +++ b/test/runtime/samples/binding-contenteditable-html/_config.js @@ -1,6 +1,6 @@ export default { props: { - name: 'world', + name: 'world' }, html: ` @@ -34,5 +34,5 @@ export default { goodbye

hello goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-contenteditable-text-initial/_config.js b/test/runtime/samples/binding-contenteditable-text-initial/_config.js index 4899f30f12..d5f331bb7a 100644 --- a/test/runtime/samples/binding-contenteditable-text-initial/_config.js +++ b/test/runtime/samples/binding-contenteditable-text-initial/_config.js @@ -30,5 +30,5 @@ export default { goodbye

hello goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-contenteditable-text/_config.js b/test/runtime/samples/binding-contenteditable-text/_config.js index 9f8645724d..89f3968258 100644 --- a/test/runtime/samples/binding-contenteditable-text/_config.js +++ b/test/runtime/samples/binding-contenteditable-text/_config.js @@ -1,6 +1,6 @@ export default { props: { - name: 'world', + name: 'world' }, html: ` @@ -28,5 +28,5 @@ export default { goodbye

hello goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-indirect-computed/_config.js b/test/runtime/samples/binding-indirect-computed/_config.js index 7519c4b0ed..68be22d1f8 100644 --- a/test/runtime/samples/binding-indirect-computed/_config.js +++ b/test/runtime/samples/binding-indirect-computed/_config.js @@ -31,4 +31,4 @@ export default { B `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/binding-indirect/_config.js b/test/runtime/samples/binding-indirect/_config.js index a0a610f43f..e0f10b94bd 100644 --- a/test/runtime/samples/binding-indirect/_config.js +++ b/test/runtime/samples/binding-indirect/_config.js @@ -87,4 +87,4 @@ export default {

shake it all about

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js index 2e3a1c296f..9d099feb0a 100644 --- a/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js +++ b/test/runtime/samples/binding-input-checkbox-indeterminate/_config.js @@ -2,7 +2,7 @@ export default { skip_if_ssr: true, props: { - indeterminate: true, + indeterminate: true }, html: ` @@ -38,5 +38,5 @@ export default {

checked? true

indeterminate? true

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js index b502ed40af..1247414c1c 100644 --- a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js +++ b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js @@ -2,14 +2,14 @@ export default { props: { cats: [ { - name: "cat 0", - checked: false, + name: 'cat 0', + checked: false }, { - name: "cat 1", - checked: false, - }, - ], + name: 'cat 1', + checked: false + } + ] }, html: ` @@ -21,8 +21,8 @@ export default { const { cats } = component; const newCats = cats.slice(); newCats.push({ - name: "cat " + cats.length, - checked: false, + name: 'cat ' + cats.length, + checked: false }); component.cats = newCats; diff --git a/test/runtime/samples/binding-input-group-duplicate-value/_config.js b/test/runtime/samples/binding-input-group-duplicate-value/_config.js index 7aea9142fa..b5f3ae0115 100644 --- a/test/runtime/samples/binding-input-group-duplicate-value/_config.js +++ b/test/runtime/samples/binding-input-group-duplicate-value/_config.js @@ -18,8 +18,8 @@ export default { `, async test({ assert, component, target, window }) { - const inputs = target.querySelectorAll("input"); - const p = target.querySelector("p"); + const inputs = target.querySelectorAll('input'); + const p = target.querySelector('p'); assert.equal(inputs[0].checked, false); assert.equal(inputs[1].checked, false); @@ -31,12 +31,12 @@ export default { assert.equal(inputs[6].checked, false); assert.equal(inputs[7].checked, false); - const event = new window.Event("change"); + const event = new window.Event('change'); inputs[0].checked = true; await inputs[0].dispatchEvent(event); - assert.htmlEqual(p.innerHTML, `Checked: a`); + assert.htmlEqual(p.innerHTML, 'Checked: a'); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); @@ -51,7 +51,7 @@ export default { inputs[3].checked = true; await inputs[3].dispatchEvent(event); - assert.htmlEqual(p.innerHTML, `Checked: a,d`); + assert.htmlEqual(p.innerHTML, 'Checked: a,d'); assert.equal(inputs[0].checked, true); assert.equal(inputs[1].checked, false); @@ -66,7 +66,7 @@ export default { inputs[4].checked = false; await inputs[4].dispatchEvent(event); - assert.htmlEqual(p.innerHTML, `Checked: d`); + assert.htmlEqual(p.innerHTML, 'Checked: d'); assert.equal(inputs[0].checked, false); assert.equal(inputs[1].checked, false); @@ -77,5 +77,5 @@ export default { assert.equal(inputs[5].checked, false); assert.equal(inputs[6].checked, false); assert.equal(inputs[7].checked, true); - }, + } }; diff --git a/test/runtime/samples/binding-input-group-each-1/_config.js b/test/runtime/samples/binding-input-group-each-1/_config.js index b0477ec705..92010296dc 100644 --- a/test/runtime/samples/binding-input-group-each-1/_config.js +++ b/test/runtime/samples/binding-input-group-each-1/_config.js @@ -7,13 +7,13 @@ const values = [ const selected_array = [ [values[1]], [], - [values[2]], + [values[2]] ]; export default { props: { values, - selected_array, + selected_array }, html: ` diff --git a/test/runtime/samples/binding-input-group-each-3/_config.js b/test/runtime/samples/binding-input-group-each-3/_config.js index b0477ec705..92010296dc 100644 --- a/test/runtime/samples/binding-input-group-each-3/_config.js +++ b/test/runtime/samples/binding-input-group-each-3/_config.js @@ -7,13 +7,13 @@ const values = [ const selected_array = [ [values[1]], [], - [values[2]], + [values[2]] ]; export default { props: { values, - selected_array, + selected_array }, html: ` diff --git a/test/runtime/samples/binding-input-group-each-6/_config.js b/test/runtime/samples/binding-input-group-each-6/_config.js new file mode 100644 index 0000000000..9eb251bf5d --- /dev/null +++ b/test/runtime/samples/binding-input-group-each-6/_config.js @@ -0,0 +1,87 @@ +export default { + html: ` + + + +

+ + + +

+ + + +

+ `, + + async test({ assert, component, target, window }) { + const inputs = target.querySelectorAll('input'); + assert.equal(inputs[0].checked, false); + assert.equal(inputs[1].checked, false); + assert.equal(inputs[2].checked, false); + + assert.equal(inputs[3].checked, false); + assert.equal(inputs[4].checked, false); + assert.equal(inputs[5].checked, false); + + assert.equal(inputs[6].checked, false); + assert.equal(inputs[7].checked, false); + assert.equal(inputs[8].checked, false); + + const event = new window.Event('change'); + + inputs[2].checked = true; + await inputs[2].dispatchEvent(event); + + assert.htmlEqual(target.innerHTML, ` + + + +

z

+ + + +

+ + + +

+ `); + + inputs[4].checked = true; + await inputs[4].dispatchEvent(event); + + assert.htmlEqual(target.innerHTML, ` + + + +

z

+ + + +

y

+ + + +

+ `); + + inputs[5].checked = true; + await inputs[5].dispatchEvent(event); + + assert.htmlEqual(target.innerHTML, ` + + + +

z

+ + + +

y, z

+ + + +

+ `); + } +}; diff --git a/test/runtime/samples/binding-input-group-each-6/main.svelte b/test/runtime/samples/binding-input-group-each-6/main.svelte new file mode 100644 index 0000000000..85be939e8a --- /dev/null +++ b/test/runtime/samples/binding-input-group-each-6/main.svelte @@ -0,0 +1,22 @@ + + +{#each Object.keys(list) as key} + {#each values as value} + + {/each} +

{list[key].join(', ')}

+{/each} diff --git a/test/runtime/samples/binding-input-number-2/_config.js b/test/runtime/samples/binding-input-number-2/_config.js index a3510eb757..4411eac0b2 100644 --- a/test/runtime/samples/binding-input-number-2/_config.js +++ b/test/runtime/samples/binding-input-number-2/_config.js @@ -1,31 +1,31 @@ export default { test({ assert, target, window, component }) { - const input = target.querySelector("input"); - const inputEvent = new window.InputEvent("input"); + const input = target.querySelector('input'); + const inputEvent = new window.InputEvent('input'); assert.equal(component.value, 5); - assert.equal(input.value, "5"); + assert.equal(input.value, '5'); - input.value = "5."; + input.value = '5.'; input.dispatchEvent(inputEvent); // input type number has value === "" if ends with dot/comma assert.equal(component.value, undefined); - assert.equal(input.value, ""); + assert.equal(input.value, ''); - input.value = "5.5"; + input.value = '5.5'; input.dispatchEvent(inputEvent); assert.equal(component.value, 5.5); - assert.equal(input.value, "5.5"); + assert.equal(input.value, '5.5'); - input.value = "5.50"; + input.value = '5.50'; input.dispatchEvent(inputEvent); assert.equal(component.value, 5.5); - assert.equal(input.value, "5.50"); + assert.equal(input.value, '5.50'); component.value = 1; assert.equal(component.value, 1); - assert.equal(input.value, "1"); - }, + assert.equal(input.value, '1'); + } }; diff --git a/test/runtime/samples/binding-input-number/_config.js b/test/runtime/samples/binding-input-number/_config.js index 869b9f9896..1a56a75c0c 100644 --- a/test/runtime/samples/binding-input-number/_config.js +++ b/test/runtime/samples/binding-input-number/_config.js @@ -1,6 +1,6 @@ export default { props: { - count: 42, + count: 42 }, html: ` @@ -35,14 +35,14 @@ export default {

number 44

`); - // empty string should be treated as undefined + // empty string should be treated as null input.value = ''; await input.dispatchEvent(event); - assert.equal(component.count, undefined); + assert.equal(component.count, null); assert.htmlEqual(target.innerHTML, ` -

undefined undefined

+

object null

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-range-change-with-max/_config.js b/test/runtime/samples/binding-input-range-change-with-max/_config.js index 1fda90d83c..dc3cf4ce28 100644 --- a/test/runtime/samples/binding-input-range-change-with-max/_config.js +++ b/test/runtime/samples/binding-input-range-change-with-max/_config.js @@ -29,5 +29,5 @@ export default {

20 of 20

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-range-change/_config.js b/test/runtime/samples/binding-input-range-change/_config.js index 62e9562770..f6ec2d9c53 100644 --- a/test/runtime/samples/binding-input-range-change/_config.js +++ b/test/runtime/samples/binding-input-range-change/_config.js @@ -1,6 +1,6 @@ export default { props: { - count: 42, + count: 42 }, html: ` @@ -34,5 +34,5 @@ export default {

number 44

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-range/_config.js b/test/runtime/samples/binding-input-range/_config.js index 4c3d37a667..dc6178e088 100644 --- a/test/runtime/samples/binding-input-range/_config.js +++ b/test/runtime/samples/binding-input-range/_config.js @@ -1,6 +1,6 @@ export default { props: { - count: 42, + count: 42 }, html: ` @@ -34,5 +34,5 @@ export default {

number 44

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js index 28cffdfa57..de4d6325b0 100644 --- a/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-deconflicted/_config.js @@ -1,7 +1,7 @@ export default { props: { foo: 'a', - items: ['x'], + items: ['x'] }, html: ` @@ -32,5 +32,5 @@ export default {

b

y

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js index 6fdfc4be52..a1584c18b8 100644 --- a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js @@ -121,5 +121,5 @@ export default {

done:one / done:two / remaining:four

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-contextual/_config.js b/test/runtime/samples/binding-input-text-contextual/_config.js index bb7f16c8bb..1c66ea7ff5 100644 --- a/test/runtime/samples/binding-input-text-contextual/_config.js +++ b/test/runtime/samples/binding-input-text-contextual/_config.js @@ -1,6 +1,6 @@ export default { props: { - items: ['one', 'two', 'three'], + items: ['one', 'two', 'three'] }, html: ` @@ -65,5 +65,5 @@ export default {

five

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deconflicted/_config.js b/test/runtime/samples/binding-input-text-deconflicted/_config.js index 46fe3e2a38..48a7d2590a 100644 --- a/test/runtime/samples/binding-input-text-deconflicted/_config.js +++ b/test/runtime/samples/binding-input-text-deconflicted/_config.js @@ -1,8 +1,8 @@ export default { props: { component: { - name: 'world', - }, + name: 'world' + } }, html: ` @@ -36,5 +36,5 @@ export default {

Hello goodbye!

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js b/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js index eeecdb0ef8..0afbb9d952 100644 --- a/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js +++ b/test/runtime/samples/binding-input-text-deep-computed-dynamic/_config.js @@ -4,8 +4,8 @@ export default { obj: { foo: 'a', bar: 'b', - baz: 'c', - }, + baz: 'c' + } }, html: ` @@ -56,5 +56,5 @@ export default {
{"foo":"d","bar":"e","baz":"f"}
`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deep-computed/_config.js b/test/runtime/samples/binding-input-text-deep-computed/_config.js index a1ea2c34ad..3a85d50d76 100644 --- a/test/runtime/samples/binding-input-text-deep-computed/_config.js +++ b/test/runtime/samples/binding-input-text-deep-computed/_config.js @@ -2,8 +2,8 @@ export default { props: { prop: 'name', user: { - name: 'alice', - }, + name: 'alice' + } }, html: ` @@ -40,5 +40,5 @@ export default {

hello carol

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js b/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js index 364195233d..627ef5f15e 100644 --- a/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js +++ b/test/runtime/samples/binding-input-text-deep-contextual-computed-dynamic/_config.js @@ -5,9 +5,9 @@ export default { { foo: 'a', bar: 'b', - baz: 'c', - }, - ], + baz: 'c' + } + ] }, html: ` @@ -58,5 +58,5 @@ export default {
{"foo":"d","bar":"e","baz":"f"}
`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deep-contextual/_config.js b/test/runtime/samples/binding-input-text-deep-contextual/_config.js index 5b6b0d6577..cc80d38042 100644 --- a/test/runtime/samples/binding-input-text-deep-contextual/_config.js +++ b/test/runtime/samples/binding-input-text-deep-contextual/_config.js @@ -3,8 +3,8 @@ export default { items: [ { description: 'one' }, { description: 'two' }, - { description: 'three' }, - ], + { description: 'three' } + ] }, html: ` @@ -45,5 +45,5 @@ export default {

four

five

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-deep/_config.js b/test/runtime/samples/binding-input-text-deep/_config.js index e6113510a7..35443e9073 100644 --- a/test/runtime/samples/binding-input-text-deep/_config.js +++ b/test/runtime/samples/binding-input-text-deep/_config.js @@ -1,8 +1,8 @@ export default { props: { user: { - name: 'alice', - }, + name: 'alice' + } }, html: ` @@ -39,5 +39,5 @@ export default {

hello carol

`); - }, + } }; diff --git a/test/runtime/samples/binding-input-text-undefined/_config.js b/test/runtime/samples/binding-input-text-undefined/_config.js index 009e1b37ba..fa59b1f796 100644 --- a/test/runtime/samples/binding-input-text-undefined/_config.js +++ b/test/runtime/samples/binding-input-text-undefined/_config.js @@ -26,5 +26,5 @@ export default { component.x = undefined; assert.equal(input.value, ''); - }, + } }; diff --git a/test/runtime/samples/binding-input-text/_config.js b/test/runtime/samples/binding-input-text/_config.js index e7162b6153..52d8e44902 100644 --- a/test/runtime/samples/binding-input-text/_config.js +++ b/test/runtime/samples/binding-input-text/_config.js @@ -1,6 +1,6 @@ export default { props: { - name: 'world', + name: 'world' }, html: ` @@ -33,5 +33,5 @@ export default {

hello goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-select-in-yield/_config.js b/test/runtime/samples/binding-select-in-yield/_config.js index 11dcb3d58c..042fba832b 100644 --- a/test/runtime/samples/binding-select-in-yield/_config.js +++ b/test/runtime/samples/binding-select-in-yield/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', props: { letter: 'b' diff --git a/test/runtime/samples/binding-select-initial-value/_config.js b/test/runtime/samples/binding-select-initial-value/_config.js index d98e5d2e1c..d34a987fa5 100644 --- a/test/runtime/samples/binding-select-initial-value/_config.js +++ b/test/runtime/samples/binding-select-initial-value/_config.js @@ -24,7 +24,7 @@ export default { `, props: { - selected: 'b', + selected: 'b' }, test({ assert, component, target }) { @@ -33,5 +33,5 @@ export default { assert.equal(select.value, 'b'); assert.ok(options[1].selected); - }, + } }; diff --git a/test/runtime/samples/binding-select-optgroup/_config.js b/test/runtime/samples/binding-select-optgroup/_config.js index e8a1d40797..03ad3e3280 100644 --- a/test/runtime/samples/binding-select-optgroup/_config.js +++ b/test/runtime/samples/binding-select-optgroup/_config.js @@ -45,5 +45,5 @@ export default { `); - }, + } }; diff --git a/test/runtime/samples/binding-select/_config.js b/test/runtime/samples/binding-select/_config.js index a5995061a0..310315176b 100644 --- a/test/runtime/samples/binding-select/_config.js +++ b/test/runtime/samples/binding-select/_config.js @@ -24,7 +24,7 @@ export default { `, props: { - selected: 'one', + selected: 'one' }, async test({ assert, component, target, window }) { @@ -53,5 +53,5 @@ export default { `); component.selected = 'three'; - }, + } }; diff --git a/test/runtime/samples/binding-store-deep/_config.js b/test/runtime/samples/binding-store-deep/_config.js index 8bdd41818b..c0f4f63578 100644 --- a/test/runtime/samples/binding-store-deep/_config.js +++ b/test/runtime/samples/binding-store-deep/_config.js @@ -37,5 +37,5 @@ export default { assert.deepEqual(names, ['world', 'everybody', 'goodbye']); unsubscribe(); - }, + } }; diff --git a/test/runtime/samples/binding-store/_config.js b/test/runtime/samples/binding-store/_config.js index eb22d3e96c..6e7a70878a 100644 --- a/test/runtime/samples/binding-store/_config.js +++ b/test/runtime/samples/binding-store/_config.js @@ -37,5 +37,5 @@ export default { assert.deepEqual(names, ['world', 'everybody', 'goodbye']); unsubscribe(); - }, + } }; diff --git a/test/runtime/samples/binding-textarea/_config.js b/test/runtime/samples/binding-textarea/_config.js index ac092096e6..70646e5e4b 100644 --- a/test/runtime/samples/binding-textarea/_config.js +++ b/test/runtime/samples/binding-textarea/_config.js @@ -1,6 +1,6 @@ export default { props: { - value: 'some text', + value: 'some text' }, html: ` @@ -33,5 +33,5 @@ export default {

goodbye

`); - }, + } }; diff --git a/test/runtime/samples/binding-this-each-block-property-2/_config.js b/test/runtime/samples/binding-this-each-block-property-2/_config.js index eebd754fca..b67d27050e 100644 --- a/test/runtime/samples/binding-this-each-block-property-2/_config.js +++ b/test/runtime/samples/binding-this-each-block-property-2/_config.js @@ -3,9 +3,9 @@ function callback(refs) { calls.push(refs.map(({ ref }) => ({ ref }))); } export default { - html: ``, + html: '', props: { - callback, + callback }, after_test() { calls = []; @@ -16,7 +16,7 @@ export default { await component.addItem(); - let divs = target.querySelectorAll("div"); + let divs = target.querySelectorAll('div'); assert.equal(calls.length, 3); assert.equal(calls[1].length, 1); @@ -26,7 +26,7 @@ export default { await component.addItem(); - divs = target.querySelectorAll("div"); + divs = target.querySelectorAll('div'); assert.equal(calls.length, 5); assert.equal(calls[3].length, 2); @@ -38,7 +38,7 @@ export default { await component.addItem(); - divs = target.querySelectorAll("div"); + divs = target.querySelectorAll('div'); assert.equal(calls.length, 7); assert.equal(calls[5].length, 3); @@ -49,5 +49,5 @@ export default { assert.equal(calls[6][0].ref, divs[0]); assert.equal(calls[6][1].ref, divs[1]); assert.equal(calls[6][2].ref, divs[2]); - }, + } }; diff --git a/test/runtime/samples/binding-this-each-block-property-component/_config.js b/test/runtime/samples/binding-this-each-block-property-component/_config.js index 947ec17929..3346888555 100644 --- a/test/runtime/samples/binding-this-each-block-property-component/_config.js +++ b/test/runtime/samples/binding-this-each-block-property-component/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target }) { component.visible = true; diff --git a/test/runtime/samples/binding-this-each-block-property/_config.js b/test/runtime/samples/binding-this-each-block-property/_config.js index 15ad4be5db..bb24bcc0bf 100644 --- a/test/runtime/samples/binding-this-each-block-property/_config.js +++ b/test/runtime/samples/binding-this-each-block-property/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target }) { component.visible = true; diff --git a/test/runtime/samples/binding-this-each-object-props/_config.js b/test/runtime/samples/binding-this-each-object-props/_config.js index 5372667b82..e9ec7d90f0 100644 --- a/test/runtime/samples/binding-this-each-object-props/_config.js +++ b/test/runtime/samples/binding-this-each-object-props/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target }) { component.visible = true; diff --git a/test/runtime/samples/binding-this-each-object-spread/_config.js b/test/runtime/samples/binding-this-each-object-spread/_config.js index cecec08db9..e88ebe8de5 100644 --- a/test/runtime/samples/binding-this-each-object-spread/_config.js +++ b/test/runtime/samples/binding-this-each-object-spread/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target }) { component.visible = true; diff --git a/test/runtime/samples/binding-this-store/_config.js b/test/runtime/samples/binding-this-store/_config.js index f818c2e31e..32bc9c4ce9 100644 --- a/test/runtime/samples/binding-this-store/_config.js +++ b/test/runtime/samples/binding-this-store/_config.js @@ -1,4 +1,4 @@ export default { skip_if_ssr: true, - html: `
object
` + html: '
object
' }; diff --git a/test/runtime/samples/binding-using-props/_config.js b/test/runtime/samples/binding-using-props/_config.js index dcb34c4357..2e5fef1f4f 100644 --- a/test/runtime/samples/binding-using-props/_config.js +++ b/test/runtime/samples/binding-using-props/_config.js @@ -11,4 +11,4 @@ export default {

changed

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/binding-width-height-a11y/_config.js b/test/runtime/samples/binding-width-height-a11y/_config.js index 93856bf0f6..198051e6d2 100644 --- a/test/runtime/samples/binding-width-height-a11y/_config.js +++ b/test/runtime/samples/binding-width-height-a11y/_config.js @@ -2,7 +2,7 @@ export default { async test({ assert, target }) { const iframe = target.querySelector('iframe'); - assert.equal(iframe.getAttribute('aria-hidden'), "true"); - assert.equal(iframe.getAttribute('tabindex'), "-1"); + assert.equal(iframe.getAttribute('aria-hidden'), 'true'); + assert.equal(iframe.getAttribute('tabindex'), '-1'); } }; diff --git a/test/runtime/samples/bindings-before-onmount/_config.js b/test/runtime/samples/bindings-before-onmount/_config.js index d21751c528..1d2ac64fe8 100644 --- a/test/runtime/samples/bindings-before-onmount/_config.js +++ b/test/runtime/samples/bindings-before-onmount/_config.js @@ -2,4 +2,4 @@ export default { test({ assert, component }) { assert.equal(component.one.snapshot, 2); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bindings-coalesced/_config.js b/test/runtime/samples/bindings-coalesced/_config.js index 164d0b42e7..14ffd3ed89 100644 --- a/test/runtime/samples/bindings-coalesced/_config.js +++ b/test/runtime/samples/bindings-coalesced/_config.js @@ -14,4 +14,4 @@ export default { assert.deepEqual(values, ['6']); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bindings-global-dependency/_config.js b/test/runtime/samples/bindings-global-dependency/_config.js index f5ab04de78..1180424e81 100644 --- a/test/runtime/samples/bindings-global-dependency/_config.js +++ b/test/runtime/samples/bindings-global-dependency/_config.js @@ -1,3 +1,3 @@ export default { html: '' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-2/_config.js b/test/runtime/samples/bitmask-overflow-2/_config.js index 0b63791292..781c493245 100644 --- a/test/runtime/samples/bitmask-overflow-2/_config.js +++ b/test/runtime/samples/bitmask-overflow-2/_config.js @@ -1,3 +1,3 @@ export default { - error: `potato is not defined`, -}; \ No newline at end of file + error: 'potato is not defined' +}; diff --git a/test/runtime/samples/bitmask-overflow-3/_config.js b/test/runtime/samples/bitmask-overflow-3/_config.js index aee7d3237e..bd415bfd49 100644 --- a/test/runtime/samples/bitmask-overflow-3/_config.js +++ b/test/runtime/samples/bitmask-overflow-3/_config.js @@ -1,3 +1,3 @@ export default { - error: `A is not defined`, -}; \ No newline at end of file + error: 'A is not defined' +}; diff --git a/test/runtime/samples/bitmask-overflow-if/_config.js b/test/runtime/samples/bitmask-overflow-if/_config.js index 74bc70d414..49f48925c5 100644 --- a/test/runtime/samples/bitmask-overflow-if/_config.js +++ b/test/runtime/samples/bitmask-overflow-if/_config.js @@ -7,8 +7,8 @@ export default { `, async test({ assert, component, target, window }) { - const button = target.querySelector("button"); - await button.dispatchEvent(new window.MouseEvent("click")); + const button = target.querySelector('button'); + await button.dispatchEvent(new window.MouseEvent('click')); assert.htmlEqual( target.innerHTML, diff --git a/test/runtime/samples/bitmask-overflow-slot-2/_config.js b/test/runtime/samples/bitmask-overflow-slot-2/_config.js index b01bd81e00..1f9613711a 100644 --- a/test/runtime/samples/bitmask-overflow-slot-2/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-2/_config.js @@ -90,7 +90,7 @@ export default { assert.deepEqual(component.reads, { _0: 2, - _1: 2, + _1: 2 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-slot-3/_config.js b/test/runtime/samples/bitmask-overflow-slot-3/_config.js index 93e548e5f7..7921253e18 100644 --- a/test/runtime/samples/bitmask-overflow-slot-3/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-3/_config.js @@ -27,4 +27,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-slot-4/_config.js b/test/runtime/samples/bitmask-overflow-slot-4/_config.js index cdaa5de77f..5aa339afd6 100644 --- a/test/runtime/samples/bitmask-overflow-slot-4/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-4/_config.js @@ -38,4 +38,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-slot-5/_config.js b/test/runtime/samples/bitmask-overflow-slot-5/_config.js index 7dedb8f7eb..80900d0042 100644 --- a/test/runtime/samples/bitmask-overflow-slot-5/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-5/_config.js @@ -46,4 +46,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-slot-6/_config.js b/test/runtime/samples/bitmask-overflow-slot-6/_config.js index 8cd8c07a65..7cf7538b69 100644 --- a/test/runtime/samples/bitmask-overflow-slot-6/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot-6/_config.js @@ -29,4 +29,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow-slot/_config.js b/test/runtime/samples/bitmask-overflow-slot/_config.js index 9b24d5541f..a14ef3270f 100644 --- a/test/runtime/samples/bitmask-overflow-slot/_config.js +++ b/test/runtime/samples/bitmask-overflow-slot/_config.js @@ -121,4 +121,4 @@ export default { _40: 1 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/bitmask-overflow/_config.js b/test/runtime/samples/bitmask-overflow/_config.js index ada3195c81..e5e54ac10e 100644 --- a/test/runtime/samples/bitmask-overflow/_config.js +++ b/test/runtime/samples/bitmask-overflow/_config.js @@ -119,4 +119,4 @@ export default { _40: 1 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/class-boolean/_config.js b/test/runtime/samples/class-boolean/_config.js index a5003566cc..ac02a1a425 100644 --- a/test/runtime/samples/class-boolean/_config.js +++ b/test/runtime/samples/class-boolean/_config.js @@ -1,3 +1,3 @@ export default { - html: `
` + html: '
' }; diff --git a/test/runtime/samples/class-helper/_config.js b/test/runtime/samples/class-helper/_config.js index c38cc88240..6a62476493 100644 --- a/test/runtime/samples/class-helper/_config.js +++ b/test/runtime/samples/class-helper/_config.js @@ -3,7 +3,7 @@ export default { user: { active: true } }, - html: `
`, + html: '
', test({ assert, component, target }) { component.user = { active: false }; diff --git a/test/runtime/samples/class-shortcut-with-class/_config.js b/test/runtime/samples/class-shortcut-with-class/_config.js index fc1a00e8aa..6d647e8f9d 100644 --- a/test/runtime/samples/class-shortcut-with-class/_config.js +++ b/test/runtime/samples/class-shortcut-with-class/_config.js @@ -5,7 +5,7 @@ export default { myClass: 'one two' }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.foo = false; diff --git a/test/runtime/samples/class-shortcut/_config.js b/test/runtime/samples/class-shortcut/_config.js index e0c8aec3a5..aba7e0e031 100644 --- a/test/runtime/samples/class-shortcut/_config.js +++ b/test/runtime/samples/class-shortcut/_config.js @@ -4,7 +4,7 @@ export default { bar: true }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.foo = false; diff --git a/test/runtime/samples/class-with-attribute/_config.js b/test/runtime/samples/class-with-attribute/_config.js index 719e6bd473..7550b215ab 100644 --- a/test/runtime/samples/class-with-attribute/_config.js +++ b/test/runtime/samples/class-with-attribute/_config.js @@ -1,3 +1,3 @@ export default { - html: `
` + html: '
' }; diff --git a/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js index 58ccc76497..f704e9327f 100644 --- a/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js +++ b/test/runtime/samples/class-with-dynamic-attribute-and-spread/_config.js @@ -6,7 +6,7 @@ export default { } }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.myClass = 'one'; diff --git a/test/runtime/samples/class-with-dynamic-attribute/_config.js b/test/runtime/samples/class-with-dynamic-attribute/_config.js index 12c955c24d..2be6500674 100644 --- a/test/runtime/samples/class-with-dynamic-attribute/_config.js +++ b/test/runtime/samples/class-with-dynamic-attribute/_config.js @@ -3,7 +3,7 @@ export default { myClass: 'one two' }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.myClass = 'one'; diff --git a/test/runtime/samples/class-with-spread-and-bind/_config.js b/test/runtime/samples/class-with-spread-and-bind/_config.js index f3c54e8c52..7b50502f34 100644 --- a/test/runtime/samples/class-with-spread-and-bind/_config.js +++ b/test/runtime/samples/class-with-spread-and-bind/_config.js @@ -1,9 +1,9 @@ export default { props: { - primary: true, + primary: true }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.primary = true; @@ -14,5 +14,5 @@ export default {
` ); - }, + } }; diff --git a/test/runtime/samples/class-with-spread/_config.js b/test/runtime/samples/class-with-spread/_config.js index d5233a5849..c7c85e38b0 100644 --- a/test/runtime/samples/class-with-spread/_config.js +++ b/test/runtime/samples/class-with-spread/_config.js @@ -6,7 +6,7 @@ export default { } }, - html: `
`, + html: '
', test({ assert, component, target, window }) { component.myClass = 'one'; diff --git a/test/runtime/samples/component-binding-deep/_config.js b/test/runtime/samples/component-binding-deep/_config.js index be5a2624ac..8a2f5a56cf 100644 --- a/test/runtime/samples/component-binding-deep/_config.js +++ b/test/runtime/samples/component-binding-deep/_config.js @@ -21,5 +21,5 @@ export default {

blah

`); - }, + } }; diff --git a/test/runtime/samples/component-binding-store/_config.js b/test/runtime/samples/component-binding-store/_config.js index 4dec41459f..d17b9e2d80 100644 --- a/test/runtime/samples/component-binding-store/_config.js +++ b/test/runtime/samples/component-binding-store/_config.js @@ -11,10 +11,10 @@ export default { count++; }; - const [input1, input2] = target.querySelectorAll("input"); + const [input1, input2] = target.querySelectorAll('input'); - input1.value = "1"; - await input1.dispatchEvent(new window.Event("input")); + input1.value = '1'; + await input1.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -24,12 +24,12 @@ export default {
1
` ); - assert.equal(input1.value, "1"); - assert.equal(input2.value, "1"); + assert.equal(input1.value, '1'); + assert.equal(input2.value, '1'); assert.equal(count, 1); - input2.value = "123"; - await input2.dispatchEvent(new window.Event("input")); + input2.value = '123'; + await input2.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -39,12 +39,12 @@ export default {
123
` ); - assert.equal(input1.value, "123"); - assert.equal(input2.value, "123"); + assert.equal(input1.value, '123'); + assert.equal(input2.value, '123'); assert.equal(count, 2); - input1.value = "456"; - await input1.dispatchEvent(new window.Event("input")); + input1.value = '456'; + await input1.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -54,8 +54,8 @@ export default {
456
` ); - assert.equal(input1.value, "456"); - assert.equal(input2.value, "456"); + assert.equal(input1.value, '456'); + assert.equal(input2.value, '456'); assert.equal(count, 3); - }, + } }; diff --git a/test/runtime/samples/component-data-dynamic-shorthand/_config.js b/test/runtime/samples/component-data-dynamic-shorthand/_config.js index 80e8731dc5..779966d4aa 100644 --- a/test/runtime/samples/component-data-dynamic-shorthand/_config.js +++ b/test/runtime/samples/component-data-dynamic-shorthand/_config.js @@ -3,11 +3,11 @@ export default { foo: 42 }, - html: `

foo: 42

`, + html: '

foo: 42

', test({ assert, component, target }) { component.foo = 99; - assert.equal( target.innerHTML, `

foo: 99

` ); + assert.equal( target.innerHTML, '

foo: 99

' ); } }; diff --git a/test/runtime/samples/component-data-empty/_config.js b/test/runtime/samples/component-data-empty/_config.js index eaf16a72af..486827f398 100644 --- a/test/runtime/samples/component-data-empty/_config.js +++ b/test/runtime/samples/component-data-empty/_config.js @@ -1,3 +1,3 @@ export default { - html: `

foo: ''

` + html: "

foo: ''

" }; diff --git a/test/runtime/samples/component-data-static-boolean-regression/_config.js b/test/runtime/samples/component-data-static-boolean-regression/_config.js index 61f8ba0a06..93d0f1165c 100644 --- a/test/runtime/samples/component-data-static-boolean-regression/_config.js +++ b/test/runtime/samples/component-data-static-boolean-regression/_config.js @@ -1,3 +1,3 @@ export default { - html: `link` + html: "link" }; diff --git a/test/runtime/samples/component-data-static-boolean/_config.js b/test/runtime/samples/component-data-static-boolean/_config.js index aaaf3de630..7253644c64 100644 --- a/test/runtime/samples/component-data-static-boolean/_config.js +++ b/test/runtime/samples/component-data-static-boolean/_config.js @@ -1,3 +1,3 @@ export default { - html: `

x: true (boolean)

` + html: '

x: true (boolean)

' }; diff --git a/test/runtime/samples/component-event-not-stale/_config.js b/test/runtime/samples/component-event-not-stale/_config.js index 912ea1f7d0..7951afb9d5 100644 --- a/test/runtime/samples/component-event-not-stale/_config.js +++ b/test/runtime/samples/component-event-not-stale/_config.js @@ -1,6 +1,6 @@ export default { props: { - value: 1, + value: 1 }, test({ assert, component, target, window }) { @@ -26,5 +26,5 @@ export default { { value: 2 }, { value: 2 } ]); - }, + } }; diff --git a/test/runtime/samples/component-events-console/_config.js b/test/runtime/samples/component-events-console/_config.js index b800749785..39ccbd719f 100644 --- a/test/runtime/samples/component-events-console/_config.js +++ b/test/runtime/samples/component-events-console/_config.js @@ -21,5 +21,5 @@ export default { } console.log = log; - }, + } }; diff --git a/test/runtime/samples/component-name-deconflicted-globals/_config.js b/test/runtime/samples/component-name-deconflicted-globals/_config.js index 842b6a3a11..66d1d1a8f1 100644 --- a/test/runtime/samples/component-name-deconflicted-globals/_config.js +++ b/test/runtime/samples/component-name-deconflicted-globals/_config.js @@ -2,4 +2,4 @@ export default { preserveIdentifiers: true, error: 'Countdown is not defined' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/component-name-deconflicted/_config.js b/test/runtime/samples/component-name-deconflicted/_config.js index 97ea2290b6..5813042745 100644 --- a/test/runtime/samples/component-name-deconflicted/_config.js +++ b/test/runtime/samples/component-name-deconflicted/_config.js @@ -12,4 +12,4 @@ export default { 4 `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/component-namespace/Tooltip.svelte b/test/runtime/samples/component-namespace/Tooltip.svelte new file mode 100644 index 0000000000..9b44ef57a8 --- /dev/null +++ b/test/runtime/samples/component-namespace/Tooltip.svelte @@ -0,0 +1 @@ +

i am a widget

\ No newline at end of file diff --git a/test/runtime/samples/component-namespace/Widget.svelte b/test/runtime/samples/component-namespace/Widget.svelte new file mode 100644 index 0000000000..b6aa45c6a8 --- /dev/null +++ b/test/runtime/samples/component-namespace/Widget.svelte @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-namespace/_config.js b/test/runtime/samples/component-namespace/_config.js new file mode 100644 index 0000000000..5b96ac8df0 --- /dev/null +++ b/test/runtime/samples/component-namespace/_config.js @@ -0,0 +1,3 @@ +export default { + html: '

i am a widget

' +}; diff --git a/test/runtime/samples/component-namespace/main.svelte b/test/runtime/samples/component-namespace/main.svelte new file mode 100644 index 0000000000..3f53b2b1c8 --- /dev/null +++ b/test/runtime/samples/component-namespace/main.svelte @@ -0,0 +1,8 @@ + + +{#each widgets as LazyWidget} + +{/each} \ No newline at end of file diff --git a/test/runtime/samples/component-namespaced/_config.js b/test/runtime/samples/component-namespaced/_config.js index b91795d6c8..35a5e46d47 100644 --- a/test/runtime/samples/component-namespaced/_config.js +++ b/test/runtime/samples/component-namespaced/_config.js @@ -19,4 +19,4 @@ export default {

foo 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/component-namespaced/components.js b/test/runtime/samples/component-namespaced/components.js index 832d2412ee..7dcfcf157c 100644 --- a/test/runtime/samples/component-namespaced/components.js +++ b/test/runtime/samples/component-namespaced/components.js @@ -1,3 +1,3 @@ import Foo from './Foo.svelte'; -export default { Foo }; \ No newline at end of file +export default { Foo }; diff --git a/test/runtime/samples/component-shorthand-import/_config.js b/test/runtime/samples/component-shorthand-import/_config.js index ceb8e19f68..dd60415537 100644 --- a/test/runtime/samples/component-shorthand-import/_config.js +++ b/test/runtime/samples/component-shorthand-import/_config.js @@ -1,3 +1,3 @@ export default { - html: `

This is the widget.

`, + html: '

This is the widget.

' }; diff --git a/test/runtime/samples/component-slot-chained/_config.js b/test/runtime/samples/component-slot-chained/_config.js index 6c028f8c31..f2f71df8d6 100644 --- a/test/runtime/samples/component-slot-chained/_config.js +++ b/test/runtime/samples/component-slot-chained/_config.js @@ -3,6 +3,6 @@ export default { test({ assert, component, target }) { component.text = 'two'; - assert.htmlEqual(target.innerHTML, `two`); + assert.htmlEqual(target.innerHTML, 'two'); } }; diff --git a/test/runtime/samples/component-slot-empty-b/_config.js b/test/runtime/samples/component-slot-empty-b/_config.js index 8c1b13b1d5..388e1a3e4a 100644 --- a/test/runtime/samples/component-slot-empty-b/_config.js +++ b/test/runtime/samples/component-slot-empty-b/_config.js @@ -1,3 +1,3 @@ export default { - html: `
` + html: '
' }; diff --git a/test/runtime/samples/component-slot-fallback-2/_config.js b/test/runtime/samples/component-slot-fallback-2/_config.js index 585e3b4c9e..7c86357a8e 100644 --- a/test/runtime/samples/component-slot-fallback-2/_config.js +++ b/test/runtime/samples/component-slot-fallback-2/_config.js @@ -1,21 +1,21 @@ export default { - html: ` `, - ssrHtml: ` `, + html: ' ', + ssrHtml: ' ', async test({ assert, target, component, window }) { - const [input1, input2, inputFallback] = target.querySelectorAll("input"); + const [input1, input2, inputFallback] = target.querySelectorAll('input'); assert.equal(component.getSubscriberCount(), 3); - input1.value = "a"; - await input1.dispatchEvent(new window.Event("input")); - input1.value = "ab"; - await input1.dispatchEvent(new window.Event("input")); - assert.equal(input1.value, "ab"); - assert.equal(input2.value, "ab"); - assert.equal(inputFallback.value, "ab"); + input1.value = 'a'; + await input1.dispatchEvent(new window.Event('input')); + input1.value = 'ab'; + await input1.dispatchEvent(new window.Event('input')); + assert.equal(input1.value, 'ab'); + assert.equal(input2.value, 'ab'); + assert.equal(inputFallback.value, 'ab'); - component.props = "hello"; + component.props = 'hello'; assert.htmlEqual( target.innerHTML, @@ -26,7 +26,7 @@ export default { ` ); - component.fallback = "world"; + component.fallback = 'world'; assert.htmlEqual( target.innerHTML, ` diff --git a/test/runtime/samples/component-slot-fallback-3/_config.js b/test/runtime/samples/component-slot-fallback-3/_config.js index b5591fb5e0..25cc65eb2d 100644 --- a/test/runtime/samples/component-slot-fallback-3/_config.js +++ b/test/runtime/samples/component-slot-fallback-3/_config.js @@ -2,5 +2,5 @@ export default { html: `
Hello World
Hello
world
Bye
World
- `, + ` }; diff --git a/test/runtime/samples/component-slot-fallback-4/_config.js b/test/runtime/samples/component-slot-fallback-4/_config.js index b7c2b63ed6..4ebe353513 100644 --- a/test/runtime/samples/component-slot-fallback-4/_config.js +++ b/test/runtime/samples/component-slot-fallback-4/_config.js @@ -1,5 +1,5 @@ export default { html: ` foobar - `, + ` }; diff --git a/test/runtime/samples/component-slot-fallback-5/_config.js b/test/runtime/samples/component-slot-fallback-5/_config.js index fa374f3519..07d09a3be9 100644 --- a/test/runtime/samples/component-slot-fallback-5/_config.js +++ b/test/runtime/samples/component-slot-fallback-5/_config.js @@ -5,8 +5,8 @@ export default { `, async test({ assert, target, window }) { - const btn = target.querySelector("button"); - const clickEvent = new window.MouseEvent("click"); + const btn = target.querySelector('button'); + const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); diff --git a/test/runtime/samples/component-slot-fallback-6/Foo.svelte b/test/runtime/samples/component-slot-fallback-6/Foo.svelte new file mode 100644 index 0000000000..0385342cef --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/Foo.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-fallback-6/Inner.svelte b/test/runtime/samples/component-slot-fallback-6/Inner.svelte new file mode 100644 index 0000000000..28f0fdd869 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/Inner.svelte @@ -0,0 +1,9 @@ + + + + + {JSON.stringify($$props)} + + diff --git a/test/runtime/samples/component-slot-fallback-6/_config.js b/test/runtime/samples/component-slot-fallback-6/_config.js new file mode 100644 index 0000000000..b32d96db2e --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/_config.js @@ -0,0 +1,18 @@ +// $$props reactivity in slot fallback +export default { + html: ` + + {"value":""} + `, + + async test({ assert, target, window }) { + const input = target.querySelector('input'); + input.value = 'abc'; + await input.dispatchEvent(new window.Event('input')); + + assert.htmlEqual(target.innerHTML, ` + + {"value":"abc"} + `); + } +}; diff --git a/test/runtime/samples/component-slot-fallback-6/main.svelte b/test/runtime/samples/component-slot-fallback-6/main.svelte new file mode 100644 index 0000000000..35abebef10 --- /dev/null +++ b/test/runtime/samples/component-slot-fallback-6/main.svelte @@ -0,0 +1,8 @@ + + + + + diff --git a/test/runtime/samples/component-slot-let-in-slot/_config.js b/test/runtime/samples/component-slot-let-in-slot/_config.js index a86d869581..eb16c27fda 100644 --- a/test/runtime/samples/component-slot-let-in-slot/_config.js +++ b/test/runtime/samples/component-slot-let-in-slot/_config.js @@ -1,6 +1,6 @@ export default { props: { - prop: 'a', + prop: 'a' }, html: 'a', diff --git a/test/runtime/samples/component-slot-let-static/_config.js b/test/runtime/samples/component-slot-let-static/_config.js index 3067939b88..ede7a679c5 100644 --- a/test/runtime/samples/component-slot-let-static/_config.js +++ b/test/runtime/samples/component-slot-let-static/_config.js @@ -1,3 +1,3 @@ export default { - html: `

Hi

` + html: '

Hi

' }; diff --git a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js index a07a1482bc..8297162b91 100644 --- a/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js +++ b/test/runtime/samples/component-slot-named-inherits-default-lets/_config.js @@ -22,4 +22,4 @@ export default {
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/component-slot-nested-error-2/_config.js b/test/runtime/samples/component-slot-nested-error-2/_config.js index 98a9f1cab0..08c436b16d 100644 --- a/test/runtime/samples/component-slot-nested-error-2/_config.js +++ b/test/runtime/samples/component-slot-nested-error-2/_config.js @@ -1,3 +1,3 @@ export default { - error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] + error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] }; diff --git a/test/runtime/samples/component-slot-nested-error-3/_config.js b/test/runtime/samples/component-slot-nested-error-3/_config.js index 98a9f1cab0..08c436b16d 100644 --- a/test/runtime/samples/component-slot-nested-error-3/_config.js +++ b/test/runtime/samples/component-slot-nested-error-3/_config.js @@ -1,3 +1,3 @@ export default { - error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] + error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] }; diff --git a/test/runtime/samples/component-slot-nested-error/_config.js b/test/runtime/samples/component-slot-nested-error/_config.js index 98a9f1cab0..08c436b16d 100644 --- a/test/runtime/samples/component-slot-nested-error/_config.js +++ b/test/runtime/samples/component-slot-nested-error/_config.js @@ -1,3 +1,3 @@ export default { - error: [`Element with a slot='...' attribute must be a child of a component or a descendant of a custom element`] + error: ["Element with a slot='...' attribute must be a child of a component or a descendant of a custom element"] }; diff --git a/test/runtime/samples/component-slot-nested-if/_config.js b/test/runtime/samples/component-slot-nested-if/_config.js index 89dfd006cc..45c570fc22 100644 --- a/test/runtime/samples/component-slot-nested-if/_config.js +++ b/test/runtime/samples/component-slot-nested-if/_config.js @@ -26,5 +26,5 @@ export default { Display: abc ` ); - }, + } }; diff --git a/test/runtime/samples/component-slot-nested-in-slot/One.svelte b/test/runtime/samples/component-slot-nested-in-slot/One.svelte new file mode 100644 index 0000000000..e27437c450 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-slot/One.svelte @@ -0,0 +1,8 @@ + + + + + diff --git a/test/runtime/samples/component-slot-nested-in-slot/Two.svelte b/test/runtime/samples/component-slot-nested-in-slot/Two.svelte new file mode 100644 index 0000000000..3f21e2d16f --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-slot/Two.svelte @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/test/runtime/samples/component-slot-nested-in-slot/_config.js b/test/runtime/samples/component-slot-nested-in-slot/_config.js new file mode 100644 index 0000000000..56a9ef2668 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-slot/_config.js @@ -0,0 +1,18 @@ +export default { + html: ` +

one: 1 two: 2

+ `, + test({ assert, component, target }) { + component.a = 3; + component.b = 4; + assert.htmlEqual(target.innerHTML, ` +

one: 3 two: 4

+ `); + + component.a = 5; + component.b = 6; + assert.htmlEqual(target.innerHTML, ` +

one: 5 two: 6

+ `); + } +}; diff --git a/test/runtime/samples/component-slot-nested-in-slot/main.svelte b/test/runtime/samples/component-slot-nested-in-slot/main.svelte new file mode 100644 index 0000000000..38a172e668 --- /dev/null +++ b/test/runtime/samples/component-slot-nested-in-slot/main.svelte @@ -0,0 +1,9 @@ + + + +

one: {one} two: {two}

+
\ No newline at end of file diff --git a/test/runtime/samples/component-slot-slot/Component.svelte b/test/runtime/samples/component-slot-slot/Component.svelte new file mode 100644 index 0000000000..fdcb8e7f2b --- /dev/null +++ b/test/runtime/samples/component-slot-slot/Component.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/test/runtime/samples/component-slot-slot/Forward.svelte b/test/runtime/samples/component-slot-slot/Forward.svelte new file mode 100644 index 0000000000..320be9df25 --- /dev/null +++ b/test/runtime/samples/component-slot-slot/Forward.svelte @@ -0,0 +1,7 @@ + + + + + diff --git a/test/runtime/samples/component-slot-slot/_config.js b/test/runtime/samples/component-slot-slot/_config.js new file mode 100644 index 0000000000..32af774fac --- /dev/null +++ b/test/runtime/samples/component-slot-slot/_config.js @@ -0,0 +1,3 @@ +export default { + html: '
lol
' +}; diff --git a/test/runtime/samples/component-slot-slot/main.svelte b/test/runtime/samples/component-slot-slot/main.svelte new file mode 100644 index 0000000000..1718494b16 --- /dev/null +++ b/test/runtime/samples/component-slot-slot/main.svelte @@ -0,0 +1,9 @@ + + + + + lol + + diff --git a/test/runtime/samples/component-static-at-symbol/_config.js b/test/runtime/samples/component-static-at-symbol/_config.js index a2f60e3de7..0be19f091f 100644 --- a/test/runtime/samples/component-static-at-symbol/_config.js +++ b/test/runtime/samples/component-static-at-symbol/_config.js @@ -1,3 +1,3 @@ export default { - html: `email` + html: "email" }; diff --git a/test/runtime/samples/component-yield-multiple-in-if/_config.js b/test/runtime/samples/component-yield-multiple-in-if/_config.js index d5d630a84d..7263cc55aa 100644 --- a/test/runtime/samples/component-yield-multiple-in-if/_config.js +++ b/test/runtime/samples/component-yield-multiple-in-if/_config.js @@ -5,6 +5,6 @@ export default { test({ assert, component, target }) { component.arriving = false; - assert.htmlEqual(target.innerHTML, `

Goodbye

`); + assert.htmlEqual(target.innerHTML, "

Goodbye

"); } }; diff --git a/test/runtime/samples/component-yield-nested-if/_config.js b/test/runtime/samples/component-yield-nested-if/_config.js index f16a7bb6bf..b46996cea3 100644 --- a/test/runtime/samples/component-yield-nested-if/_config.js +++ b/test/runtime/samples/component-yield-nested-if/_config.js @@ -6,9 +6,9 @@ export default { test({ assert, component, target }) { component.foo = false; - assert.htmlEqual( target.innerHTML, `` ); + assert.htmlEqual( target.innerHTML, '' ); component.foo = true; - assert.htmlEqual( target.innerHTML, `One\nInner` ); + assert.htmlEqual( target.innerHTML, 'One\nInner' ); } }; diff --git a/test/runtime/samples/context-api-b/_config.js b/test/runtime/samples/context-api-b/_config.js index 70dff54c06..314fd9f481 100644 --- a/test/runtime/samples/context-api-b/_config.js +++ b/test/runtime/samples/context-api-b/_config.js @@ -3,4 +3,4 @@ export default {
foo/bar
foo/baz
` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/context-api/_config.js b/test/runtime/samples/context-api/_config.js index 1bc475a156..3856aa5424 100644 --- a/test/runtime/samples/context-api/_config.js +++ b/test/runtime/samples/context-api/_config.js @@ -70,4 +70,4 @@ export default {
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/context-in-await/_config.js b/test/runtime/samples/context-in-await/_config.js index 221f5fbcca..fc498a36c2 100644 --- a/test/runtime/samples/context-in-await/_config.js +++ b/test/runtime/samples/context-in-await/_config.js @@ -10,4 +10,4 @@ export default {

Context value: 123

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/contextual-callback/_config.js b/test/runtime/samples/contextual-callback/_config.js index d47d9d001e..b27a7fc868 100644 --- a/test/runtime/samples/contextual-callback/_config.js +++ b/test/runtime/samples/contextual-callback/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target, window }) { const button = target.querySelector('button'); @@ -9,4 +9,4 @@ export default { assert.equal(component.clicked, 'x'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-anchor/_config.js b/test/runtime/samples/deconflict-anchor/_config.js index 817dd42fcb..323cb7530a 100644 --- a/test/runtime/samples/deconflict-anchor/_config.js +++ b/test/runtime/samples/deconflict-anchor/_config.js @@ -1,4 +1,4 @@ export default { preserveIdentifiers: true, - html: `

Anchor

` + html: '

Anchor

' }; diff --git a/test/runtime/samples/deconflict-block-methods/_config.js b/test/runtime/samples/deconflict-block-methods/_config.js index 2bb1aa8424..07c699df4d 100644 --- a/test/runtime/samples/deconflict-block-methods/_config.js +++ b/test/runtime/samples/deconflict-block-methods/_config.js @@ -2,5 +2,5 @@ export default { compileOptions: { dev: true }, - html: `
deconflicted
` + html: '
deconflicted
' }; diff --git a/test/runtime/samples/deconflict-builtins-2/_config.js b/test/runtime/samples/deconflict-builtins-2/_config.js index 5870ff073b..e136b0410d 100644 --- a/test/runtime/samples/deconflict-builtins-2/_config.js +++ b/test/runtime/samples/deconflict-builtins-2/_config.js @@ -1,4 +1,4 @@ export default { - html: `hello world`, - preserveIdentifiers: true, -}; \ No newline at end of file + html: 'hello world', + preserveIdentifiers: true +}; diff --git a/test/runtime/samples/deconflict-builtins/_config.js b/test/runtime/samples/deconflict-builtins/_config.js index c7053194ee..3751bfc25d 100644 --- a/test/runtime/samples/deconflict-builtins/_config.js +++ b/test/runtime/samples/deconflict-builtins/_config.js @@ -1,7 +1,7 @@ export default { - html: `got`, + html: 'got', test({ assert, component }) { assert.equal(component.foo, 'got'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-builtins/get.js b/test/runtime/samples/deconflict-builtins/get.js index cd846d9be9..78477cc40f 100644 --- a/test/runtime/samples/deconflict-builtins/get.js +++ b/test/runtime/samples/deconflict-builtins/get.js @@ -1,3 +1,3 @@ export function get () { return 'got'; -} \ No newline at end of file +} diff --git a/test/runtime/samples/deconflict-component-name-with-global/_config.js b/test/runtime/samples/deconflict-component-name-with-global/_config.js index 4b8255868e..214483fc58 100644 --- a/test/runtime/samples/deconflict-component-name-with-global/_config.js +++ b/test/runtime/samples/deconflict-component-name-with-global/_config.js @@ -5,5 +5,5 @@ export default { preserveIdentifiers: true, - html: `

true

` -}; \ No newline at end of file + html: '

true

' +}; diff --git a/test/runtime/samples/deconflict-component-name-with-module-global/_config.js b/test/runtime/samples/deconflict-component-name-with-module-global/_config.js index 4b8255868e..214483fc58 100644 --- a/test/runtime/samples/deconflict-component-name-with-module-global/_config.js +++ b/test/runtime/samples/deconflict-component-name-with-module-global/_config.js @@ -5,5 +5,5 @@ export default { preserveIdentifiers: true, - html: `

true

` -}; \ No newline at end of file + html: '

true

' +}; diff --git a/test/runtime/samples/deconflict-component-refs/_config.js b/test/runtime/samples/deconflict-component-refs/_config.js index 8092aed7ca..992066d1e6 100644 --- a/test/runtime/samples/deconflict-component-refs/_config.js +++ b/test/runtime/samples/deconflict-component-refs/_config.js @@ -22,4 +22,4 @@ export default { { name: 'baz', edit: false } ] } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-contexts/_config.js b/test/runtime/samples/deconflict-contexts/_config.js index a32300e58a..5254655d89 100644 --- a/test/runtime/samples/deconflict-contexts/_config.js +++ b/test/runtime/samples/deconflict-contexts/_config.js @@ -6,4 +6,4 @@ export default { props: { components: [ 'foo', 'bar', 'baz' ] } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-ctx/_config.js b/test/runtime/samples/deconflict-ctx/_config.js index 88f3e2efca..b6d8bf51be 100644 --- a/test/runtime/samples/deconflict-ctx/_config.js +++ b/test/runtime/samples/deconflict-ctx/_config.js @@ -2,4 +2,4 @@ export default { html: `

Hello world!

` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-elements-indexes/_config.js b/test/runtime/samples/deconflict-elements-indexes/_config.js index b531603ac7..cb102638f2 100644 --- a/test/runtime/samples/deconflict-elements-indexes/_config.js +++ b/test/runtime/samples/deconflict-elements-indexes/_config.js @@ -19,4 +19,4 @@ export default {
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-non-helpers/_config.js b/test/runtime/samples/deconflict-non-helpers/_config.js index 167ddc279c..8bbdc872e5 100644 --- a/test/runtime/samples/deconflict-non-helpers/_config.js +++ b/test/runtime/samples/deconflict-non-helpers/_config.js @@ -1,5 +1,5 @@ export default { - html: `ABCD`, + html: 'ABCD', test({ assert, component }) { assert.equal(component.compute(), 'ABCD'); diff --git a/test/runtime/samples/deconflict-self/_config.js b/test/runtime/samples/deconflict-self/_config.js index 86341e7379..44bea34e09 100644 --- a/test/runtime/samples/deconflict-self/_config.js +++ b/test/runtime/samples/deconflict-self/_config.js @@ -1,3 +1,3 @@ export default { - html: `

nested component

` + html: '

nested component

' }; diff --git a/test/runtime/samples/deconflict-spread-i/_config.js b/test/runtime/samples/deconflict-spread-i/_config.js index f147a4c1ff..7602cde023 100644 --- a/test/runtime/samples/deconflict-spread-i/_config.js +++ b/test/runtime/samples/deconflict-spread-i/_config.js @@ -1,3 +1,3 @@ export default { preserveIdentifiers: true -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/deconflict-template-1/_config.js b/test/runtime/samples/deconflict-template-1/_config.js index c7ca7bec26..faddb5b6fd 100644 --- a/test/runtime/samples/deconflict-template-1/_config.js +++ b/test/runtime/samples/deconflict-template-1/_config.js @@ -1,3 +1,3 @@ export default { - html: `template` + html: 'template' }; diff --git a/test/runtime/samples/deconflict-template-2/_config.js b/test/runtime/samples/deconflict-template-2/_config.js index c7ca7bec26..faddb5b6fd 100644 --- a/test/runtime/samples/deconflict-template-2/_config.js +++ b/test/runtime/samples/deconflict-template-2/_config.js @@ -1,3 +1,3 @@ export default { - html: `template` + html: 'template' }; diff --git a/test/runtime/samples/deconflict-vars/_config.js b/test/runtime/samples/deconflict-vars/_config.js index b3303b13fe..e66ce0f141 100644 --- a/test/runtime/samples/deconflict-vars/_config.js +++ b/test/runtime/samples/deconflict-vars/_config.js @@ -1,3 +1,3 @@ export default { - html: `

ab

` + html: '

ab

' }; diff --git a/test/runtime/samples/destroy-twice/_config.js b/test/runtime/samples/destroy-twice/_config.js index 041518d284..1279b2315d 100644 --- a/test/runtime/samples/destroy-twice/_config.js +++ b/test/runtime/samples/destroy-twice/_config.js @@ -3,4 +3,4 @@ export default { component.$destroy(); component.$destroy(); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/destructuring-assignment-array/_config.js b/test/runtime/samples/destructuring-assignment-array/_config.js index ede4552803..5b39a0b86e 100644 --- a/test/runtime/samples/destructuring-assignment-array/_config.js +++ b/test/runtime/samples/destructuring-assignment-array/_config.js @@ -20,4 +20,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/destructuring-between-exports/_config.js b/test/runtime/samples/destructuring-between-exports/_config.js index 56061f510f..3b2ee6e9ee 100644 --- a/test/runtime/samples/destructuring-between-exports/_config.js +++ b/test/runtime/samples/destructuring-between-exports/_config.js @@ -5,4 +5,4 @@ export default { html: `

42

` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/destructuring/_config.js b/test/runtime/samples/destructuring/_config.js index b8b138dfd0..93e4ed3936 100644 --- a/test/runtime/samples/destructuring/_config.js +++ b/test/runtime/samples/destructuring/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', props: { foo: 42 @@ -22,4 +22,4 @@ export default { assert.equal(count, 1); assert.equal(number, 42); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dev-warning-destroy-twice/_config.js b/test/runtime/samples/dev-warning-destroy-twice/_config.js index 3acbd6447a..69ef5b1713 100644 --- a/test/runtime/samples/dev-warning-destroy-twice/_config.js +++ b/test/runtime/samples/dev-warning-destroy-twice/_config.js @@ -15,9 +15,9 @@ export default { component.$destroy(); assert.deepEqual(warnings, [ - `Component was already destroyed` + 'Component was already destroyed' ]); console.warn = warn; // eslint-disable-line no-console } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js b/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js index 83481d9ebe..036130c4e0 100644 --- a/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js +++ b/test/runtime/samples/dev-warning-each-block-no-sets-maps/_config.js @@ -2,5 +2,5 @@ export default { compileOptions: { dev: true }, - error: `{#each} only iterates over array-like objects. You can use a spread to convert this iterable into an array.` + error: '{#each} only iterates over array-like objects. You can use a spread to convert this iterable into an array.' }; diff --git a/test/runtime/samples/dev-warning-each-block-require-arraylike/_config.js b/test/runtime/samples/dev-warning-each-block-require-arraylike/_config.js index 62e5fc209b..ff6ef80607 100644 --- a/test/runtime/samples/dev-warning-each-block-require-arraylike/_config.js +++ b/test/runtime/samples/dev-warning-each-block-require-arraylike/_config.js @@ -2,5 +2,5 @@ export default { compileOptions: { dev: true }, - error: `{#each} only iterates over array-like objects.` + error: '{#each} only iterates over array-like objects.' }; diff --git a/test/runtime/samples/dev-warning-missing-data-binding/_config.js b/test/runtime/samples/dev-warning-missing-data-binding/_config.js index f23c5d5ec5..1ba0dfc8ff 100644 --- a/test/runtime/samples/dev-warning-missing-data-binding/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-binding/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - `
was created without expected prop 'value'` + "
was created without expected prop 'value'" ] }; diff --git a/test/runtime/samples/dev-warning-missing-data-component/_config.js b/test/runtime/samples/dev-warning-missing-data-component/_config.js index a95e570988..ececa00a8c 100644 --- a/test/runtime/samples/dev-warning-missing-data-component/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-component/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - ` was created without expected prop 'y'` + " was created without expected prop 'y'" ] }; diff --git a/test/runtime/samples/dev-warning-missing-data-each/_config.js b/test/runtime/samples/dev-warning-missing-data-each/_config.js index 92cda48fce..7d7794eff4 100644 --- a/test/runtime/samples/dev-warning-missing-data-each/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-each/_config.js @@ -7,18 +7,18 @@ export default { letters: [ { id: 1, - char: 'a', + char: 'a' }, { id: 2, - char: 'b', + char: 'b' }, { id: 3, - char: 'c', - }, - ], + char: 'c' + } + ] }, - warnings: [], + warnings: [] }; diff --git a/test/runtime/samples/dev-warning-missing-data/_config.js b/test/runtime/samples/dev-warning-missing-data/_config.js index b929ff4741..f489491ac9 100644 --- a/test/runtime/samples/dev-warning-missing-data/_config.js +++ b/test/runtime/samples/dev-warning-missing-data/_config.js @@ -4,7 +4,7 @@ export default { }, warnings: [ - `
was created without expected prop 'foo'`, - `
was created without expected prop 'bar'` + "
was created without expected prop 'foo'", + "
was created without expected prop 'bar'" ] }; diff --git a/test/runtime/samples/dev-warning-readonly-computed/_config.js b/test/runtime/samples/dev-warning-readonly-computed/_config.js index 33339071f4..86037d7e1f 100644 --- a/test/runtime/samples/dev-warning-readonly-computed/_config.js +++ b/test/runtime/samples/dev-warning-readonly-computed/_config.js @@ -12,7 +12,7 @@ export default { component.foo = 1; throw new Error( 'Expected an error' ); } catch ( err ) { - assert.equal( err.message, `
: Cannot set read-only property 'foo'` ); + assert.equal( err.message, "
: Cannot set read-only property 'foo'" ); } } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dev-warning-readonly-window-binding/_config.js b/test/runtime/samples/dev-warning-readonly-window-binding/_config.js index e0b46584e4..fc6075aef1 100644 --- a/test/runtime/samples/dev-warning-readonly-window-binding/_config.js +++ b/test/runtime/samples/dev-warning-readonly-window-binding/_config.js @@ -8,7 +8,7 @@ export default { component.width = 99; throw new Error('Expected an error'); } catch (err) { - assert.equal(err.message, `
: Cannot set read-only property 'width'`); + assert.equal(err.message, "
: Cannot set read-only property 'width'"); } } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dev-warning-unknown-props-2/_config.js b/test/runtime/samples/dev-warning-unknown-props-2/_config.js index 9bff4a2a74..b28724d719 100644 --- a/test/runtime/samples/dev-warning-unknown-props-2/_config.js +++ b/test/runtime/samples/dev-warning-unknown-props-2/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - ` was created with unknown prop 'fo'` + " was created with unknown prop 'fo'" ] }; diff --git a/test/runtime/samples/dev-warning-unknown-props/_config.js b/test/runtime/samples/dev-warning-unknown-props/_config.js index 9bff4a2a74..b28724d719 100644 --- a/test/runtime/samples/dev-warning-unknown-props/_config.js +++ b/test/runtime/samples/dev-warning-unknown-props/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - ` was created with unknown prop 'fo'` + " was created with unknown prop 'fo'" ] }; diff --git a/test/runtime/samples/document-event/_config.js b/test/runtime/samples/document-event/_config.js index f5e4b46f4f..d9a8866275 100644 --- a/test/runtime/samples/document-event/_config.js +++ b/test/runtime/samples/document-event/_config.js @@ -9,5 +9,5 @@ export default { const event2 = new window.Event('mouseleave'); window.document.body.dispatchEvent(event2); assert.deepEqual(component.events, ['enter', 'leave']); - }, + } }; diff --git a/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js index 0df87f06cd..2f73514e67 100644 --- a/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js +++ b/test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js @@ -25,4 +25,4 @@ export default {

green green

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-bindings-recreated/_config.js b/test/runtime/samples/dynamic-component-bindings-recreated/_config.js index b57c49ed58..7882996a8b 100644 --- a/test/runtime/samples/dynamic-component-bindings-recreated/_config.js +++ b/test/runtime/samples/dynamic-component-bindings-recreated/_config.js @@ -22,4 +22,4 @@ export default {

green two

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-bindings/_config.js b/test/runtime/samples/dynamic-component-bindings/_config.js index 9ef9a87b91..4b76c89237 100644 --- a/test/runtime/samples/dynamic-component-bindings/_config.js +++ b/test/runtime/samples/dynamic-component-bindings/_config.js @@ -28,4 +28,4 @@ export default { assert.equal(component.z, true); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-destroy-null/_config.js b/test/runtime/samples/dynamic-component-destroy-null/_config.js index 3c47aa5bae..00f7d47d0f 100644 --- a/test/runtime/samples/dynamic-component-destroy-null/_config.js +++ b/test/runtime/samples/dynamic-component-destroy-null/_config.js @@ -6,4 +6,4 @@ export default { test({ assert, component }) { component.x = false; } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-events/_config.js b/test/runtime/samples/dynamic-component-events/_config.js index 3c6bf370bb..cc54bef4e5 100644 --- a/test/runtime/samples/dynamic-component-events/_config.js +++ b/test/runtime/samples/dynamic-component-events/_config.js @@ -22,4 +22,4 @@ export default { target.querySelector('button').dispatchEvent(click); assert.equal(component.selected, 'bar'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-in-if/_config.js b/test/runtime/samples/dynamic-component-in-if/_config.js index b481c229c4..0c6829dbcd 100644 --- a/test/runtime/samples/dynamic-component-in-if/_config.js +++ b/test/runtime/samples/dynamic-component-in-if/_config.js @@ -10,4 +10,4 @@ export default {

Bar

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-inside-element/_config.js b/test/runtime/samples/dynamic-component-inside-element/_config.js index 2e363f10da..ba144c96a6 100644 --- a/test/runtime/samples/dynamic-component-inside-element/_config.js +++ b/test/runtime/samples/dynamic-component-inside-element/_config.js @@ -14,4 +14,4 @@ export default {

false, therefore Bar

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-nulled-out-intro/_config.js b/test/runtime/samples/dynamic-component-nulled-out-intro/_config.js index 9759ada538..18ccd5f21e 100644 --- a/test/runtime/samples/dynamic-component-nulled-out-intro/_config.js +++ b/test/runtime/samples/dynamic-component-nulled-out-intro/_config.js @@ -2,4 +2,4 @@ export default { test({ component }) { component.visible = true; } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-nulled-out/_config.js b/test/runtime/samples/dynamic-component-nulled-out/_config.js index e6ff6032bf..7e928aba86 100644 --- a/test/runtime/samples/dynamic-component-nulled-out/_config.js +++ b/test/runtime/samples/dynamic-component-nulled-out/_config.js @@ -8,7 +8,7 @@ export default { component.Bar = null; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); component.Bar = Bar; @@ -16,4 +16,4 @@ export default {

Foo

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-ref/_config.js b/test/runtime/samples/dynamic-component-ref/_config.js index 6e3cabc435..f64a7fd195 100644 --- a/test/runtime/samples/dynamic-component-ref/_config.js +++ b/test/runtime/samples/dynamic-component-ref/_config.js @@ -1,5 +1,5 @@ export default { - html: `Foo`, + html: 'Foo', test({ assert, component }) { assert.ok(component.test); diff --git a/test/runtime/samples/dynamic-component-slot/_config.js b/test/runtime/samples/dynamic-component-slot/_config.js index 58f413e3c4..aedf8bbb5b 100644 --- a/test/runtime/samples/dynamic-component-slot/_config.js +++ b/test/runtime/samples/dynamic-component-slot/_config.js @@ -32,4 +32,4 @@ export default {
what goes up must come down
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component-update-existing-instance/_config.js b/test/runtime/samples/dynamic-component-update-existing-instance/_config.js index 5e3d836382..adca76f5a7 100644 --- a/test/runtime/samples/dynamic-component-update-existing-instance/_config.js +++ b/test/runtime/samples/dynamic-component-update-existing-instance/_config.js @@ -14,4 +14,4 @@ export default {

Foo 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/dynamic-component/_config.js b/test/runtime/samples/dynamic-component/_config.js index fe7ce5d65f..64abb9bd96 100644 --- a/test/runtime/samples/dynamic-component/_config.js +++ b/test/runtime/samples/dynamic-component/_config.js @@ -14,4 +14,4 @@ export default {

false, therefore Bar

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/each-block-array-literal/_config.js b/test/runtime/samples/each-block-array-literal/_config.js index 288d1cd09f..164e4730bc 100644 --- a/test/runtime/samples/each-block-array-literal/_config.js +++ b/test/runtime/samples/each-block-array-literal/_config.js @@ -15,5 +15,5 @@ export default { button.dispatchEvent(event); assert.equal(component.clicked, 'racoon'); - }, + } }; diff --git a/test/runtime/samples/each-block-component-no-props/_config.js b/test/runtime/samples/each-block-component-no-props/_config.js index e8344496ca..329da68324 100644 --- a/test/runtime/samples/each-block-component-no-props/_config.js +++ b/test/runtime/samples/each-block-component-no-props/_config.js @@ -5,12 +5,12 @@ export default { async test({ assert, component, target }) { await component.remove(); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await component.add(); - assert.htmlEqual(target.innerHTML, `

hello

`); + assert.htmlEqual(target.innerHTML, '

hello

'); await component.remove(); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/each-block-containing-component-in-if/_config.js b/test/runtime/samples/each-block-containing-component-in-if/_config.js index 9083742891..d617d23cd3 100644 --- a/test/runtime/samples/each-block-containing-component-in-if/_config.js +++ b/test/runtime/samples/each-block-containing-component-in-if/_config.js @@ -4,7 +4,7 @@ export default { fields: [1, 2] }, - html: `
`, + html: '
', test({ assert, component, target }) { component.show = true; diff --git a/test/runtime/samples/each-block-destructured-array-sparse/_config.js b/test/runtime/samples/each-block-destructured-array-sparse/_config.js index 9805276600..331c3aec1b 100644 --- a/test/runtime/samples/each-block-destructured-array-sparse/_config.js +++ b/test/runtime/samples/each-block-destructured-array-sparse/_config.js @@ -16,5 +16,5 @@ export default { assert.htmlEqual( target.innerHTML, `

bar

`); - }, + } }; diff --git a/test/runtime/samples/each-block-destructured-array/_config.js b/test/runtime/samples/each-block-destructured-array/_config.js index 432d8a3a78..e2924c8656 100644 --- a/test/runtime/samples/each-block-destructured-array/_config.js +++ b/test/runtime/samples/each-block-destructured-array/_config.js @@ -16,5 +16,5 @@ export default { assert.htmlEqual( target.innerHTML, `

foo: bar

`); - }, + } }; diff --git a/test/runtime/samples/each-block-destructured-default/_config.js b/test/runtime/samples/each-block-destructured-default/_config.js index 133fd68532..0e99fd589f 100644 --- a/test/runtime/samples/each-block-destructured-default/_config.js +++ b/test/runtime/samples/each-block-destructured-default/_config.js @@ -18,5 +18,5 @@ export default { assert.htmlEqual(target.innerHTML, `

cow - ‎B. taurus - 50kg

`); - }, + } }; diff --git a/test/runtime/samples/each-block-destructured-object-binding/_config.js b/test/runtime/samples/each-block-destructured-object-binding/_config.js index 8b59a97034..2ab3e24397 100644 --- a/test/runtime/samples/each-block-destructured-object-binding/_config.js +++ b/test/runtime/samples/each-block-destructured-object-binding/_config.js @@ -1,6 +1,6 @@ export default { props: { - people: [{ name: { first: 'Doctor', last: 'Who' } }], + people: [{ name: { first: 'Doctor', last: 'Who' } }] }, html: ` @@ -41,5 +41,5 @@ export default {

Frank Oz

`); - }, + } }; diff --git a/test/runtime/samples/each-block-destructured-object-rest/_config.js b/test/runtime/samples/each-block-destructured-object-rest/_config.js index 561d4e8442..be5d38b555 100644 --- a/test/runtime/samples/each-block-destructured-object-rest/_config.js +++ b/test/runtime/samples/each-block-destructured-object-rest/_config.js @@ -16,5 +16,5 @@ export default { assert.htmlEqual(target.innerHTML, `

cow

`); - }, + } }; diff --git a/test/runtime/samples/each-block-destructured-object/_config.js b/test/runtime/samples/each-block-destructured-object/_config.js index dc3943fffe..feec72f402 100644 --- a/test/runtime/samples/each-block-destructured-object/_config.js +++ b/test/runtime/samples/each-block-destructured-object/_config.js @@ -16,5 +16,5 @@ export default { assert.htmlEqual( target.innerHTML, `

cow: hooves

`); - }, + } }; diff --git a/test/runtime/samples/each-block-else-in-if/_config.js b/test/runtime/samples/each-block-else-in-if/_config.js index c800ee8a30..24d1e5477a 100644 --- a/test/runtime/samples/each-block-else-in-if/_config.js +++ b/test/runtime/samples/each-block-else-in-if/_config.js @@ -6,7 +6,7 @@ export default { test({ assert, component, target }) { component.visible = false; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); component.visible = true; assert.htmlEqual(target.innerHTML, ` diff --git a/test/runtime/samples/each-block-else-mount-or-intro/_config.js b/test/runtime/samples/each-block-else-mount-or-intro/_config.js index 8460a4b5e0..15674ea651 100644 --- a/test/runtime/samples/each-block-else-mount-or-intro/_config.js +++ b/test/runtime/samples/each-block-else-mount-or-intro/_config.js @@ -1,4 +1,4 @@ export default { props: { items: [] }, - html: `No items.`, + html: 'No items.' }; diff --git a/test/runtime/samples/each-block-empty-outro/_config.js b/test/runtime/samples/each-block-empty-outro/_config.js index 92eb7c66b1..0acf1f572f 100644 --- a/test/runtime/samples/each-block-empty-outro/_config.js +++ b/test/runtime/samples/each-block-empty-outro/_config.js @@ -13,6 +13,6 @@ export default { test({ assert, component, target }) { component.visible = false; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/each-block-in-if-block/_config.js b/test/runtime/samples/each-block-in-if-block/_config.js index eda3ca14a9..082b9b3033 100644 --- a/test/runtime/samples/each-block-in-if-block/_config.js +++ b/test/runtime/samples/each-block-in-if-block/_config.js @@ -1,7 +1,7 @@ export default { props: { dummy: false, - fruits: ['Apple', 'Banana', 'Tomato'], + fruits: ['Apple', 'Banana', 'Tomato'] }, html: '
Apple
Banana
Tomato
', diff --git a/test/runtime/samples/each-block-indexed/_config.js b/test/runtime/samples/each-block-indexed/_config.js index f65c83ca93..bad727bbf1 100644 --- a/test/runtime/samples/each-block-indexed/_config.js +++ b/test/runtime/samples/each-block-indexed/_config.js @@ -2,5 +2,5 @@ export default { props: { animals: [ 'adder', 'blue whale', 'chameleon' ] }, - html: `

0: adder

1: blue whale

2: chameleon

` + html: '

0: adder

1: blue whale

2: chameleon

' }; diff --git a/test/runtime/samples/each-block-keyed-component-action/_config.js b/test/runtime/samples/each-block-keyed-component-action/_config.js index c4421f89ae..a1afc44c93 100644 --- a/test/runtime/samples/each-block-keyed-component-action/_config.js +++ b/test/runtime/samples/each-block-keyed-component-action/_config.js @@ -2,20 +2,20 @@ export default { test({ assert, component, raf }) { assert.equal(component.count, 0); - component.arr = ["2"]; + component.arr = ['2']; assert.equal(component.count, 1); - component.arr = ["1", "2"]; + component.arr = ['1', '2']; assert.equal(component.count, 2); - component.arr = ["2", "1"]; + component.arr = ['2', '1']; assert.equal(component.count, 2); component.arr = []; assert.equal(component.count, 0); - }, + } }; diff --git a/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js b/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js new file mode 100644 index 0000000000..0aed1b0e07 --- /dev/null +++ b/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js @@ -0,0 +1,27 @@ +let count = 0; +let value = 'foo'; + +export default { + props: { + value() { + count++; + return value; + } + }, + + html: ` +
foo
+
foo
+ `, + + test({ assert, component, target }) { + value = 'bar'; + component.id = 1; + + assert.equal(count, 4); + assert.htmlEqual(target.innerHTML, ` +
bar
+
bar
+ `); + } +}; diff --git a/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte b/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte new file mode 100644 index 0000000000..9a15c7d98e --- /dev/null +++ b/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte @@ -0,0 +1,8 @@ + + +{#each ['foo', 'bar'] as key (id + key)} +
{value()}
+{/each} \ No newline at end of file diff --git a/test/runtime/samples/each-block-keyed-dynamic-2/_config.js b/test/runtime/samples/each-block-keyed-dynamic-2/_config.js index 7eba75a5ff..e25083c751 100644 --- a/test/runtime/samples/each-block-keyed-dynamic-2/_config.js +++ b/test/runtime/samples/each-block-keyed-dynamic-2/_config.js @@ -6,9 +6,9 @@ export default { `, async test({ assert, component, target, window }) { - const button = target.querySelector("button"); + const button = target.querySelector('button'); - const event = new window.MouseEvent("click"); + const event = new window.MouseEvent('click'); await button.dispatchEvent(event); assert.htmlEqual( diff --git a/test/runtime/samples/each-block-keyed-empty/_config.js b/test/runtime/samples/each-block-keyed-empty/_config.js index cf8f4d3219..dfa810b3ff 100644 --- a/test/runtime/samples/each-block-keyed-empty/_config.js +++ b/test/runtime/samples/each-block-keyed-empty/_config.js @@ -1,7 +1,7 @@ export default { props: { - x: [{ z: 1 }, { z: 2 }], + x: [{ z: 1 }, { z: 2 }] }, - html: `` + html: '' }; diff --git a/test/runtime/samples/each-block-keyed-html/_config.js b/test/runtime/samples/each-block-keyed-html/_config.js index 536e54543e..3ece052d5c 100644 --- a/test/runtime/samples/each-block-keyed-html/_config.js +++ b/test/runtime/samples/each-block-keyed-html/_config.js @@ -5,6 +5,6 @@ export default { test({ assert, component, target }) { component.names = component.names.reverse(); - assert.htmlEqual(target.innerHTML, `JillJohn`); + assert.htmlEqual(target.innerHTML, 'JillJohn'); } }; diff --git a/test/runtime/samples/each-block-keyed-non-prop/_config.js b/test/runtime/samples/each-block-keyed-non-prop/_config.js index 90e9a7f9c8..2cccbedef0 100644 --- a/test/runtime/samples/each-block-keyed-non-prop/_config.js +++ b/test/runtime/samples/each-block-keyed-non-prop/_config.js @@ -25,5 +25,5 @@ export default { assert.equal(p1, p4, 'first

element should be retained'); assert.equal(p3, p5, 'last

element should be retained'); - }, + } }; diff --git a/test/runtime/samples/each-block-keyed-random-permute/_config.js b/test/runtime/samples/each-block-keyed-random-permute/_config.js index 80bf2d9115..88330c4509 100644 --- a/test/runtime/samples/each-block-keyed-random-permute/_config.js +++ b/test/runtime/samples/each-block-keyed-random-permute/_config.js @@ -19,10 +19,10 @@ function permute() { export default { props: { - values: toObjects('abc'), + values: toObjects('abc') }, - html: `(a)(b)(c)`, + html: '(a)(b)(c)', test({ assert, component, target }) { function test(sequence) { diff --git a/test/runtime/samples/each-block-keyed-shift/_config.js b/test/runtime/samples/each-block-keyed-shift/_config.js index 44ca8447f0..4e7809445c 100644 --- a/test/runtime/samples/each-block-keyed-shift/_config.js +++ b/test/runtime/samples/each-block-keyed-shift/_config.js @@ -1,6 +1,6 @@ export default { props: { - titles: [{ name: 'a', }, { name: 'b' }, { name: 'c' }] + titles: [{ name: 'a' }, { name: 'b' }, { name: 'c' }] }, html: ` diff --git a/test/runtime/samples/each-block-keyed-siblings/_config.js b/test/runtime/samples/each-block-keyed-siblings/_config.js index d87f8943da..a52b6c404d 100644 --- a/test/runtime/samples/each-block-keyed-siblings/_config.js +++ b/test/runtime/samples/each-block-keyed-siblings/_config.js @@ -1,7 +1,7 @@ export default { props: { ones: [{ text: '1' }], - twos: [{ text: '2' }], + twos: [{ text: '2' }] }, html: ` @@ -16,5 +16,5 @@ export default {

11
2
`); - }, + } }; diff --git a/test/runtime/samples/each-block-keyed-static/_config.js b/test/runtime/samples/each-block-keyed-static/_config.js index 629ea47ebb..57800c454f 100644 --- a/test/runtime/samples/each-block-keyed-static/_config.js +++ b/test/runtime/samples/each-block-keyed-static/_config.js @@ -1,6 +1,6 @@ export default { props: { - x: [{ z: 1 }, { z: 2 }], + x: [{ z: 1 }, { z: 2 }] }, html: ` diff --git a/test/runtime/samples/each-block-scope-shadow-bind-2/_config.js b/test/runtime/samples/each-block-scope-shadow-bind-2/_config.js index 00e436a5aa..655aac05b7 100644 --- a/test/runtime/samples/each-block-scope-shadow-bind-2/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-bind-2/_config.js @@ -8,9 +8,9 @@ export default { `, async test({ assert, target, window }) { - const input = target.querySelector("input"); - input.value = "abcd"; - await input.dispatchEvent(new window.Event("input")); + const input = target.querySelector('input'); + input.value = 'abcd'; + await input.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -19,5 +19,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/each-block-scope-shadow-bind-3/_config.js b/test/runtime/samples/each-block-scope-shadow-bind-3/_config.js index e1a385acaf..42b7a96e34 100644 --- a/test/runtime/samples/each-block-scope-shadow-bind-3/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-bind-3/_config.js @@ -25,9 +25,9 @@ export default {
`, async test({ assert, target, window }) { - const [input1, input2, input3, input4] = target.querySelectorAll("input"); - input1.value = "Awesome"; - await input1.dispatchEvent(new window.Event("input")); + const [input1, input2, input3, input4] = target.querySelectorAll('input'); + input1.value = 'Awesome'; + await input1.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -45,8 +45,8 @@ export default { ` ); - input2.value = "Svelte"; - await input2.dispatchEvent(new window.Event("input")); + input2.value = 'Svelte'; + await input2.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -64,8 +64,8 @@ export default { ` ); - input3.value = "Foo"; - await input3.dispatchEvent(new window.Event("input")); + input3.value = 'Foo'; + await input3.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -83,8 +83,8 @@ export default { ` ); - input4.value = "Bar"; - await input4.dispatchEvent(new window.Event("input")); + input4.value = 'Bar'; + await input4.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -101,5 +101,5 @@ export default {
` ); - }, + } }; diff --git a/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js b/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js index 3dffa560da..f0570577b2 100644 --- a/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-bind-4/_config.js @@ -14,11 +14,11 @@ export default { `, async test({ assert, target, window }) { - const input = target.querySelector("input"); - const button = target.querySelector("button"); + const input = target.querySelector('input'); + const button = target.querySelector('button'); - input.value = "Awesome"; - await input.dispatchEvent(new window.Event("input")); + input.value = 'Awesome'; + await input.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -32,7 +32,7 @@ export default { ); - await button.dispatchEvent(new window.MouseEvent("click")); + await button.dispatchEvent(new window.MouseEvent('click')); assert.htmlEqual( target.innerHTML, @@ -47,8 +47,8 @@ export default { assert.equal(input.value, 'World'); - input.value = "Svelte"; - await input.dispatchEvent(new window.Event("input")); + input.value = 'Svelte'; + await input.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -60,5 +60,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/each-block-scope-shadow-bind/_config.js b/test/runtime/samples/each-block-scope-shadow-bind/_config.js index 00e436a5aa..655aac05b7 100644 --- a/test/runtime/samples/each-block-scope-shadow-bind/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-bind/_config.js @@ -8,9 +8,9 @@ export default { `, async test({ assert, target, window }) { - const input = target.querySelector("input"); - input.value = "abcd"; - await input.dispatchEvent(new window.Event("input")); + const input = target.querySelector('input'); + input.value = 'abcd'; + await input.dispatchEvent(new window.Event('input')); assert.htmlEqual( target.innerHTML, @@ -19,5 +19,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/each-block-scope-shadow-self/_config.js b/test/runtime/samples/each-block-scope-shadow-self/_config.js index 1669dc5b6e..867aadfab9 100644 --- a/test/runtime/samples/each-block-scope-shadow-self/_config.js +++ b/test/runtime/samples/each-block-scope-shadow-self/_config.js @@ -9,5 +9,5 @@ export default { assert.equal(target.querySelectorAll('input').length, 3); assert.deepEqual(component.data, { a: 'svelte', b: 'B', c: 'C' }); assert.deepEqual(component.x, ['a', 'b', 'c']); - }, + } }; diff --git a/test/runtime/samples/each-block-static/_config.js b/test/runtime/samples/each-block-static/_config.js index b62d262d9b..fc2fb28cca 100644 --- a/test/runtime/samples/each-block-static/_config.js +++ b/test/runtime/samples/each-block-static/_config.js @@ -3,10 +3,10 @@ export default { items: [] }, - html: ``, + html: '', test({ assert, component, target }) { component.items = ['x']; - assert.htmlEqual(target.innerHTML, `foo`); + assert.htmlEqual(target.innerHTML, 'foo'); } }; diff --git a/test/runtime/samples/each-blocks-assignment-2/_config.js b/test/runtime/samples/each-blocks-assignment-2/_config.js index e5fe84ea7c..f69b4fe9f6 100644 --- a/test/runtime/samples/each-blocks-assignment-2/_config.js +++ b/test/runtime/samples/each-blocks-assignment-2/_config.js @@ -4,9 +4,9 @@ export default { `, async test({ assert, component, target, window }) { - const button = target.querySelector("button"); + const button = target.querySelector('button'); - const clickEvent = new window.MouseEvent("click"); + const clickEvent = new window.MouseEvent('click'); await button.dispatchEvent(clickEvent); assert.htmlEqual( @@ -16,5 +16,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/each-blocks-assignment/_config.js b/test/runtime/samples/each-blocks-assignment/_config.js index ac07ad1656..b651e3e02b 100644 --- a/test/runtime/samples/each-blocks-assignment/_config.js +++ b/test/runtime/samples/each-blocks-assignment/_config.js @@ -9,9 +9,9 @@ export default { `, async test({ assert, component, target, window }) { - let [incrementBtn, ...buttons] = target.querySelectorAll("button"); + let [incrementBtn, ...buttons] = target.querySelectorAll('button'); - const clickEvent = new window.MouseEvent("click"); + const clickEvent = new window.MouseEvent('click'); await buttons[0].dispatchEvent(clickEvent); assert.htmlEqual( @@ -75,7 +75,7 @@ export default { ` ); - [incrementBtn, ...buttons] = target.querySelectorAll("button"); + [incrementBtn, ...buttons] = target.querySelectorAll('button'); await buttons[3].dispatchEvent(clickEvent); @@ -93,5 +93,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/each-blocks-expression/_config.js b/test/runtime/samples/each-blocks-expression/_config.js index 239a18b6dc..9f14bd81ec 100644 --- a/test/runtime/samples/each-blocks-expression/_config.js +++ b/test/runtime/samples/each-blocks-expression/_config.js @@ -1,3 +1,3 @@ export default { - html: `

a

b

c

` + html: '

a

b

c

' }; diff --git a/test/runtime/samples/each-blocks-nested-b/_config.js b/test/runtime/samples/each-blocks-nested-b/_config.js index c44899e6fb..7b13d988b4 100644 --- a/test/runtime/samples/each-blocks-nested-b/_config.js +++ b/test/runtime/samples/each-blocks-nested-b/_config.js @@ -28,7 +28,7 @@ export default { } ] }, - html: `

animals: aardvark

animals: buffalo

animals: chinchilla

countries: albania

countries: brazil

countries: china

people: alice

people: bob

people: carol

people: dave

`, + html: '

animals: aardvark

animals: buffalo

animals: chinchilla

countries: albania

countries: brazil

countries: china

people: alice

people: bob

people: carol

people: dave

', test({ assert, component, target }) { // TODO } diff --git a/test/runtime/samples/each-blocks-nested/_config.js b/test/runtime/samples/each-blocks-nested/_config.js index 790ec9ced7..3318bc344d 100644 --- a/test/runtime/samples/each-blocks-nested/_config.js +++ b/test/runtime/samples/each-blocks-nested/_config.js @@ -4,7 +4,7 @@ export default { rows: [ 1, 2, 3 ] }, - html: `
a, 1
a, 2
a, 3
b, 1
b, 2
b, 3
c, 1
c, 2
c, 3
`, + html: '
a, 1
a, 2
a, 3
b, 1
b, 2
b, 3
c, 1
c, 2
c, 3
', test({ assert, component, target }) { // TODO diff --git a/test/runtime/samples/element-source-location/_config.js b/test/runtime/samples/element-source-location/_config.js index 61ae36d107..101cc2cad1 100644 --- a/test/runtime/samples/element-source-location/_config.js +++ b/test/runtime/samples/element-source-location/_config.js @@ -23,4 +23,4 @@ export default { char: 7 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/empty-dom/_config.js b/test/runtime/samples/empty-dom/_config.js index e3e3d0ecd5..22dc25b41e 100644 --- a/test/runtime/samples/empty-dom/_config.js +++ b/test/runtime/samples/empty-dom/_config.js @@ -1,3 +1,3 @@ export default { - html: '', -}; \ No newline at end of file + html: '' +}; diff --git a/test/runtime/samples/empty-style-block/_config.js b/test/runtime/samples/empty-style-block/_config.js index 0375bad029..22dc25b41e 100644 --- a/test/runtime/samples/empty-style-block/_config.js +++ b/test/runtime/samples/empty-style-block/_config.js @@ -1,3 +1,3 @@ export default { - html: '', + html: '' }; diff --git a/test/runtime/samples/escape-template-literals/_config.js b/test/runtime/samples/escape-template-literals/_config.js index 1419d65679..9e50f94764 100644 --- a/test/runtime/samples/escape-template-literals/_config.js +++ b/test/runtime/samples/escape-template-literals/_config.js @@ -1,3 +1,3 @@ export default { - html: '`${foo}\\n`\n
foo
\n
`${foo}\\n`
', + html: '`${foo}\\n`\n
foo
\n
`${foo}\\n`
' }; diff --git a/test/runtime/samples/event-handler-async/_config.js b/test/runtime/samples/event-handler-async/_config.js index fab4d998b6..b483d039ed 100644 --- a/test/runtime/samples/event-handler-async/_config.js +++ b/test/runtime/samples/event-handler-async/_config.js @@ -1,5 +1,5 @@ export default { html: ` - `, + ` }; diff --git a/test/runtime/samples/event-handler-dynamic-2/_config.js b/test/runtime/samples/event-handler-dynamic-2/_config.js index c996d8f2aa..5fded47855 100644 --- a/test/runtime/samples/event-handler-dynamic-2/_config.js +++ b/test/runtime/samples/event-handler-dynamic-2/_config.js @@ -29,5 +29,5 @@ export default { await handler_b.dispatchEvent(event); assert.equal(p.innerHTML, '2'); - }, + } }; diff --git a/test/runtime/samples/event-handler-dynamic-bound-var/_config.js b/test/runtime/samples/event-handler-dynamic-bound-var/_config.js index c832127c09..c490db000a 100644 --- a/test/runtime/samples/event-handler-dynamic-bound-var/_config.js +++ b/test/runtime/samples/event-handler-dynamic-bound-var/_config.js @@ -16,5 +16,5 @@ export default { Bye World ` ); - }, + } }; diff --git a/test/runtime/samples/event-handler-dynamic-expression/_config.js b/test/runtime/samples/event-handler-dynamic-expression/_config.js index c4d259a542..f479c9cef2 100644 --- a/test/runtime/samples/event-handler-dynamic-expression/_config.js +++ b/test/runtime/samples/event-handler-dynamic-expression/_config.js @@ -1,5 +1,5 @@ export default { - html: ``, + html: '', async test({ assert, component, target, window }) { const [button] = target.querySelectorAll( @@ -9,12 +9,12 @@ export default { const event = new window.MouseEvent('click'); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await button.dispatchEvent(event); - assert.htmlEqual(target.innerHTML, ``); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/event-handler-dynamic-hash/_config.js b/test/runtime/samples/event-handler-dynamic-hash/_config.js index e60e561524..35f5fa103d 100644 --- a/test/runtime/samples/event-handler-dynamic-hash/_config.js +++ b/test/runtime/samples/event-handler-dynamic-hash/_config.js @@ -14,14 +14,14 @@ export default { ); const event = new window.MouseEvent('click'); - let err = ""; + let err = ''; window.addEventListener('error', (e) => { e.preventDefault(); err = e.message; }); await button.dispatchEvent(event); - assert.equal(err, "", err); + assert.equal(err, '', err); assert.htmlEqual(target.innerHTML, `

@@ -52,5 +52,5 @@ export default {

2

`); - }, + } }; diff --git a/test/runtime/samples/event-handler-dynamic-invalid/_config.js b/test/runtime/samples/event-handler-dynamic-invalid/_config.js index ba1777f945..0ed298c95a 100644 --- a/test/runtime/samples/event-handler-dynamic-invalid/_config.js +++ b/test/runtime/samples/event-handler-dynamic-invalid/_config.js @@ -9,7 +9,7 @@ export default { ); const event = new window.MouseEvent('click'); - let err = ""; + let err = ''; window.addEventListener('error', (e) => { e.preventDefault(); err = e.message; @@ -17,12 +17,12 @@ export default { // All three should not throw if proper checking is done in runtime code await buttonUndef.dispatchEvent(event); - assert.equal(err, "", err); + assert.equal(err, '', err); await buttonNull.dispatchEvent(event); - assert.equal(err, "", err); + assert.equal(err, '', err); await buttonInvalid.dispatchEvent(event); - assert.equal(err, "", err); - }, + assert.equal(err, '', err); + } }; diff --git a/test/runtime/samples/event-handler-dynamic-modifier-self/_config.js b/test/runtime/samples/event-handler-dynamic-modifier-self/_config.js index 6d7d29e482..6bd96ba8aa 100644 --- a/test/runtime/samples/event-handler-dynamic-modifier-self/_config.js +++ b/test/runtime/samples/event-handler-dynamic-modifier-self/_config.js @@ -12,5 +12,5 @@ export default { await button.dispatchEvent(event); assert.ok(!component.inner_clicked); - }, + } }; diff --git a/test/runtime/samples/event-handler-dynamic/_config.js b/test/runtime/samples/event-handler-dynamic/_config.js index e60e561524..35f5fa103d 100644 --- a/test/runtime/samples/event-handler-dynamic/_config.js +++ b/test/runtime/samples/event-handler-dynamic/_config.js @@ -14,14 +14,14 @@ export default { ); const event = new window.MouseEvent('click'); - let err = ""; + let err = ''; window.addEventListener('error', (e) => { e.preventDefault(); err = e.message; }); await button.dispatchEvent(event); - assert.equal(err, "", err); + assert.equal(err, '', err); assert.htmlEqual(target.innerHTML, `

@@ -52,5 +52,5 @@ export default {

2

`); - }, + } }; diff --git a/test/runtime/samples/event-handler-each-modifier/_config.js b/test/runtime/samples/event-handler-each-modifier/_config.js index 702addd3c3..8274e22eec 100644 --- a/test/runtime/samples/event-handler-each-modifier/_config.js +++ b/test/runtime/samples/event-handler-each-modifier/_config.js @@ -2,21 +2,21 @@ export default { async test({ assert, component, target, window }) { // set first await component.lists.update(() => [ - { text: "item1" }, - { text: "item2" }, - { text: "item3" } + { text: 'item1' }, + { text: 'item2' }, + { text: 'item3' } ]); await component.lists.update(() => [ - { text: "item3" }, - { text: "item2" }, - { text: "item1" } + { text: 'item3' }, + { text: 'item2' }, + { text: 'item1' } ]); await component.lists.update(() => [ - { text: "item1" }, - { text: "item2" }, - { text: "item3" } + { text: 'item1' }, + { text: 'item2' }, + { text: 'item3' } ]); assert.equal(component.updated, 4); diff --git a/test/runtime/samples/event-handler-each-this/_config.js b/test/runtime/samples/event-handler-each-this/_config.js index 3ab2d5acdc..7f6528977c 100644 --- a/test/runtime/samples/event-handler-each-this/_config.js +++ b/test/runtime/samples/event-handler-each-this/_config.js @@ -1,6 +1,6 @@ export default { props: { - items: ['foo', 'bar', 'baz'], + items: ['foo', 'bar', 'baz'] }, html: ` diff --git a/test/runtime/samples/event-handler-modifier-self/_config.js b/test/runtime/samples/event-handler-modifier-self/_config.js index 6d7d29e482..6bd96ba8aa 100644 --- a/test/runtime/samples/event-handler-modifier-self/_config.js +++ b/test/runtime/samples/event-handler-modifier-self/_config.js @@ -12,5 +12,5 @@ export default { await button.dispatchEvent(event); assert.ok(!component.inner_clicked); - }, + } }; diff --git a/test/runtime/samples/flush-before-bindings/_config.js b/test/runtime/samples/flush-before-bindings/_config.js index 7bb6ebfc15..4f20299771 100644 --- a/test/runtime/samples/flush-before-bindings/_config.js +++ b/test/runtime/samples/flush-before-bindings/_config.js @@ -20,4 +20,4 @@ export default { // TODO minimise the number of recomputations during oncreate // assert.equal(counter.count, 1); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/flush-before-bindings/counter.js b/test/runtime/samples/flush-before-bindings/counter.js index 63872cd6a2..f0fc271f84 100644 --- a/test/runtime/samples/flush-before-bindings/counter.js +++ b/test/runtime/samples/flush-before-bindings/counter.js @@ -1,3 +1,3 @@ export default { count: 0 -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/fragment-trailing-whitespace/_config.js b/test/runtime/samples/fragment-trailing-whitespace/_config.js index 2251d6dae8..549cb1be68 100644 --- a/test/runtime/samples/fragment-trailing-whitespace/_config.js +++ b/test/runtime/samples/fragment-trailing-whitespace/_config.js @@ -1,5 +1,5 @@ -const message = "the quick brown fox jumps over the lazy dog"; -const expected = [...message].map(c => `${c + " "}`).join(""); +const message = 'the quick brown fox jumps over the lazy dog'; +const expected = [...message].map(c => `${c + ' '}`).join(''); export default { props: { diff --git a/test/runtime/samples/function-expression-inline/_config.js b/test/runtime/samples/function-expression-inline/_config.js index 6916be45b1..a5dc3f7080 100644 --- a/test/runtime/samples/function-expression-inline/_config.js +++ b/test/runtime/samples/function-expression-inline/_config.js @@ -19,4 +19,4 @@ export default {

6

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/function-in-expression/_config.js b/test/runtime/samples/function-in-expression/_config.js index f8ddbe26a5..d3086863d3 100644 --- a/test/runtime/samples/function-in-expression/_config.js +++ b/test/runtime/samples/function-in-expression/_config.js @@ -8,6 +8,6 @@ export default { test({ assert, component, target }) { component.numbers = [10, 11, 12, 13, 14, 15, 16]; - assert.htmlEqual(target.innerHTML, `11, 13, 15`); + assert.htmlEqual(target.innerHTML, '11, 13, 15'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/get-after-destroy/_config.js b/test/runtime/samples/get-after-destroy/_config.js index 5d10bbe72a..5e3171d39a 100644 --- a/test/runtime/samples/get-after-destroy/_config.js +++ b/test/runtime/samples/get-after-destroy/_config.js @@ -3,7 +3,7 @@ export default { foo: 1 }, - html: `
1
`, + html: '
1
', test({ assert, component }) { component.$destroy(); diff --git a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js index d5f3def7f1..34cee8157c 100644 --- a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js +++ b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js @@ -37,17 +37,17 @@ export default { todos: { first: { description: 'Buy some milk', - done: true, + done: true }, second: { description: 'Do the laundry', - done: true, + done: true }, third: { description: "Find life's true purpose", - done: false, - }, - }, + done: false + } + } }, async test({ assert, component, target, window }) { @@ -74,5 +74,5 @@ export default {
`); - }, + } }; diff --git a/test/runtime/samples/globals-shadowed-by-each-binding/_config.js b/test/runtime/samples/globals-shadowed-by-each-binding/_config.js index f69e5e8b0e..50feb09bb6 100644 --- a/test/runtime/samples/globals-shadowed-by-each-binding/_config.js +++ b/test/runtime/samples/globals-shadowed-by-each-binding/_config.js @@ -1,3 +1,3 @@ export default { - html: '

Alert1

Alert2

', + html: '

Alert1

Alert2

' }; diff --git a/test/runtime/samples/hash-in-attribute/_config.js b/test/runtime/samples/hash-in-attribute/_config.js index 5e5726c48f..a6fe8eb909 100644 --- a/test/runtime/samples/hash-in-attribute/_config.js +++ b/test/runtime/samples/hash-in-attribute/_config.js @@ -23,4 +23,4 @@ export default { x#f `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/head-title-dynamic-simple/_config.js b/test/runtime/samples/head-title-dynamic-simple/_config.js index 682a841fcd..cc2301a2f9 100644 --- a/test/runtime/samples/head-title-dynamic-simple/_config.js +++ b/test/runtime/samples/head-title-dynamic-simple/_config.js @@ -9,4 +9,4 @@ export default { component.foo = 'Also A Title'; assert.equal(window.document.title, 'Also A Title'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/head-title-dynamic/_config.js b/test/runtime/samples/head-title-dynamic/_config.js index ddb04bf0a3..95d5f8debf 100644 --- a/test/runtime/samples/head-title-dynamic/_config.js +++ b/test/runtime/samples/head-title-dynamic/_config.js @@ -9,4 +9,4 @@ export default { component.adjective = 'different'; assert.equal(window.document.title, 'a different title'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/head-title-empty/_config.js b/test/runtime/samples/head-title-empty/_config.js index 497855156c..5b0785c797 100644 --- a/test/runtime/samples/head-title-empty/_config.js +++ b/test/runtime/samples/head-title-empty/_config.js @@ -2,4 +2,4 @@ export default { test({ assert, window }) { assert.equal(window.document.title, ''); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/head-title-static/_config.js b/test/runtime/samples/head-title-static/_config.js index e6d5d9aaff..ee9a0316b5 100644 --- a/test/runtime/samples/head-title-static/_config.js +++ b/test/runtime/samples/head-title-static/_config.js @@ -2,4 +2,4 @@ export default { test({ assert, component, target, window }) { assert.equal(window.document.title, 'changed'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/html-entities-inside-elements/_config.js b/test/runtime/samples/html-entities-inside-elements/_config.js index a53af0a297..2537da2654 100644 --- a/test/runtime/samples/html-entities-inside-elements/_config.js +++ b/test/runtime/samples/html-entities-inside-elements/_config.js @@ -2,4 +2,4 @@ export default { html: `

this <em>should</em> not be <strong>bold</strong>

` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/html-entities/_config.js b/test/runtime/samples/html-entities/_config.js index c8c2de8403..ddcc318e28 100644 --- a/test/runtime/samples/html-entities/_config.js +++ b/test/runtime/samples/html-entities/_config.js @@ -11,4 +11,4 @@ export default { &notanentity; ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/html-non-entities-inside-elements/_config.js b/test/runtime/samples/html-non-entities-inside-elements/_config.js index bc217d6d02..d8e128a117 100644 --- a/test/runtime/samples/html-non-entities-inside-elements/_config.js +++ b/test/runtime/samples/html-non-entities-inside-elements/_config.js @@ -2,4 +2,4 @@ export default { html: `
'foo'
` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/if-block-component-store-function-conditionals/_config.js b/test/runtime/samples/if-block-component-store-function-conditionals/_config.js index db171f2fd1..609765d225 100644 --- a/test/runtime/samples/if-block-component-store-function-conditionals/_config.js +++ b/test/runtime/samples/if-block-component-store-function-conditionals/_config.js @@ -1,3 +1,3 @@ export default { - html: '

OK

', + html: '

OK

' }; diff --git a/test/runtime/samples/if-block-component-without-outro/_config.js b/test/runtime/samples/if-block-component-without-outro/_config.js index 8106081c7c..fbcc328fa3 100644 --- a/test/runtime/samples/if-block-component-without-outro/_config.js +++ b/test/runtime/samples/if-block-component-without-outro/_config.js @@ -1,6 +1,6 @@ export default { props: { - foo: true, + foo: true }, html: '
A wild component appears
', @@ -8,5 +8,5 @@ export default { test({ assert, component, target }) { component.foo = false; assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/if-block-compound-outro-no-dependencies/_config.js b/test/runtime/samples/if-block-compound-outro-no-dependencies/_config.js index 58b0521022..bcc4e256a4 100644 --- a/test/runtime/samples/if-block-compound-outro-no-dependencies/_config.js +++ b/test/runtime/samples/if-block-compound-outro-no-dependencies/_config.js @@ -1,3 +1,3 @@ export default { - html: `blah blah blah blah` + html: 'blah blah blah blah' }; diff --git a/test/runtime/samples/if-block-conservative-update/_config.js b/test/runtime/samples/if-block-conservative-update/_config.js index a71166ef81..f84ccb6b43 100644 --- a/test/runtime/samples/if-block-conservative-update/_config.js +++ b/test/runtime/samples/if-block-conservative-update/_config.js @@ -9,7 +9,7 @@ export default { } }, - html: `

potato

`, + html: '

potato

', test({ assert, component, target }) { assert.equal(count, 1); @@ -17,6 +17,6 @@ export default { component.foo = 'soup'; assert.equal(count, 1); - assert.htmlEqual(target.innerHTML, `

soup

`); + assert.htmlEqual(target.innerHTML, '

soup

'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/if-block-else-conservative-update/_config.js b/test/runtime/samples/if-block-else-conservative-update/_config.js index 5c90d2ad3a..da83385dd5 100644 --- a/test/runtime/samples/if-block-else-conservative-update/_config.js +++ b/test/runtime/samples/if-block-else-conservative-update/_config.js @@ -15,7 +15,7 @@ export default { } }, - html: `

potato

`, + html: '

potato

', test({ assert, component, target }) { assert.equal(count_a, 1); @@ -26,12 +26,12 @@ export default { assert.equal(count_a, 2); assert.equal(count_b, 1); - assert.htmlEqual(target.innerHTML, `

SOUP

`); + assert.htmlEqual(target.innerHTML, '

SOUP

'); component.foo = 'salad'; assert.equal(count_a, 3); assert.equal(count_b, 1); - assert.htmlEqual(target.innerHTML, `

SALAD

`); + assert.htmlEqual(target.innerHTML, '

SALAD

'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/if-block-else-in-each/_config.js b/test/runtime/samples/if-block-else-in-each/_config.js index 44268f32b9..e75dcb15ee 100644 --- a/test/runtime/samples/if-block-else-in-each/_config.js +++ b/test/runtime/samples/if-block-else-in-each/_config.js @@ -1,9 +1,9 @@ export default { props: { - array: [true, false], + array: [true, false] }, html: `
foo
bar
- `, + ` }; diff --git a/test/runtime/samples/if-block-else-partial-outro/_config.js b/test/runtime/samples/if-block-else-partial-outro/_config.js index a358680edf..ae58d25c23 100644 --- a/test/runtime/samples/if-block-else-partial-outro/_config.js +++ b/test/runtime/samples/if-block-else-partial-outro/_config.js @@ -1,7 +1,7 @@ export default { props: { x: 1, - y: false, + y: false }, html: ` @@ -13,5 +13,5 @@ export default { assert.htmlEqual(target.innerHTML, ` 2 `); - }, + } }; diff --git a/test/runtime/samples/if-block-elseif-no-else/_config.js b/test/runtime/samples/if-block-elseif-no-else/_config.js index ec3379737a..e9696e513c 100644 --- a/test/runtime/samples/if-block-elseif-no-else/_config.js +++ b/test/runtime/samples/if-block-elseif-no-else/_config.js @@ -14,6 +14,6 @@ export default { `); component.x = 6; - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); } }; diff --git a/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js b/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js index b2e71ea01f..da80f5be12 100644 --- a/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js +++ b/test/runtime/samples/if-block-no-outro-else-with-outro/_config.js @@ -18,5 +18,5 @@ export default {

y

`); - }, + } }; diff --git a/test/runtime/samples/if-block-outro-unique-select-block-type/_config.js b/test/runtime/samples/if-block-outro-unique-select-block-type/_config.js index b94da1a576..15213e19b3 100644 --- a/test/runtime/samples/if-block-outro-unique-select-block-type/_config.js +++ b/test/runtime/samples/if-block-outro-unique-select-block-type/_config.js @@ -2,5 +2,5 @@ export default { html: `
- `, + ` }; diff --git a/test/runtime/samples/ignore-unchanged-attribute-compound/counter.js b/test/runtime/samples/ignore-unchanged-attribute-compound/counter.js index 63872cd6a2..f0fc271f84 100644 --- a/test/runtime/samples/ignore-unchanged-attribute-compound/counter.js +++ b/test/runtime/samples/ignore-unchanged-attribute-compound/counter.js @@ -1,3 +1,3 @@ export default { count: 0 -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ignore-unchanged-attribute/counter.js b/test/runtime/samples/ignore-unchanged-attribute/counter.js index 63872cd6a2..f0fc271f84 100644 --- a/test/runtime/samples/ignore-unchanged-attribute/counter.js +++ b/test/runtime/samples/ignore-unchanged-attribute/counter.js @@ -1,3 +1,3 @@ export default { count: 0 -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ignore-unchanged-raw/counter.js b/test/runtime/samples/ignore-unchanged-raw/counter.js index 63872cd6a2..f0fc271f84 100644 --- a/test/runtime/samples/ignore-unchanged-raw/counter.js +++ b/test/runtime/samples/ignore-unchanged-raw/counter.js @@ -1,3 +1,3 @@ export default { count: 0 -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ignore-unchanged-tag/counter.js b/test/runtime/samples/ignore-unchanged-tag/counter.js index 63872cd6a2..f0fc271f84 100644 --- a/test/runtime/samples/ignore-unchanged-tag/counter.js +++ b/test/runtime/samples/ignore-unchanged-tag/counter.js @@ -1,3 +1,3 @@ export default { count: 0 -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/immutable-option/_config.js b/test/runtime/samples/immutable-option/_config.js index 1224d0213a..4962d2d3b7 100644 --- a/test/runtime/samples/immutable-option/_config.js +++ b/test/runtime/samples/immutable-option/_config.js @@ -1,11 +1,11 @@ export default { immutable: true, - html: `

Called 1 times.

`, + html: '

Called 1 times.

', test({ assert, component, target }) { // eslint-disable-next-line no-self-assign component.foo = component.foo; - assert.htmlEqual(target.innerHTML, `

Called 1 times.

`); + assert.htmlEqual(target.innerHTML, '

Called 1 times.

'); } }; diff --git a/test/runtime/samples/immutable-svelte-meta-false/_config.js b/test/runtime/samples/immutable-svelte-meta-false/_config.js index 664f99f087..1506e79227 100644 --- a/test/runtime/samples/immutable-svelte-meta-false/_config.js +++ b/test/runtime/samples/immutable-svelte-meta-false/_config.js @@ -1,11 +1,11 @@ export default { immutable: true, - html: `

Called 1 times.

`, + html: '

Called 1 times.

', test({ assert, component, target }) { // eslint-disable-next-line no-self-assign component.foo = component.foo; - assert.htmlEqual(target.innerHTML, `

Called 2 times.

`); + assert.htmlEqual(target.innerHTML, '

Called 2 times.

'); } }; diff --git a/test/runtime/samples/immutable-svelte-meta/_config.js b/test/runtime/samples/immutable-svelte-meta/_config.js index 4e39f36224..2dfb6cd3db 100644 --- a/test/runtime/samples/immutable-svelte-meta/_config.js +++ b/test/runtime/samples/immutable-svelte-meta/_config.js @@ -1,9 +1,9 @@ export default { - html: `

Called 1 times.

`, + html: '

Called 1 times.

', test({ assert, component, target }) { // eslint-disable-next-line no-self-assign component.foo = component.foo; - assert.htmlEqual(target.innerHTML, `

Called 1 times.

`); + assert.htmlEqual(target.innerHTML, '

Called 1 times.

'); } }; diff --git a/test/runtime/samples/imported-renamed-components/_config.js b/test/runtime/samples/imported-renamed-components/_config.js index 9a9e325b84..07683b05be 100644 --- a/test/runtime/samples/imported-renamed-components/_config.js +++ b/test/runtime/samples/imported-renamed-components/_config.js @@ -1,3 +1,3 @@ export default { - html: `OneTwo` + html: 'OneTwo' }; diff --git a/test/runtime/samples/initial-state-assign/_config.js b/test/runtime/samples/initial-state-assign/_config.js index b4067fef80..95a1a5e068 100644 --- a/test/runtime/samples/initial-state-assign/_config.js +++ b/test/runtime/samples/initial-state-assign/_config.js @@ -3,5 +3,5 @@ export default { html: ` "foo" "bar" - `, + ` }; diff --git a/test/runtime/samples/inline-style-important/_config.js b/test/runtime/samples/inline-style-important/_config.js index b7c8d2c352..53f4e98db3 100644 --- a/test/runtime/samples/inline-style-important/_config.js +++ b/test/runtime/samples/inline-style-important/_config.js @@ -15,4 +15,4 @@ export default { styles = window.getComputedStyle(p); assert.equal(styles.color, 'green'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/inline-style-optimisation-bailout/_config.js b/test/runtime/samples/inline-style-optimisation-bailout/_config.js index 836a3e2e6e..acc41e3160 100644 --- a/test/runtime/samples/inline-style-optimisation-bailout/_config.js +++ b/test/runtime/samples/inline-style-optimisation-bailout/_config.js @@ -17,4 +17,4 @@ export default { assert.equal(styles.color, ''); assert.equal(styles.fontSize, '20px'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/innerhtml-interpolated-literal/_config.js b/test/runtime/samples/innerhtml-interpolated-literal/_config.js index 022c70f717..d2f4d94a31 100644 --- a/test/runtime/samples/innerhtml-interpolated-literal/_config.js +++ b/test/runtime/samples/innerhtml-interpolated-literal/_config.js @@ -4,4 +4,4 @@ export default {
` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/innerhtml-with-comments/_config.js b/test/runtime/samples/innerhtml-with-comments/_config.js index 95d4a6fa96..897d54c573 100644 --- a/test/runtime/samples/innerhtml-with-comments/_config.js +++ b/test/runtime/samples/innerhtml-with-comments/_config.js @@ -5,4 +5,4 @@ export default { Bootstrap. ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-auto-subscription-self-assignment/_config.js b/test/runtime/samples/instrumentation-auto-subscription-self-assignment/_config.js index f70a80fe44..32cd6fc22d 100644 --- a/test/runtime/samples/instrumentation-auto-subscription-self-assignment/_config.js +++ b/test/runtime/samples/instrumentation-auto-subscription-self-assignment/_config.js @@ -1,8 +1,8 @@ export default { - html: `[]`, + html: '[]', async test({ assert, component, target }) { await component.go(); - assert.htmlEqual(target.innerHTML, `[42]`); + assert.htmlEqual(target.innerHTML, '[42]'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-script-destructuring/_config.js b/test/runtime/samples/instrumentation-script-destructuring/_config.js index a0b2de9e77..2b677a8b3a 100644 --- a/test/runtime/samples/instrumentation-script-destructuring/_config.js +++ b/test/runtime/samples/instrumentation-script-destructuring/_config.js @@ -26,4 +26,4 @@ export default {

x: 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-script-loop-scope/_config.js b/test/runtime/samples/instrumentation-script-loop-scope/_config.js index 1195055c45..069114c523 100644 --- a/test/runtime/samples/instrumentation-script-loop-scope/_config.js +++ b/test/runtime/samples/instrumentation-script-loop-scope/_config.js @@ -14,4 +14,4 @@ export default {

x: 42

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js b/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js index c5107e4964..1c4663938f 100644 --- a/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js +++ b/test/runtime/samples/instrumentation-script-multiple-assignments/_config.js @@ -25,4 +25,4 @@ export default {

bar: 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-script-update/_config.js b/test/runtime/samples/instrumentation-script-update/_config.js index 4e97140faf..223904ad63 100644 --- a/test/runtime/samples/instrumentation-script-update/_config.js +++ b/test/runtime/samples/instrumentation-script-update/_config.js @@ -14,4 +14,4 @@ export default {

x: 1

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-template-destructuring/_config.js b/test/runtime/samples/instrumentation-template-destructuring/_config.js index a0b2de9e77..2b677a8b3a 100644 --- a/test/runtime/samples/instrumentation-template-destructuring/_config.js +++ b/test/runtime/samples/instrumentation-template-destructuring/_config.js @@ -26,4 +26,4 @@ export default {

x: 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-template-loop-scope/_config.js b/test/runtime/samples/instrumentation-template-loop-scope/_config.js index 1195055c45..069114c523 100644 --- a/test/runtime/samples/instrumentation-template-loop-scope/_config.js +++ b/test/runtime/samples/instrumentation-template-loop-scope/_config.js @@ -14,4 +14,4 @@ export default {

x: 42

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js b/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js index c5107e4964..1c4663938f 100644 --- a/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js +++ b/test/runtime/samples/instrumentation-template-multiple-assignments/_config.js @@ -25,4 +25,4 @@ export default {

bar: 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/instrumentation-template-update/_config.js b/test/runtime/samples/instrumentation-template-update/_config.js index 4e97140faf..223904ad63 100644 --- a/test/runtime/samples/instrumentation-template-update/_config.js +++ b/test/runtime/samples/instrumentation-template-update/_config.js @@ -14,4 +14,4 @@ export default {

x: 1

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/invalidation-in-if-condition/_config.js b/test/runtime/samples/invalidation-in-if-condition/_config.js index 27209c75c9..25e7811889 100644 --- a/test/runtime/samples/invalidation-in-if-condition/_config.js +++ b/test/runtime/samples/invalidation-in-if-condition/_config.js @@ -1,17 +1,17 @@ export default { - html: ``, + html: '', async test({ assert, target, window }) { const button = target.querySelector('button'); const click = new window.MouseEvent('click'); await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); await button.dispatchEvent(click); - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/isolated-text/_config.js b/test/runtime/samples/isolated-text/_config.js index ec4332be5c..4dc29eb838 100644 --- a/test/runtime/samples/isolated-text/_config.js +++ b/test/runtime/samples/isolated-text/_config.js @@ -3,4 +3,4 @@ export default { before

after

` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/key-block-2/_config.js b/test/runtime/samples/key-block-2/_config.js new file mode 100644 index 0000000000..9bbf1f199f --- /dev/null +++ b/test/runtime/samples/key-block-2/_config.js @@ -0,0 +1,14 @@ +// with reactive content beside `key` +export default { + html: '
00
', + async test({ assert, component, target, window }) { + const div = target.querySelector('div'); + component.reactive = 2; + assert.htmlEqual(target.innerHTML, '
02
'); + assert.strictEqual(div, target.querySelector('div')); + + component.value = 5; + assert.htmlEqual(target.innerHTML, '
52
'); + assert.notStrictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-2/main.svelte b/test/runtime/samples/key-block-2/main.svelte new file mode 100644 index 0000000000..466d20b10a --- /dev/null +++ b/test/runtime/samples/key-block-2/main.svelte @@ -0,0 +1,8 @@ + + +{#key value} +
{value}{reactive}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-3/_config.js b/test/runtime/samples/key-block-3/_config.js new file mode 100644 index 0000000000..17b6146827 --- /dev/null +++ b/test/runtime/samples/key-block-3/_config.js @@ -0,0 +1,11 @@ +// key is not used in the template +export default { + html: '
', + async test({ assert, component, target, window }) { + const div = target.querySelector('div'); + + component.value = 5; + assert.htmlEqual(target.innerHTML, '
'); + assert.notStrictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-3/main.svelte b/test/runtime/samples/key-block-3/main.svelte new file mode 100644 index 0000000000..1ed185c732 --- /dev/null +++ b/test/runtime/samples/key-block-3/main.svelte @@ -0,0 +1,7 @@ + + +{#key value} +
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-array-immutable/_config.js b/test/runtime/samples/key-block-array-immutable/_config.js new file mode 100644 index 0000000000..b1ffd6cd15 --- /dev/null +++ b/test/runtime/samples/key-block-array-immutable/_config.js @@ -0,0 +1,15 @@ +export default { + html: '
1
', + async test({ assert, component, target, window }) { + let div = target.querySelector('div'); + await component.append(2); + assert.htmlEqual(target.innerHTML, '
1
'); + assert.strictEqual(div, target.querySelector('div')); + + div = target.querySelector('div'); + + component.array = [3, 4]; + assert.htmlEqual(target.innerHTML, '
3,4
'); + assert.notStrictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-array-immutable/main.svelte b/test/runtime/samples/key-block-array-immutable/main.svelte new file mode 100644 index 0000000000..e666275af4 --- /dev/null +++ b/test/runtime/samples/key-block-array-immutable/main.svelte @@ -0,0 +1,14 @@ + + + + +{#key array} +
{array.join(',')}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-array/_config.js b/test/runtime/samples/key-block-array/_config.js new file mode 100644 index 0000000000..374175177d --- /dev/null +++ b/test/runtime/samples/key-block-array/_config.js @@ -0,0 +1,15 @@ +export default { + html: '
1
', + async test({ assert, component, target, window }) { + let div = target.querySelector('div'); + await component.append(2); + assert.htmlEqual(target.innerHTML, '
1,2
'); + assert.notStrictEqual(div, target.querySelector('div')); + + div = target.querySelector('div'); + + component.array = [3, 4]; + assert.htmlEqual(target.innerHTML, '
3,4
'); + assert.notStrictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-array/main.svelte b/test/runtime/samples/key-block-array/main.svelte new file mode 100644 index 0000000000..5a4054b043 --- /dev/null +++ b/test/runtime/samples/key-block-array/main.svelte @@ -0,0 +1,12 @@ + + +{#key array} +
{array.join(',')}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-expression-2/_config.js b/test/runtime/samples/key-block-expression-2/_config.js new file mode 100644 index 0000000000..bab23d2a84 --- /dev/null +++ b/test/runtime/samples/key-block-expression-2/_config.js @@ -0,0 +1,18 @@ +export default { + html: '
3
', + async test({ assert, component, target, window }) { + const div = target.querySelector('div'); + + await component.mutate(); + assert.htmlEqual(target.innerHTML, '
5
'); + assert.strictEqual(div, target.querySelector('div')); + + await component.reassign(); + assert.htmlEqual(target.innerHTML, '
7
'); + assert.strictEqual(div, target.querySelector('div')); + + await component.changeKey(); + assert.htmlEqual(target.innerHTML, '
7
'); + assert.notStrictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-expression-2/main.svelte b/test/runtime/samples/key-block-expression-2/main.svelte new file mode 100644 index 0000000000..5525f63761 --- /dev/null +++ b/test/runtime/samples/key-block-expression-2/main.svelte @@ -0,0 +1,17 @@ + + +{#key obj.key} +
{obj.value}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-expression/_config.js b/test/runtime/samples/key-block-expression/_config.js new file mode 100644 index 0000000000..c04d55bd29 --- /dev/null +++ b/test/runtime/samples/key-block-expression/_config.js @@ -0,0 +1,28 @@ +export default { + html: '
000
', + async test({ assert, component, target, window }) { + let div = target.querySelector('div'); + component.value = 2; + assert.htmlEqual(target.innerHTML, '
200
'); + assert.notStrictEqual(div, target.querySelector('div')); + + div = target.querySelector('div'); + + component.anotherValue = 5; + assert.htmlEqual(target.innerHTML, '
250
'); + assert.notStrictEqual(div, target.querySelector('div')); + + div = target.querySelector('div'); + + component.thirdValue = 9; + assert.htmlEqual(target.innerHTML, '
259
'); + assert.strictEqual(div, target.querySelector('div')); + + // make dirty while maintain the value of `value + anotherValue` + // should update the content, but not recreate the elements + await component.$set({ value: 4, anotherValue: 3 }); + + assert.htmlEqual(target.innerHTML, '
439
'); + assert.strictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-expression/main.svelte b/test/runtime/samples/key-block-expression/main.svelte new file mode 100644 index 0000000000..dd752e8b8f --- /dev/null +++ b/test/runtime/samples/key-block-expression/main.svelte @@ -0,0 +1,9 @@ + + +{#key value + anotherValue} +
{value}{anotherValue}{thirdValue}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-static/_config.js b/test/runtime/samples/key-block-static/_config.js new file mode 100644 index 0000000000..8323336615 --- /dev/null +++ b/test/runtime/samples/key-block-static/_config.js @@ -0,0 +1,9 @@ +export default { + html: '
00
', + async test({ assert, component, target, window }) { + const div = target.querySelector('div'); + component.anotherValue = 2; + assert.htmlEqual(target.innerHTML, '
02
'); + assert.strictEqual(div, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-static/main.svelte b/test/runtime/samples/key-block-static/main.svelte new file mode 100644 index 0000000000..e4ee6b5d71 --- /dev/null +++ b/test/runtime/samples/key-block-static/main.svelte @@ -0,0 +1,8 @@ + + +{#key value} +
{value}{anotherValue}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block-transition/_config.js b/test/runtime/samples/key-block-transition/_config.js new file mode 100644 index 0000000000..53de6b333c --- /dev/null +++ b/test/runtime/samples/key-block-transition/_config.js @@ -0,0 +1,24 @@ +export default { + html: '
0
', + async test({ assert, component, target, window, raf }) { + component.value = 2; + + const [div1, div2] = target.querySelectorAll('div'); + + assert.htmlEqual(div1.outerHTML, '
0
'); + assert.htmlEqual(div2.outerHTML, '
2
'); + + raf.tick(0); + + assert.equal(div1.foo, 1); + assert.equal(div1.oof, 0); + + assert.equal(div2.foo, 0); + assert.equal(div2.oof, 1); + + raf.tick(200); + + assert.htmlEqual(target.innerHTML, '
2
'); + assert.equal(div2, target.querySelector('div')); + } +}; diff --git a/test/runtime/samples/key-block-transition/main.svelte b/test/runtime/samples/key-block-transition/main.svelte new file mode 100644 index 0000000000..d7fb6ec024 --- /dev/null +++ b/test/runtime/samples/key-block-transition/main.svelte @@ -0,0 +1,17 @@ + + +{#key value} +
{value}
+{/key} \ No newline at end of file diff --git a/test/runtime/samples/key-block/_config.js b/test/runtime/samples/key-block/_config.js new file mode 100644 index 0000000000..b25ca901f8 --- /dev/null +++ b/test/runtime/samples/key-block/_config.js @@ -0,0 +1,17 @@ +export default { + html: '
0
0
', + async test({ assert, component, target, window }) { + let [div1, div2] = target.querySelectorAll('div'); + + component.value = 5; + assert.htmlEqual(target.innerHTML, '
5
0
'); + assert.notStrictEqual(div1, target.querySelectorAll('div')[0]); + assert.strictEqual(div2, target.querySelectorAll('div')[1]); + [div1, div2] = target.querySelectorAll('div'); + + component.reactive = 10; + assert.htmlEqual(target.innerHTML, '
5
10
'); + assert.strictEqual(div1, target.querySelectorAll('div')[0]); + assert.strictEqual(div2, target.querySelectorAll('div')[1]); + } +}; diff --git a/test/runtime/samples/key-block/main.svelte b/test/runtime/samples/key-block/main.svelte new file mode 100644 index 0000000000..ac3c340770 --- /dev/null +++ b/test/runtime/samples/key-block/main.svelte @@ -0,0 +1,10 @@ + + +{#key value} +
{value}
+{/key} + +
{reactive}
\ No newline at end of file diff --git a/test/runtime/samples/keyed-each-dev-unique/_config.js b/test/runtime/samples/keyed-each-dev-unique/_config.js index 8f46af9d52..81728d9c15 100644 --- a/test/runtime/samples/keyed-each-dev-unique/_config.js +++ b/test/runtime/samples/keyed-each-dev-unique/_config.js @@ -3,5 +3,5 @@ export default { dev: true }, - error: `Cannot have duplicate keys in a keyed each` + error: 'Cannot have duplicate keys in a keyed each' }; diff --git a/test/runtime/samples/lifecycle-render-order-for-children/_config.js b/test/runtime/samples/lifecycle-render-order-for-children/_config.js index 033b593aea..d182d5a97e 100644 --- a/test/runtime/samples/lifecycle-render-order-for-children/_config.js +++ b/test/runtime/samples/lifecycle-render-order-for-children/_config.js @@ -21,7 +21,7 @@ export default { '3: onMount', '3: afterUpdate', '0: onMount', - '0: afterUpdate', + '0: afterUpdate' ]); } else { assert.deepEqual(order, [ @@ -40,10 +40,10 @@ export default { '3: onMount', '3: afterUpdate', '0: onMount', - '0: afterUpdate', + '0: afterUpdate' ]); } order.length = 0; - }, + } }; diff --git a/test/runtime/samples/lifecycle-render-order-for-children/order.js b/test/runtime/samples/lifecycle-render-order-for-children/order.js index 109fa8b38c..d6d1738de6 100644 --- a/test/runtime/samples/lifecycle-render-order-for-children/order.js +++ b/test/runtime/samples/lifecycle-render-order-for-children/order.js @@ -1 +1 @@ -export default []; \ No newline at end of file +export default []; diff --git a/test/runtime/samples/lifecycle-render-order/order.js b/test/runtime/samples/lifecycle-render-order/order.js index 109fa8b38c..d6d1738de6 100644 --- a/test/runtime/samples/lifecycle-render-order/order.js +++ b/test/runtime/samples/lifecycle-render-order/order.js @@ -1 +1 @@ -export default []; \ No newline at end of file +export default []; diff --git a/test/runtime/samples/loop-protect-generator-opt-out/_config.js b/test/runtime/samples/loop-protect-generator-opt-out/_config.js index 9b6a24b513..0fe83a36db 100644 --- a/test/runtime/samples/loop-protect-generator-opt-out/_config.js +++ b/test/runtime/samples/loop-protect-generator-opt-out/_config.js @@ -1,6 +1,6 @@ export default { compileOptions: { dev: true, - loopGuardTimeout: 1, - }, + loopGuardTimeout: 1 + } }; diff --git a/test/runtime/samples/loop-protect-inner-function/_config.js b/test/runtime/samples/loop-protect-inner-function/_config.js index 862d4f4c0f..1b553e2475 100644 --- a/test/runtime/samples/loop-protect-inner-function/_config.js +++ b/test/runtime/samples/loop-protect-inner-function/_config.js @@ -2,6 +2,6 @@ export default { html: '
', compileOptions: { dev: true, - loopGuardTimeout: 100, + loopGuardTimeout: 100 } }; diff --git a/test/runtime/samples/loop-protect/_config.js b/test/runtime/samples/loop-protect/_config.js index 75f75c003d..230bbeb53d 100644 --- a/test/runtime/samples/loop-protect/_config.js +++ b/test/runtime/samples/loop-protect/_config.js @@ -2,6 +2,6 @@ export default { error: 'Infinite loop detected', compileOptions: { dev: true, - loopGuardTimeout: 100, + loopGuardTimeout: 100 } }; diff --git a/test/runtime/samples/module-context-export/_config.js b/test/runtime/samples/module-context-export/_config.js index 902501fdd4..4c4595483a 100644 --- a/test/runtime/samples/module-context-export/_config.js +++ b/test/runtime/samples/module-context-export/_config.js @@ -1,3 +1,3 @@ export default { - html: `

(42)(99)

` -}; \ No newline at end of file + html: '

(42)(99)

' +}; diff --git a/test/runtime/samples/module-context-with-instance-script/_config.js b/test/runtime/samples/module-context-with-instance-script/_config.js index 902501fdd4..4c4595483a 100644 --- a/test/runtime/samples/module-context-with-instance-script/_config.js +++ b/test/runtime/samples/module-context-with-instance-script/_config.js @@ -1,3 +1,3 @@ export default { - html: `

(42)(99)

` -}; \ No newline at end of file + html: '

(42)(99)

' +}; diff --git a/test/runtime/samples/module-context/_config.js b/test/runtime/samples/module-context/_config.js index 0ea26ee446..83138d08f9 100644 --- a/test/runtime/samples/module-context/_config.js +++ b/test/runtime/samples/module-context/_config.js @@ -1,3 +1,3 @@ export default { - html: `

42

` -}; \ No newline at end of file + html: '

42

' +}; diff --git a/test/runtime/samples/mutation-tracking-across-sibling-scopes/_config.js b/test/runtime/samples/mutation-tracking-across-sibling-scopes/_config.js index 038db6dbbb..8d51c61394 100644 --- a/test/runtime/samples/mutation-tracking-across-sibling-scopes/_config.js +++ b/test/runtime/samples/mutation-tracking-across-sibling-scopes/_config.js @@ -9,4 +9,4 @@ export default { assert.htmlEqual(component.div.innerHTML, '
-
-
'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/names-deconflicted/_config.js b/test/runtime/samples/names-deconflicted/_config.js index 07b337a1e8..9ce1010690 100644 --- a/test/runtime/samples/names-deconflicted/_config.js +++ b/test/runtime/samples/names-deconflicted/_config.js @@ -1,5 +1,5 @@ export default { - html: `

1: foo

2: bar

3: baz

`, + html: '

1: foo

2: bar

3: baz

', test({ assert, component, target }) { component.widgets = [ @@ -7,6 +7,6 @@ export default { { name: 'bosh' } ]; - assert.htmlEqual( target.innerHTML, `

1: bish

2: bosh

` ); + assert.htmlEqual( target.innerHTML, '

1: bish

2: bosh

' ); } }; diff --git a/test/runtime/samples/nbsp/_config.js b/test/runtime/samples/nbsp/_config.js index 6322725f98..5cfbc4ca35 100644 --- a/test/runtime/samples/nbsp/_config.js +++ b/test/runtime/samples/nbsp/_config.js @@ -1,8 +1,8 @@ export default { - html: ` `, + html: ' ', test({ assert, component, target }) { const text = target.querySelector( 'span' ).textContent; assert.equal( text.charCodeAt( 0 ), 160 ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/nested-transition-detach-each/_config.js b/test/runtime/samples/nested-transition-detach-each/_config.js index e17fe1bc4d..41d32e597c 100644 --- a/test/runtime/samples/nested-transition-detach-each/_config.js +++ b/test/runtime/samples/nested-transition-detach-each/_config.js @@ -5,7 +5,7 @@ export default { cols: ['a', 'b', 'c'] }, - html: ``, + html: '', compileOptions: { dev: true @@ -34,6 +34,6 @@ export default { component.visible = false; raf.tick(0); raf.tick(100); - assert.htmlEqual(target.innerHTML, ``); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/nested-transition-detach-if-false/_config.js b/test/runtime/samples/nested-transition-detach-if-false/_config.js index d2ae78ffe3..1d42094192 100644 --- a/test/runtime/samples/nested-transition-detach-if-false/_config.js +++ b/test/runtime/samples/nested-transition-detach-if-false/_config.js @@ -20,5 +20,5 @@ export default { a `); - }, + } }; diff --git a/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js b/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js index 6696389e6e..1f2d5561fe 100644 --- a/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js +++ b/test/runtime/samples/nested-transition-if-block-not-remounted/_config.js @@ -11,14 +11,13 @@ export default {
`, - test({ assert, component, target, window, raf }) { + test({ component, target }) { const div = target.querySelector('div'); - const { appendChild, insertBefore } = div; div.appendChild = div.insertBefore = () => { throw new Error('DOM was mutated'); }; component.value = 'two'; - }, + } }; diff --git a/test/runtime/samples/noscript-removal/_config.js b/test/runtime/samples/noscript-removal/_config.js index 35bdcefd96..709792c14a 100644 --- a/test/runtime/samples/noscript-removal/_config.js +++ b/test/runtime/samples/noscript-removal/_config.js @@ -5,5 +5,5 @@ export default {
foo
foo
foo
-`, +` }; diff --git a/test/runtime/samples/numeric-seperator/_config.js b/test/runtime/samples/numeric-seperator/_config.js new file mode 100644 index 0000000000..2b1b5168ee --- /dev/null +++ b/test/runtime/samples/numeric-seperator/_config.js @@ -0,0 +1,3 @@ +export default { + html: '2048 2048' +}; diff --git a/test/runtime/samples/numeric-seperator/main.svelte b/test/runtime/samples/numeric-seperator/main.svelte new file mode 100644 index 0000000000..e491b8a107 --- /dev/null +++ b/test/runtime/samples/numeric-seperator/main.svelte @@ -0,0 +1,5 @@ + + +{num} {2_048} \ No newline at end of file diff --git a/test/runtime/samples/observable-auto-subscribe/_config.js b/test/runtime/samples/observable-auto-subscribe/_config.js index 289a3b51c6..5570413395 100644 --- a/test/runtime/samples/observable-auto-subscribe/_config.js +++ b/test/runtime/samples/observable-auto-subscribe/_config.js @@ -23,7 +23,7 @@ export default { visible: false }, - html: ``, + html: '', async test({ assert, component, target }) { assert.equal(subscribers.length, 0); @@ -46,4 +46,4 @@ export default { assert.equal(subscribers.length, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ondestroy-before-cleanup/_config.js b/test/runtime/samples/ondestroy-before-cleanup/_config.js index e9721f24b0..e33b154b64 100644 --- a/test/runtime/samples/ondestroy-before-cleanup/_config.js +++ b/test/runtime/samples/ondestroy-before-cleanup/_config.js @@ -4,10 +4,9 @@ export default { test({ assert, component, target }) { container.div = null; - const top = component.top; const div = target.querySelector('div'); component.visible = false; assert.equal(container.div, div); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ondestroy-before-cleanup/container.js b/test/runtime/samples/ondestroy-before-cleanup/container.js index 7c645e42fb..ff8b4c5632 100644 --- a/test/runtime/samples/ondestroy-before-cleanup/container.js +++ b/test/runtime/samples/ondestroy-before-cleanup/container.js @@ -1 +1 @@ -export default {}; \ No newline at end of file +export default {}; diff --git a/test/runtime/samples/ondestroy-deep/_config.js b/test/runtime/samples/ondestroy-deep/_config.js index 4431a2e163..3f82e8b601 100644 --- a/test/runtime/samples/ondestroy-deep/_config.js +++ b/test/runtime/samples/ondestroy-deep/_config.js @@ -7,4 +7,4 @@ export default { reset(); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/ondestroy-deep/destroyed.js b/test/runtime/samples/ondestroy-deep/destroyed.js index fe05c1d241..45845cbd83 100644 --- a/test/runtime/samples/ondestroy-deep/destroyed.js +++ b/test/runtime/samples/ondestroy-deep/destroyed.js @@ -1,3 +1,3 @@ export const destroyed = []; -export const reset = () => destroyed.length = 0; \ No newline at end of file +export const reset = () => destroyed.length = 0; diff --git a/test/runtime/samples/onmount-fires-when-ready-nested/_config.js b/test/runtime/samples/onmount-fires-when-ready-nested/_config.js index b7446c1d72..4f7ec9b051 100644 --- a/test/runtime/samples/onmount-fires-when-ready-nested/_config.js +++ b/test/runtime/samples/onmount-fires-when-ready-nested/_config.js @@ -1,5 +1,5 @@ export default { skip_if_ssr: true, // uses oncreate - html: `

true

\n

true

` + html: '

true

\n

true

' }; diff --git a/test/runtime/samples/onmount-fires-when-ready/_config.js b/test/runtime/samples/onmount-fires-when-ready/_config.js index de095cbdb7..ca9f535c19 100644 --- a/test/runtime/samples/onmount-fires-when-ready/_config.js +++ b/test/runtime/samples/onmount-fires-when-ready/_config.js @@ -1,10 +1,10 @@ export default { skip_if_ssr: true, // uses oncreate - html: `

true

`, + html: '

true

', test({ assert, component, target }) { component.foo = true; - assert.htmlEqual(target.innerHTML, `

true

\n

true

`); + assert.htmlEqual(target.innerHTML, '

true

\n

true

'); } }; diff --git a/test/runtime/samples/onmount-get-current-component/_config.js b/test/runtime/samples/onmount-get-current-component/_config.js new file mode 100644 index 0000000000..6c5c666cf0 --- /dev/null +++ b/test/runtime/samples/onmount-get-current-component/_config.js @@ -0,0 +1,4 @@ +export default { + skip_if_ssr: true, + html: '1' +}; diff --git a/test/runtime/samples/onmount-get-current-component/main.svelte b/test/runtime/samples/onmount-get-current-component/main.svelte new file mode 100644 index 0000000000..de64bc65fa --- /dev/null +++ b/test/runtime/samples/onmount-get-current-component/main.svelte @@ -0,0 +1,16 @@ + + +{gotException} diff --git a/test/runtime/samples/onmount-sibling-order/result.js b/test/runtime/samples/onmount-sibling-order/result.js index 109fa8b38c..d6d1738de6 100644 --- a/test/runtime/samples/onmount-sibling-order/result.js +++ b/test/runtime/samples/onmount-sibling-order/result.js @@ -1 +1 @@ -export default []; \ No newline at end of file +export default []; diff --git a/test/runtime/samples/option-without-select/_config.js b/test/runtime/samples/option-without-select/_config.js index 48303961ad..9925069bb1 100644 --- a/test/runtime/samples/option-without-select/_config.js +++ b/test/runtime/samples/option-without-select/_config.js @@ -3,7 +3,7 @@ export default { foo: 'hello' }, - html: ``, + html: "", test({ assert, component, target }) { component.foo = 'goodbye'; @@ -11,4 +11,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/paren-wrapped-expressions/_config.js b/test/runtime/samples/paren-wrapped-expressions/_config.js index 0c757dc854..972dc51cb0 100644 --- a/test/runtime/samples/paren-wrapped-expressions/_config.js +++ b/test/runtime/samples/paren-wrapped-expressions/_config.js @@ -2,7 +2,7 @@ export default { props: { a: 'foo', b: true, - c: [ 1, 2, 3 ], + c: [ 1, 2, 3 ] }, html: ` diff --git a/test/runtime/samples/preload/_config.js b/test/runtime/samples/preload/_config.js index 1b35ebbe74..d7d5fd0851 100644 --- a/test/runtime/samples/preload/_config.js +++ b/test/runtime/samples/preload/_config.js @@ -2,4 +2,4 @@ export default { test({ assert, mod }) { assert.deepEqual(mod.preload({ foo: 1 }), { bar: 2 }); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/prop-const/_config.js b/test/runtime/samples/prop-const/_config.js index 489a48476f..991063a754 100644 --- a/test/runtime/samples/prop-const/_config.js +++ b/test/runtime/samples/prop-const/_config.js @@ -20,4 +20,4 @@ export default {

b: 2

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/prop-exports/_config.js b/test/runtime/samples/prop-exports/_config.js index e1620c015f..69a40c4fab 100644 --- a/test/runtime/samples/prop-exports/_config.js +++ b/test/runtime/samples/prop-exports/_config.js @@ -10,7 +10,7 @@ export default { a2: 4, a6: writable(29), for: 'loop', - continue: '...', + continue: '...' }, html: ` diff --git a/test/runtime/samples/prop-not-action/_config.js b/test/runtime/samples/prop-not-action/_config.js index 17ab47b584..1f4ffa4749 100644 --- a/test/runtime/samples/prop-not-action/_config.js +++ b/test/runtime/samples/prop-not-action/_config.js @@ -6,4 +6,4 @@ export default { html: `

Hello world!

` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/prop-quoted/_config.js b/test/runtime/samples/prop-quoted/_config.js index d982bc87cc..aa2f2ec329 100644 --- a/test/runtime/samples/prop-quoted/_config.js +++ b/test/runtime/samples/prop-quoted/_config.js @@ -3,10 +3,10 @@ export default { foo: 1 }, - html: `1`, + html: '1', async test({ assert, component, target }) { component.foo = 2; - assert.htmlEqual(target.innerHTML, `2`); + assert.htmlEqual(target.innerHTML, '2'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/prop-subscribable/_config.js b/test/runtime/samples/prop-subscribable/_config.js index 84cde8c9af..fcd8fb8b07 100644 --- a/test/runtime/samples/prop-subscribable/_config.js +++ b/test/runtime/samples/prop-subscribable/_config.js @@ -8,4 +8,4 @@ export default { html: ` 42 ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/prop-without-semicolon-b/_config.js b/test/runtime/samples/prop-without-semicolon-b/_config.js index 7104dc2b2d..6cdc86c521 100644 --- a/test/runtime/samples/prop-without-semicolon-b/_config.js +++ b/test/runtime/samples/prop-without-semicolon-b/_config.js @@ -3,5 +3,5 @@ export default { name: 'world' }, - html: `

Hello world!

` -}; \ No newline at end of file + html: '

Hello world!

' +}; diff --git a/test/runtime/samples/prop-without-semicolon/_config.js b/test/runtime/samples/prop-without-semicolon/_config.js index 328d6cc2eb..26b3554f9f 100644 --- a/test/runtime/samples/prop-without-semicolon/_config.js +++ b/test/runtime/samples/prop-without-semicolon/_config.js @@ -1,3 +1,3 @@ export default { - html: `

Hello world!

` -}; \ No newline at end of file + html: '

Hello world!

' +}; diff --git a/test/runtime/samples/props-reactive-b/_config.js b/test/runtime/samples/props-reactive-b/_config.js index 43eaee23aa..541fd26e02 100644 --- a/test/runtime/samples/props-reactive-b/_config.js +++ b/test/runtime/samples/props-reactive-b/_config.js @@ -27,4 +27,4 @@ export default {

c: 9

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/props-reactive-only-with-change/_config.js b/test/runtime/samples/props-reactive-only-with-change/_config.js index 04170620c8..dcf12868f9 100644 --- a/test/runtime/samples/props-reactive-only-with-change/_config.js +++ b/test/runtime/samples/props-reactive-only-with-change/_config.js @@ -3,8 +3,8 @@ let callbacks = []; export default { props: { callback: (value) => callbacks.push(value), - val1: "1", - val2: "2", + val1: '1', + val2: '2' }, before_test() { @@ -15,16 +15,16 @@ export default { assert.equal(callbacks.length, 2); assert.equal(JSON.stringify(callbacks), '["1","2"]'); - component.val1 = "3"; + component.val1 = '3'; assert.equal(callbacks.length, 3); assert.equal(JSON.stringify(callbacks), '["1","2","1"]'); - component.val1 = "4"; + component.val1 = '4'; assert.equal(callbacks.length, 4); assert.equal(JSON.stringify(callbacks), '["1","2","1","1"]'); - component.val2 = "5"; + component.val2 = '5'; assert.equal(callbacks.length, 5); assert.equal(JSON.stringify(callbacks), '["1","2","1","1","2"]'); - }, + } }; diff --git a/test/runtime/samples/props-reactive-slot/_config.js b/test/runtime/samples/props-reactive-slot/_config.js index 286bba2f08..266f0fc8a8 100644 --- a/test/runtime/samples/props-reactive-slot/_config.js +++ b/test/runtime/samples/props-reactive-slot/_config.js @@ -5,8 +5,8 @@ export default { `, async test({ assert, component, target, window }) { - const btn = target.querySelector("button"); - const clickEvent = new window.MouseEvent("click"); + const btn = target.querySelector('button'); + const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); @@ -17,5 +17,5 @@ export default { ` ); - }, + } }; diff --git a/test/runtime/samples/props-reactive/_config.js b/test/runtime/samples/props-reactive/_config.js index a44687069e..4c27ac0618 100644 --- a/test/runtime/samples/props-reactive/_config.js +++ b/test/runtime/samples/props-reactive/_config.js @@ -17,4 +17,4 @@ export default {

5

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/props/_config.js b/test/runtime/samples/props/_config.js index fc3c71d6f0..64015cdc6b 100644 --- a/test/runtime/samples/props/_config.js +++ b/test/runtime/samples/props/_config.js @@ -14,4 +14,4 @@ export default {

{"x":2}

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/raw-anchor-first-child/_config.js b/test/runtime/samples/raw-anchor-first-child/_config.js index 32f948bcbb..02297675c5 100644 --- a/test/runtime/samples/raw-anchor-first-child/_config.js +++ b/test/runtime/samples/raw-anchor-first-child/_config.js @@ -1,12 +1,12 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { const span = target.querySelector('span'); assert.ok(!span.previousSibling); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-anchor-first-last-child/_config.js b/test/runtime/samples/raw-anchor-first-last-child/_config.js index 31f8c343ed..30acfe4d0f 100644 --- a/test/runtime/samples/raw-anchor-first-last-child/_config.js +++ b/test/runtime/samples/raw-anchor-first-last-child/_config.js @@ -1,6 +1,6 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { @@ -8,6 +8,6 @@ export default { assert.ok(!span.previousSibling); assert.ok(!span.nextSibling); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-anchor-last-child/_config.js b/test/runtime/samples/raw-anchor-last-child/_config.js index ea2217b4c1..dcc8ac6db6 100644 --- a/test/runtime/samples/raw-anchor-last-child/_config.js +++ b/test/runtime/samples/raw-anchor-last-child/_config.js @@ -1,12 +1,12 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { const span = target.querySelector('span'); assert.ok(!span.nextSibling); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-anchor-next-previous-sibling/_config.js b/test/runtime/samples/raw-anchor-next-previous-sibling/_config.js index d28e84fc3b..c6d2b561c0 100644 --- a/test/runtime/samples/raw-anchor-next-previous-sibling/_config.js +++ b/test/runtime/samples/raw-anchor-next-previous-sibling/_config.js @@ -1,6 +1,6 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { @@ -8,6 +8,6 @@ export default { assert.equal(span.previousSibling.nodeName, 'BR'); assert.equal(span.nextSibling.nodeName, 'BR'); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-anchor-next-sibling/_config.js b/test/runtime/samples/raw-anchor-next-sibling/_config.js index dc6ad98e2e..1982f28da5 100644 --- a/test/runtime/samples/raw-anchor-next-sibling/_config.js +++ b/test/runtime/samples/raw-anchor-next-sibling/_config.js @@ -1,12 +1,12 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { const span = target.querySelector('span'); assert.equal(span.previousSibling.nodeName, 'BR'); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-anchor-previous-sibling/_config.js b/test/runtime/samples/raw-anchor-previous-sibling/_config.js index dc6ad98e2e..1982f28da5 100644 --- a/test/runtime/samples/raw-anchor-previous-sibling/_config.js +++ b/test/runtime/samples/raw-anchor-previous-sibling/_config.js @@ -1,12 +1,12 @@ export default { props: { - raw: `foo` + raw: 'foo' }, test({ assert, component, target }) { const span = target.querySelector('span'); assert.equal(span.previousSibling.nodeName, 'BR'); - component.raw = `bar`; + component.raw = 'bar'; } }; diff --git a/test/runtime/samples/raw-mustache-as-root/_config.js b/test/runtime/samples/raw-mustache-as-root/_config.js index c87971a7f0..a38c0b1c81 100644 --- a/test/runtime/samples/raw-mustache-as-root/_config.js +++ b/test/runtime/samples/raw-mustache-as-root/_config.js @@ -5,8 +5,8 @@ export default {

This line should be last.

`, async test({ assert, target, window }) { - const btn = target.querySelector("button"); - const clickEvent = new window.MouseEvent("click"); + const btn = target.querySelector('button'); + const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); @@ -29,5 +29,5 @@ export default {

This line should be last.

` ); - }, + } }; diff --git a/test/runtime/samples/raw-mustache-before-element/_config.js b/test/runtime/samples/raw-mustache-before-element/_config.js index 61288cbb52..e00ca11a20 100644 --- a/test/runtime/samples/raw-mustache-before-element/_config.js +++ b/test/runtime/samples/raw-mustache-before-element/_config.js @@ -1,3 +1,3 @@ export default { - html: `

xbaz

` + html: '

xbaz

' }; diff --git a/test/runtime/samples/raw-mustache-inside-head/_config.js b/test/runtime/samples/raw-mustache-inside-head/_config.js index 4a84f5c01d..6d28a6e8c4 100644 --- a/test/runtime/samples/raw-mustache-inside-head/_config.js +++ b/test/runtime/samples/raw-mustache-inside-head/_config.js @@ -1,7 +1,7 @@ export default { async test({ assert, target, window }) { - const btn = target.querySelector("button"); - const clickEvent = new window.MouseEvent("click"); + const btn = target.querySelector('button'); + const clickEvent = new window.MouseEvent('click'); assert.equal(window.document.head.innerHTML.includes(''), true); @@ -12,5 +12,5 @@ export default { await btn.dispatchEvent(clickEvent); assert.equal(window.document.head.innerHTML.includes(''), true); - }, + } }; diff --git a/test/runtime/samples/raw-mustache-inside-slot/_config.js b/test/runtime/samples/raw-mustache-inside-slot/_config.js index c87971a7f0..a38c0b1c81 100644 --- a/test/runtime/samples/raw-mustache-inside-slot/_config.js +++ b/test/runtime/samples/raw-mustache-inside-slot/_config.js @@ -5,8 +5,8 @@ export default {

This line should be last.

`, async test({ assert, target, window }) { - const btn = target.querySelector("button"); - const clickEvent = new window.MouseEvent("click"); + const btn = target.querySelector('button'); + const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); @@ -29,5 +29,5 @@ export default {

This line should be last.

` ); - }, + } }; diff --git a/test/runtime/samples/raw-mustaches-preserved/_config.js b/test/runtime/samples/raw-mustaches-preserved/_config.js index 66b829f7cb..d4d57025d2 100644 --- a/test/runtime/samples/raw-mustaches-preserved/_config.js +++ b/test/runtime/samples/raw-mustaches-preserved/_config.js @@ -5,13 +5,13 @@ export default { raw: '

does not change

' }, - html: `

does not change

`, + html: '

does not change

', test({ assert, component, target }) { const p = target.querySelector('p'); component.raw = '

does not change

'; - assert.equal(target.innerHTML, `

does not change

`); + assert.equal(target.innerHTML, '

does not change

'); assert.strictEqual(target.querySelector('p'), p); } }; diff --git a/test/runtime/samples/raw-mustaches-td-tr/_config.js b/test/runtime/samples/raw-mustaches-td-tr/_config.js index dfcb1ce0f0..3b165bb65e 100644 --- a/test/runtime/samples/raw-mustaches-td-tr/_config.js +++ b/test/runtime/samples/raw-mustaches-td-tr/_config.js @@ -1,6 +1,6 @@ export default { props: { - raw: "12", + raw: '12' }, html: ` @@ -14,5 +14,5 @@ export default { - `, + ` }; diff --git a/test/runtime/samples/raw-mustaches/_config.js b/test/runtime/samples/raw-mustaches/_config.js index cc9999aa34..9eda8289ce 100644 --- a/test/runtime/samples/raw-mustaches/_config.js +++ b/test/runtime/samples/raw-mustaches/_config.js @@ -5,13 +5,13 @@ export default { raw: 'raw html!!!\\o/' }, - html: `beforeraw html!!!\\o/after`, + html: 'beforeraw html!!!\\o/after', test({ assert, component, target }) { component.raw = ''; - assert.equal(target.innerHTML, `beforeafter`); + assert.equal(target.innerHTML, 'beforeafter'); component.raw = 'how about unclosed elements?'; - assert.equal(target.innerHTML, `beforehow about unclosed elements?after`); + assert.equal(target.innerHTML, 'beforehow about unclosed elements?after'); component.$destroy(); assert.equal(target.innerHTML, ''); } diff --git a/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js b/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js index f0bf2cdc70..0402f34a2f 100644 --- a/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js +++ b/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js @@ -1,3 +1,3 @@ export default { - html: `

1 1

` -}; \ No newline at end of file + html: '

1 1

' +}; diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/_config.js b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/_config.js new file mode 100644 index 0000000000..a22aa878ff --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/_config.js @@ -0,0 +1,9 @@ +// destructure to store value +export default { + skip_if_ssr: true, // pending https://github.com/sveltejs/svelte/issues/3582 + html: '

2 2 xxx 5 6 9 10 2

', + async test({ assert, target, component }) { + await component.update(); + assert.htmlEqual(target.innerHTML, '

11 11 yyy 12 13 14 15 11

'); + } +}; diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/main.svelte b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/main.svelte new file mode 100644 index 0000000000..c1bf63d9cd --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store-2/main.svelte @@ -0,0 +1,29 @@ + + +

{foo} {$eid} {$u.name} {$v} {$w} {$x} {$y} {$z}

diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/_config.js b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/_config.js new file mode 100644 index 0000000000..6a613f73c4 --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/_config.js @@ -0,0 +1,9 @@ +// destructure to store +export default { + html: '

2 2 xxx 5 6 9 10 2

', + skip_if_ssr: true, + async test({ assert, target, component }) { + await component.update(); + assert.htmlEqual(target.innerHTML, '

11 11 yyy 12 13 14 15 11

'); + } +}; diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/main.svelte b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/main.svelte new file mode 100644 index 0000000000..cd49223535 --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration-with-store/main.svelte @@ -0,0 +1,29 @@ + + +

{foo} {$eid} {u.name} {v} {$w} {$x} {$y} {$z}

diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js b/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js index d17a81e052..0636620619 100644 --- a/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js @@ -1,3 +1,3 @@ export default { - html: `

2 2

` -}; \ No newline at end of file + html: '

2 2

' +}; diff --git a/test/runtime/samples/reactive-assignment-in-declaration/_config.js b/test/runtime/samples/reactive-assignment-in-declaration/_config.js index f0bf2cdc70..0402f34a2f 100644 --- a/test/runtime/samples/reactive-assignment-in-declaration/_config.js +++ b/test/runtime/samples/reactive-assignment-in-declaration/_config.js @@ -1,3 +1,3 @@ export default { - html: `

1 1

` -}; \ No newline at end of file + html: '

1 1

' +}; diff --git a/test/runtime/samples/reactive-assignment-in-declaration/main.svelte b/test/runtime/samples/reactive-assignment-in-declaration/main.svelte index 8aa05964dd..edac4427bb 100644 --- a/test/runtime/samples/reactive-assignment-in-declaration/main.svelte +++ b/test/runtime/samples/reactive-assignment-in-declaration/main.svelte @@ -1,6 +1,9 @@

{foo} {bar}

diff --git a/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js b/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js index df64f577df..8f57423d5c 100644 --- a/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js +++ b/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js @@ -1,3 +1,3 @@ export default { - html: `

0 0

` -}; \ No newline at end of file + html: '

0 0

' +}; diff --git a/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte b/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte index 1c24f364ac..b007f6fe8b 100644 --- a/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte +++ b/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte @@ -1,9 +1,14 @@

{foo1} {foo2}

diff --git a/test/runtime/samples/reactive-block-break/_config.js b/test/runtime/samples/reactive-block-break/_config.js index f2d3e6a8f5..e00bb9f480 100644 --- a/test/runtime/samples/reactive-block-break/_config.js +++ b/test/runtime/samples/reactive-block-break/_config.js @@ -1,3 +1,3 @@ export default { - html: `

1 2

` -}; \ No newline at end of file + html: '

1 2

' +}; diff --git a/test/runtime/samples/reactive-function-called-reassigned/_config.js b/test/runtime/samples/reactive-function-called-reassigned/_config.js index 317173f8eb..7b2a8b72fe 100644 --- a/test/runtime/samples/reactive-function-called-reassigned/_config.js +++ b/test/runtime/samples/reactive-function-called-reassigned/_config.js @@ -7,7 +7,7 @@ function callback(_value) { export default { props: { - callback, + callback }, async test({ assert, component, target, window }) { assert.equal(called, 1); diff --git a/test/runtime/samples/reactive-import-statement-2/_config.js b/test/runtime/samples/reactive-import-statement-2/_config.js index ccc97cd076..fc6d8f008d 100644 --- a/test/runtime/samples/reactive-import-statement-2/_config.js +++ b/test/runtime/samples/reactive-import-statement-2/_config.js @@ -1,3 +1,3 @@ export default { - html: `

prop value

` + html: '

prop value

' }; diff --git a/test/runtime/samples/reactive-import-statement/_config.js b/test/runtime/samples/reactive-import-statement/_config.js index 7fb8097ca5..45a844afa0 100644 --- a/test/runtime/samples/reactive-import-statement/_config.js +++ b/test/runtime/samples/reactive-import-statement/_config.js @@ -11,7 +11,7 @@ export default { before_test() { delete require.cache[path.resolve(__dirname, 'data.js')]; }, - async test({ assert, target, window, }) { + async test({ assert, target, window }) { const btn = target.querySelector('button'); const clickEvent = new window.MouseEvent('click'); diff --git a/test/runtime/samples/reactive-import-statement/data.js b/test/runtime/samples/reactive-import-statement/data.js index ad494c7cb0..22f2f374ab 100644 --- a/test/runtime/samples/reactive-import-statement/data.js +++ b/test/runtime/samples/reactive-import-statement/data.js @@ -1 +1 @@ -export const numbers = [1, 2, 3, 4]; \ No newline at end of file +export const numbers = [1, 2, 3, 4]; diff --git a/test/runtime/samples/reactive-value-assign-property/_config.js b/test/runtime/samples/reactive-value-assign-property/_config.js new file mode 100644 index 0000000000..b6d8bf51be --- /dev/null +++ b/test/runtime/samples/reactive-value-assign-property/_config.js @@ -0,0 +1,5 @@ +export default { + html: ` +

Hello world!

+ ` +}; diff --git a/test/runtime/samples/reactive-value-assign-property/main.svelte b/test/runtime/samples/reactive-value-assign-property/main.svelte new file mode 100644 index 0000000000..58e0fdb03c --- /dev/null +++ b/test/runtime/samples/reactive-value-assign-property/main.svelte @@ -0,0 +1,6 @@ + + +

Hello {user.name}!

\ No newline at end of file diff --git a/test/runtime/samples/reactive-value-coerce/_config.js b/test/runtime/samples/reactive-value-coerce/_config.js index 7d8bcb6b50..9cf9d7d8ee 100644 --- a/test/runtime/samples/reactive-value-coerce/_config.js +++ b/test/runtime/samples/reactive-value-coerce/_config.js @@ -1,10 +1,10 @@ export default { - html: `1-1`, + html: '1-1', test: ({ assert, component, target }) => { component.a.b[0] = 2; component.a = component.a; // eslint-disable-line no-self-assign - assert.htmlEqual(target.innerHTML, `2-2`); + assert.htmlEqual(target.innerHTML, '2-2'); } }; diff --git a/test/runtime/samples/reactive-value-function/_config.js b/test/runtime/samples/reactive-value-function/_config.js index c2de1af713..2a84953576 100644 --- a/test/runtime/samples/reactive-value-function/_config.js +++ b/test/runtime/samples/reactive-value-function/_config.js @@ -1,9 +1,9 @@ export default { - html: `1-2`, + html: '1-2', async test({ assert, component, target }) { await component.update(); - assert.htmlEqual(target.innerHTML, `3-4`); + assert.htmlEqual(target.innerHTML, '3-4'); } }; diff --git a/test/runtime/samples/reactive-value-mutate/_config.js b/test/runtime/samples/reactive-value-mutate/_config.js index e408816834..66979f1e31 100644 --- a/test/runtime/samples/reactive-value-mutate/_config.js +++ b/test/runtime/samples/reactive-value-mutate/_config.js @@ -1,3 +1,3 @@ export default { - html: `{"bar":42}` + html: '{"bar":42}' }; diff --git a/test/runtime/samples/script-style-non-top-level/_config.js b/test/runtime/samples/script-style-non-top-level/_config.js index 86eddf4611..22186b345d 100644 --- a/test/runtime/samples/script-style-non-top-level/_config.js +++ b/test/runtime/samples/script-style-non-top-level/_config.js @@ -5,4 +5,4 @@ export default {
` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/select-no-whitespace/_config.js b/test/runtime/samples/select-no-whitespace/_config.js index 7388527849..fbd4990317 100644 --- a/test/runtime/samples/select-no-whitespace/_config.js +++ b/test/runtime/samples/select-no-whitespace/_config.js @@ -3,4 +3,4 @@ export default { const select = target.querySelector( 'select' ); assert.equal( select.childNodes.length, 3 ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/self-reference-component/_config.js b/test/runtime/samples/self-reference-component/_config.js index e3e0ad3a4f..c3456b59c2 100644 --- a/test/runtime/samples/self-reference-component/_config.js +++ b/test/runtime/samples/self-reference-component/_config.js @@ -1,3 +1,3 @@ export default { - html: '5 4 3 2 1 0', -}; \ No newline at end of file + html: '5 4 3 2 1 0' +}; diff --git a/test/runtime/samples/self-reference-tree/_config.js b/test/runtime/samples/self-reference-tree/_config.js index 581f03eade..cfa7528d31 100644 --- a/test/runtime/samples/self-reference-tree/_config.js +++ b/test/runtime/samples/self-reference-tree/_config.js @@ -62,4 +62,4 @@ export default { ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/self-reference/_config.js b/test/runtime/samples/self-reference/_config.js index 69be606bbe..1bcb660621 100644 --- a/test/runtime/samples/self-reference/_config.js +++ b/test/runtime/samples/self-reference/_config.js @@ -11,4 +11,4 @@ export default { 1 0 ` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/semicolon-hoisting/_config.js b/test/runtime/samples/semicolon-hoisting/_config.js index 88d81cdc9e..22dc25b41e 100644 --- a/test/runtime/samples/semicolon-hoisting/_config.js +++ b/test/runtime/samples/semicolon-hoisting/_config.js @@ -1,3 +1,3 @@ export default { - html: `` -}; \ No newline at end of file + html: '' +}; diff --git a/test/runtime/samples/set-after-destroy/_config.js b/test/runtime/samples/set-after-destroy/_config.js index 9d79329546..063c133b87 100644 --- a/test/runtime/samples/set-after-destroy/_config.js +++ b/test/runtime/samples/set-after-destroy/_config.js @@ -7,4 +7,4 @@ export default { component.$destroy(); component.x = 2; } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/set-null-text-node/_config.js b/test/runtime/samples/set-null-text-node/_config.js index 6bc775f3b7..a106ee9069 100644 --- a/test/runtime/samples/set-null-text-node/_config.js +++ b/test/runtime/samples/set-null-text-node/_config.js @@ -10,4 +10,4 @@ export default { component.foo = null; assert.htmlEqual(target.innerHTML, 'foo is null'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/set-undefined-attr/_config.js b/test/runtime/samples/set-undefined-attr/_config.js index b23f51dfc9..49c4216e57 100644 --- a/test/runtime/samples/set-undefined-attr/_config.js +++ b/test/runtime/samples/set-undefined-attr/_config.js @@ -1,5 +1,5 @@ export default { - html: `
`, + html: "
", - ssrHtml: `
`, + ssrHtml: "
" }; diff --git a/test/runtime/samples/shorthand-method-in-template/_config.js b/test/runtime/samples/shorthand-method-in-template/_config.js index ddd282644d..b097a46716 100644 --- a/test/runtime/samples/shorthand-method-in-template/_config.js +++ b/test/runtime/samples/shorthand-method-in-template/_config.js @@ -1,3 +1,3 @@ export default { html: '42' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/sigil-component-prop/_config.js b/test/runtime/samples/sigil-component-prop/_config.js index 2f467bb9d4..105f8b468c 100644 --- a/test/runtime/samples/sigil-component-prop/_config.js +++ b/test/runtime/samples/sigil-component-prop/_config.js @@ -3,5 +3,5 @@ export default { dev: true }, props: { foo: 'foo' }, - html: `
foo @ foo # foo
`, + html: '
foo @ foo # foo
' }; diff --git a/test/runtime/samples/sigil-expression-function-body/_config.js b/test/runtime/samples/sigil-expression-function-body/_config.js index fccd0db2d0..8d88d1fd08 100644 --- a/test/runtime/samples/sigil-expression-function-body/_config.js +++ b/test/runtime/samples/sigil-expression-function-body/_config.js @@ -1,3 +1,3 @@ export default { - html: `@foo` + html: '@foo' }; diff --git a/test/runtime/samples/sigil-static-#/_config.js b/test/runtime/samples/sigil-static-#/_config.js index 747ddc2a94..3bf2601f70 100644 --- a/test/runtime/samples/sigil-static-#/_config.js +++ b/test/runtime/samples/sigil-static-#/_config.js @@ -1,3 +1,3 @@ export default { - html: `#foo` -}; \ No newline at end of file + html: '#foo' +}; diff --git a/test/runtime/samples/sigil-static-@/_config.js b/test/runtime/samples/sigil-static-@/_config.js index ada3a602ab..8d88d1fd08 100644 --- a/test/runtime/samples/sigil-static-@/_config.js +++ b/test/runtime/samples/sigil-static-@/_config.js @@ -1,3 +1,3 @@ export default { - html: `@foo` -}; \ No newline at end of file + html: '@foo' +}; diff --git a/test/runtime/samples/slot-if-block-update-no-anchor/_config.js b/test/runtime/samples/slot-if-block-update-no-anchor/_config.js index 060cbaa619..f05d79c265 100644 --- a/test/runtime/samples/slot-if-block-update-no-anchor/_config.js +++ b/test/runtime/samples/slot-if-block-update-no-anchor/_config.js @@ -1,7 +1,7 @@ export default { test({ assert, target, component }) { - assert.htmlEqual(target.innerHTML, ``); + assert.htmlEqual(target.innerHTML, ''); component.enabled = true; - assert.htmlEqual(target.innerHTML, `enabled`); - }, + assert.htmlEqual(target.innerHTML, 'enabled'); + } }; diff --git a/test/runtime/samples/slot-in-custom-element/_config.js b/test/runtime/samples/slot-in-custom-element/_config.js index f17cc9adcb..a0b97ec6d0 100644 --- a/test/runtime/samples/slot-in-custom-element/_config.js +++ b/test/runtime/samples/slot-in-custom-element/_config.js @@ -4,4 +4,4 @@ export default {
header header header
` -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/spread-component-2/_config.js b/test/runtime/samples/spread-component-2/_config.js index 6d36e8e60d..e5441bc4b9 100644 --- a/test/runtime/samples/spread-component-2/_config.js +++ b/test/runtime/samples/spread-component-2/_config.js @@ -10,7 +10,7 @@ export default { baz: 50 + 2, qux: 1, quux: 'quuxx' - }], + }] }, html: ` diff --git a/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js b/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js index c5e23a023c..d7ad47b01f 100644 --- a/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-component-dynamic-non-object-multiple-dependencies/_config.js @@ -2,7 +2,7 @@ export default { props: { props: { foo: 'lol', - baz: 40 + 2, + baz: 40 + 2 } }, diff --git a/test/runtime/samples/spread-component-dynamic-non-object/_config.js b/test/runtime/samples/spread-component-dynamic-non-object/_config.js index 094f2fbb9b..fa8de8ad94 100644 --- a/test/runtime/samples/spread-component-dynamic-non-object/_config.js +++ b/test/runtime/samples/spread-component-dynamic-non-object/_config.js @@ -2,7 +2,7 @@ export default { props: { props: { foo: 'lol', - baz: 40 + 2, + baz: 40 + 2 } }, diff --git a/test/runtime/samples/spread-component-dynamic-undefined/_config.js b/test/runtime/samples/spread-component-dynamic-undefined/_config.js index 09e5f87c14..ba41df3e54 100644 --- a/test/runtime/samples/spread-component-dynamic-undefined/_config.js +++ b/test/runtime/samples/spread-component-dynamic-undefined/_config.js @@ -1,17 +1,17 @@ export default { props: { props: { - a: 1, - }, + a: 1 + } }, - html: ``, + html: '', test({ assert, component, target }) { component.props = { - a: 2, + a: 2 }; - assert.htmlEqual(target.innerHTML, ``); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/spread-component-dynamic/_config.js b/test/runtime/samples/spread-component-dynamic/_config.js index a6bf952ae0..7992a30514 100644 --- a/test/runtime/samples/spread-component-dynamic/_config.js +++ b/test/runtime/samples/spread-component-dynamic/_config.js @@ -1,8 +1,8 @@ export default { props: { props: { - a: 1, - }, + a: 1 + } }, html: ` @@ -11,9 +11,9 @@ export default { test({ assert, component, target }) { component.props = { - a: 2, + a: 2 }; - assert.htmlEqual(target.innerHTML, `

a: 2

`); - }, + assert.htmlEqual(target.innerHTML, '

a: 2

'); + } }; diff --git a/test/runtime/samples/spread-component-multiple-dependencies/_config.js b/test/runtime/samples/spread-component-multiple-dependencies/_config.js index bc05f31130..ee2c0feda8 100644 --- a/test/runtime/samples/spread-component-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-component-multiple-dependencies/_config.js @@ -1,10 +1,10 @@ export default { - html: `b baz`, + html: 'b baz', test({ assert, component, target }) { component.foo = true; assert.htmlEqual( target.innerHTML, - `a baz` + 'a baz' ); - }, + } }; diff --git a/test/runtime/samples/spread-each-component/_config.js b/test/runtime/samples/spread-each-component/_config.js index bc4d8ee7a4..66d2381875 100644 --- a/test/runtime/samples/spread-each-component/_config.js +++ b/test/runtime/samples/spread-each-component/_config.js @@ -20,5 +20,5 @@ export default {
`); - }, + } }; diff --git a/test/runtime/samples/spread-each-element/_config.js b/test/runtime/samples/spread-each-element/_config.js index 5dbd82a892..579f840099 100644 --- a/test/runtime/samples/spread-each-element/_config.js +++ b/test/runtime/samples/spread-each-element/_config.js @@ -20,5 +20,5 @@ export default {
`); - }, + } }; diff --git a/test/runtime/samples/spread-element-boolean/_config.js b/test/runtime/samples/spread-element-boolean/_config.js index 3ee277eec4..3ceeb3f677 100644 --- a/test/runtime/samples/spread-element-boolean/_config.js +++ b/test/runtime/samples/spread-element-boolean/_config.js @@ -18,8 +18,8 @@ export default { assert.htmlEqual( target.innerHTML, - `` + '' ); assert.ok(!button.disabled); - }, + } }; diff --git a/test/runtime/samples/spread-element-class/_config.js b/test/runtime/samples/spread-element-class/_config.js index 7fc3d49012..b699848210 100644 --- a/test/runtime/samples/spread-element-class/_config.js +++ b/test/runtime/samples/spread-element-class/_config.js @@ -1,7 +1,7 @@ export default { - html: `
hello
`, + html: "
hello
", test({ assert, component, target }) { component.blah = 'goodbye'; - assert.htmlEqual(target.innerHTML, `
goodbye
`); + assert.htmlEqual(target.innerHTML, "
goodbye
"); } }; diff --git a/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js index 6e1b890351..4bbc9d278c 100644 --- a/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js +++ b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js @@ -5,7 +5,7 @@ export default { } }, - html: ``, + html: '', async test({ assert, component, target, window }) { const input = target.querySelector('input'); diff --git a/test/runtime/samples/spread-element-input-value-undefined/_config.js b/test/runtime/samples/spread-element-input-value-undefined/_config.js new file mode 100644 index 0000000000..9a83dccd80 --- /dev/null +++ b/test/runtime/samples/spread-element-input-value-undefined/_config.js @@ -0,0 +1,12 @@ +export default { + async test({ assert, component, target, window }) { + const input = target.querySelector('input'); + component.value = undefined; + + assert.equal(input.value, 'undefined'); + + component.value = 'foobar'; + + assert.equal(input.value, 'foobar'); + } +}; diff --git a/test/runtime/samples/spread-element-input-value-undefined/main.svelte b/test/runtime/samples/spread-element-input-value-undefined/main.svelte new file mode 100644 index 0000000000..5c9121dc03 --- /dev/null +++ b/test/runtime/samples/spread-element-input-value-undefined/main.svelte @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/test/runtime/samples/spread-element-input-value/_config.js b/test/runtime/samples/spread-element-input-value/_config.js index a07de82419..0df088159a 100644 --- a/test/runtime/samples/spread-element-input-value/_config.js +++ b/test/runtime/samples/spread-element-input-value/_config.js @@ -1,6 +1,6 @@ export default { async test({ assert, component, target, window }) { - const [input1, input2] = target.querySelectorAll("input"); + const [input1, input2] = target.querySelectorAll('input'); // we are not able emulate user interaction in jsdom, // therefore, jsdom could not validate minlength / maxlength @@ -14,7 +14,7 @@ export default { const spy1 = spyOnValueSetter(input1, input1.value); const spy2 = spyOnValueSetter(input2, input2.value); - const event = new window.Event("input"); + const event = new window.Event('input'); input1.value = '12345'; spy1.reset(); @@ -35,20 +35,20 @@ export default { spy2.reset(); component.val2 = '56789'; assert.ok(spy2.isSetCalled()); - }, + } }; function spyOnValueSetter(input, initialValue) { let value = initialValue; let isSet = false; - Object.defineProperty(input, "value", { + Object.defineProperty(input, 'value', { get() { return value; }, set(_value) { value = _value; isSet = true; - }, + } }); return { @@ -57,6 +57,6 @@ function spyOnValueSetter(input, initialValue) { }, reset() { isSet = false; - }, + } }; } diff --git a/test/runtime/samples/spread-element-input/_config.js b/test/runtime/samples/spread-element-input/_config.js index 80685b9d20..2e68e9832f 100644 --- a/test/runtime/samples/spread-element-input/_config.js +++ b/test/runtime/samples/spread-element-input/_config.js @@ -5,5 +5,5 @@ export default { } }, - html: `` + html: '' }; diff --git a/test/runtime/samples/spread-element-multiple-dependencies/_config.js b/test/runtime/samples/spread-element-multiple-dependencies/_config.js index 69ef1f8ebe..6183e6bf6e 100644 --- a/test/runtime/samples/spread-element-multiple-dependencies/_config.js +++ b/test/runtime/samples/spread-element-multiple-dependencies/_config.js @@ -1,10 +1,10 @@ export default { - html: `
`, + html: "
", test({ assert, component, target }) { component.foo = true; assert.htmlEqual( target.innerHTML, - `
` + "
" ); - }, + } }; diff --git a/test/runtime/samples/spread-element-multiple/_config.js b/test/runtime/samples/spread-element-multiple/_config.js index 641f74d727..38afe2fe8e 100644 --- a/test/runtime/samples/spread-element-multiple/_config.js +++ b/test/runtime/samples/spread-element-multiple/_config.js @@ -2,12 +2,12 @@ export default { props: { a: { 'data-one': 1, - 'data-two': 2, + 'data-two': 2 }, c: { - 'data-b': 'overridden', + 'data-b': 'overridden' }, - d: 'deeeeee', + d: 'deeeeee' }, html: ` @@ -25,7 +25,7 @@ export default { assert.htmlEqual( target.innerHTML, - `
test
` + '
test
' ); - }, + } }; diff --git a/test/runtime/samples/spread-element-readonly/_config.js b/test/runtime/samples/spread-element-readonly/_config.js index 1d349fd76f..5e33acb0aa 100644 --- a/test/runtime/samples/spread-element-readonly/_config.js +++ b/test/runtime/samples/spread-element-readonly/_config.js @@ -1,6 +1,6 @@ export default { skip_if_ssr: true, // DOM and SSR output is different, a separate SSR test exists - html: ``, + html: '', test({ assert, target }) { const div = target.querySelector('input'); diff --git a/test/runtime/samples/spread-element-removal/_config.js b/test/runtime/samples/spread-element-removal/_config.js index 270804170d..1fd2443369 100644 --- a/test/runtime/samples/spread-element-removal/_config.js +++ b/test/runtime/samples/spread-element-removal/_config.js @@ -1,3 +1,3 @@ export default { - html: `` + html: '' }; diff --git a/test/runtime/samples/spread-element/_config.js b/test/runtime/samples/spread-element/_config.js index 0763634b0f..2332891b67 100644 --- a/test/runtime/samples/spread-element/_config.js +++ b/test/runtime/samples/spread-element/_config.js @@ -1,5 +1,5 @@ export default { - html: `
red
`, + html: '
red
', test({ assert, component, target }) { const div = target.querySelector( 'div' ); @@ -9,13 +9,13 @@ export default { component.color = 'blue'; component.props = { 'data-foo': 'baz', 'data-named': 'qux' }; - assert.htmlEqual( target.innerHTML, `
blue
` ); + assert.htmlEqual( target.innerHTML, '
blue
' ); assert.equal( div.dataset.foo, 'baz' ); assert.equal( div.dataset.named, 'value' ); component.color = 'blue'; component.props = {}; - assert.htmlEqual( target.innerHTML, `
blue
` ); + assert.htmlEqual( target.innerHTML, '
blue
' ); assert.equal( div.dataset.foo, undefined ); } }; diff --git a/test/runtime/samples/spring/_config.js b/test/runtime/samples/spring/_config.js index 49367ce08b..5fd33b2e51 100644 --- a/test/runtime/samples/spring/_config.js +++ b/test/runtime/samples/spring/_config.js @@ -1,3 +1,3 @@ export default { - html: `

0

` + html: '

0

' }; diff --git a/test/runtime/samples/state-deconflicted/_config.js b/test/runtime/samples/state-deconflicted/_config.js index 3258754400..ff1b10b481 100644 --- a/test/runtime/samples/state-deconflicted/_config.js +++ b/test/runtime/samples/state-deconflicted/_config.js @@ -49,4 +49,4 @@ export default { ` ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-assignment-updates-property/_config.js b/test/runtime/samples/store-assignment-updates-property/_config.js new file mode 100644 index 0000000000..168f7d27a0 --- /dev/null +++ b/test/runtime/samples/store-assignment-updates-property/_config.js @@ -0,0 +1,32 @@ +export default { + html: ` +

a: {"foo":3,"bar":2}

+

b: {"foo":3}

+ + + `, + skip_if_ssr: true, + + async test({ assert, component, target, window }) { + const [btn1, btn2] = target.querySelectorAll('button'); + const click = new window.MouseEvent('click'); + + await btn1.dispatchEvent(click); + + assert.htmlEqual(target.innerHTML, ` +

a: {"foo":4,"bar":2}

+

b: {"foo":4,"baz":0}

+ + + `); + + await btn2.dispatchEvent(click); + + assert.htmlEqual(target.innerHTML, ` +

a: {"foo":5,"bar":2}

+

b: {"foo":5,"qux":0}

+ + + `); + } +}; diff --git a/test/runtime/samples/store-assignment-updates-property/main.svelte b/test/runtime/samples/store-assignment-updates-property/main.svelte new file mode 100644 index 0000000000..c3196a278c --- /dev/null +++ b/test/runtime/samples/store-assignment-updates-property/main.svelte @@ -0,0 +1,24 @@ + + +

a: {JSON.stringify($a)}

+

b: {JSON.stringify($b)}

+ + `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-assignment-updates/_config.js b/test/runtime/samples/store-assignment-updates/_config.js index 1b36d92863..c4a09a978e 100644 --- a/test/runtime/samples/store-assignment-updates/_config.js +++ b/test/runtime/samples/store-assignment-updates/_config.js @@ -28,4 +28,4 @@ export default {

doubled: 84

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-event-callback/_config.js b/test/runtime/samples/store-auto-subscribe-event-callback/_config.js index 747ed3e4ad..7897036809 100644 --- a/test/runtime/samples/store-auto-subscribe-event-callback/_config.js +++ b/test/runtime/samples/store-auto-subscribe-event-callback/_config.js @@ -18,5 +18,5 @@ export default { Dirty: true Valid: true `); - }, + } }; diff --git a/test/runtime/samples/store-auto-subscribe-immediate-multiple-vars/_config.js b/test/runtime/samples/store-auto-subscribe-immediate-multiple-vars/_config.js index 9cfd765cde..fdaa951666 100644 --- a/test/runtime/samples/store-auto-subscribe-immediate-multiple-vars/_config.js +++ b/test/runtime/samples/store-auto-subscribe-immediate-multiple-vars/_config.js @@ -6,4 +6,4 @@ export default { async test({ assert, component }) { assert.equal(component.initial_foo, 42); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-immediate/_config.js b/test/runtime/samples/store-auto-subscribe-immediate/_config.js index 9cfd765cde..fdaa951666 100644 --- a/test/runtime/samples/store-auto-subscribe-immediate/_config.js +++ b/test/runtime/samples/store-auto-subscribe-immediate/_config.js @@ -6,4 +6,4 @@ export default { async test({ assert, component }) { assert.equal(component.initial_foo, 42); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-implicit/_config.js b/test/runtime/samples/store-auto-subscribe-implicit/_config.js index eca1f314ff..f132901bf0 100644 --- a/test/runtime/samples/store-auto-subscribe-implicit/_config.js +++ b/test/runtime/samples/store-auto-subscribe-implicit/_config.js @@ -25,4 +25,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-in-each/_config.js b/test/runtime/samples/store-auto-subscribe-in-each/_config.js index a49dbab85c..8c8fa001d8 100644 --- a/test/runtime/samples/store-auto-subscribe-in-each/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-each/_config.js @@ -37,4 +37,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js index 2240425d91..cf1bdce68a 100644 --- a/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-reactive-declaration/_config.js @@ -25,4 +25,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-in-script/_config.js b/test/runtime/samples/store-auto-subscribe-in-script/_config.js index cfd4475240..7ea7eac87b 100644 --- a/test/runtime/samples/store-auto-subscribe-in-script/_config.js +++ b/test/runtime/samples/store-auto-subscribe-in-script/_config.js @@ -23,4 +23,4 @@ export default { await count.set(42); assert.equal(component.get_count(), 42); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js b/test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js index c4eb72b553..f3df26c0de 100644 --- a/test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js +++ b/test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js @@ -1,3 +1,3 @@ export default { error: 'missingGlobal is not defined' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js b/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js index c4eb72b553..f3df26c0de 100644 --- a/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js +++ b/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js @@ -1,3 +1,3 @@ export default { error: 'missingGlobal is not defined' -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-auto-subscribe/_config.js b/test/runtime/samples/store-auto-subscribe/_config.js index eca1f314ff..f132901bf0 100644 --- a/test/runtime/samples/store-auto-subscribe/_config.js +++ b/test/runtime/samples/store-auto-subscribe/_config.js @@ -25,4 +25,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-contextual/_config.js b/test/runtime/samples/store-contextual/_config.js index e06332a233..2a4f8fef8d 100644 --- a/test/runtime/samples/store-contextual/_config.js +++ b/test/runtime/samples/store-contextual/_config.js @@ -7,7 +7,7 @@ const todos = [ ]; export default { - error: `Stores must be declared at the top level of the component (this may change in a future version of Svelte)`, + error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)', props: { todos @@ -73,4 +73,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-dev-mode-error/_config.js b/test/runtime/samples/store-dev-mode-error/_config.js index 70b24337fd..74f4189c36 100644 --- a/test/runtime/samples/store-dev-mode-error/_config.js +++ b/test/runtime/samples/store-dev-mode-error/_config.js @@ -7,5 +7,5 @@ export default { count: 0 }, - error: `'count' is not a store with a 'subscribe' method` -}; \ No newline at end of file + error: "'count' is not a store with a 'subscribe' method" +}; diff --git a/test/runtime/samples/store-each-binding-deep/_config.js b/test/runtime/samples/store-each-binding-deep/_config.js new file mode 100644 index 0000000000..c5f2402ae2 --- /dev/null +++ b/test/runtime/samples/store-each-binding-deep/_config.js @@ -0,0 +1,14 @@ +export default { + async test({ assert, target, window }) { + const input = target.querySelector('input'); + + const event = new window.Event('input'); + input.value = 'changed'; + await input.dispatchEvent(event); + + assert.htmlEqual(target.innerHTML, ` + +

changed

+ `); + } +}; diff --git a/test/runtime/samples/store-each-binding-deep/main.svelte b/test/runtime/samples/store-each-binding-deep/main.svelte new file mode 100644 index 0000000000..8f1cabf5b8 --- /dev/null +++ b/test/runtime/samples/store-each-binding-deep/main.svelte @@ -0,0 +1,11 @@ + + +{#each $itemStore.prop.things as thing } + +{/each} + +

{$itemStore.prop.things[0].name}

\ No newline at end of file diff --git a/test/runtime/samples/store-each-binding-destructuring/_config.js b/test/runtime/samples/store-each-binding-destructuring/_config.js index 70776940dd..c5f2402ae2 100644 --- a/test/runtime/samples/store-each-binding-destructuring/_config.js +++ b/test/runtime/samples/store-each-binding-destructuring/_config.js @@ -11,4 +11,4 @@ export default {

changed

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-each-binding/_config.js b/test/runtime/samples/store-each-binding/_config.js index 70776940dd..c5f2402ae2 100644 --- a/test/runtime/samples/store-each-binding/_config.js +++ b/test/runtime/samples/store-each-binding/_config.js @@ -11,4 +11,4 @@ export default {

changed

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-imported-module-b/_config.js b/test/runtime/samples/store-imported-module-b/_config.js index 8f75dcc493..f3c168e4c1 100644 --- a/test/runtime/samples/store-imported-module-b/_config.js +++ b/test/runtime/samples/store-imported-module-b/_config.js @@ -1,3 +1,3 @@ export default { - error: `Cannot reference store value inside + +{$store1} +{$store2} diff --git a/test/runtime/samples/store-resubscribe-export/_config.js b/test/runtime/samples/store-resubscribe-export/_config.js index b6e6f11344..f6630aa045 100644 --- a/test/runtime/samples/store-resubscribe-export/_config.js +++ b/test/runtime/samples/store-resubscribe-export/_config.js @@ -1,19 +1,19 @@ -let subscribeCalled = false; +let unsubscribeCalled = false; const fakeStore = val => ({ subscribe: cb => { cb(val); return { unsubscribe: () => { - subscribeCalled = true; - }, + unsubscribeCalled = true; + } }; - }, + } }); export default { props: { - foo: fakeStore(1), + foo: fakeStore(1) }, html: `

1

@@ -22,6 +22,8 @@ export default { async test({ assert, component, target }) { component.foo = fakeStore(5); - return assert.htmlEqual(target.innerHTML, `

5

`); - }, + assert.htmlEqual(target.innerHTML, '

5

'); + + assert.ok(unsubscribeCalled); + } }; diff --git a/test/runtime/samples/store-resubscribe-observable/_config.js b/test/runtime/samples/store-resubscribe-observable/_config.js index d043bbcd87..b097a46716 100644 --- a/test/runtime/samples/store-resubscribe-observable/_config.js +++ b/test/runtime/samples/store-resubscribe-observable/_config.js @@ -1,3 +1,3 @@ export default { - html: `42`, + html: '42' }; diff --git a/test/runtime/samples/store-resubscribe/_config.js b/test/runtime/samples/store-resubscribe/_config.js index 6bde764a55..82d40f9add 100644 --- a/test/runtime/samples/store-resubscribe/_config.js +++ b/test/runtime/samples/store-resubscribe/_config.js @@ -33,4 +33,4 @@ export default { `); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/store-shadow-scope/_config.js b/test/runtime/samples/store-shadow-scope/_config.js index e2d6fc7808..a197325a2d 100644 --- a/test/runtime/samples/store-shadow-scope/_config.js +++ b/test/runtime/samples/store-shadow-scope/_config.js @@ -1,3 +1,3 @@ export default { - error: `Stores must be declared at the top level of the component (this may change in a future version of Svelte)` + error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' }; diff --git a/test/runtime/samples/store-template-expression-scope/_config.js b/test/runtime/samples/store-template-expression-scope/_config.js index e2d6fc7808..a197325a2d 100644 --- a/test/runtime/samples/store-template-expression-scope/_config.js +++ b/test/runtime/samples/store-template-expression-scope/_config.js @@ -1,3 +1,3 @@ export default { - error: `Stores must be declared at the top level of the component (this may change in a future version of Svelte)` + error: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)' }; diff --git a/test/runtime/samples/store-unreferenced/_config.js b/test/runtime/samples/store-unreferenced/_config.js index 0695edf8dc..e15f202492 100644 --- a/test/runtime/samples/store-unreferenced/_config.js +++ b/test/runtime/samples/store-unreferenced/_config.js @@ -1,12 +1,12 @@ import { count } from './store.js'; export default { - html: `

count: 0

`, + html: '

count: 0

', async test({ assert, component, target }) { await component.increment(); - assert.htmlEqual(target.innerHTML, `

count: 1

`); + assert.htmlEqual(target.innerHTML, '

count: 1

'); count.set(0); } diff --git a/test/runtime/samples/store-unreferenced/store.js b/test/runtime/samples/store-unreferenced/store.js index 99e27e5584..b799c0ffc4 100644 --- a/test/runtime/samples/store-unreferenced/store.js +++ b/test/runtime/samples/store-unreferenced/store.js @@ -1,3 +1,3 @@ import { writable } from '../../../../store'; -export const count = writable(0); \ No newline at end of file +export const count = writable(0); diff --git a/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js b/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js index e7f8397390..a3676db286 100644 --- a/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js +++ b/test/runtime/samples/svg-child-component-declared-namespace-shorthand/_config.js @@ -6,7 +6,7 @@ export default { height: 100 }, - html: ``, + html: '', test({ assert, component, target }) { const svg = target.querySelector( 'svg' ); @@ -17,6 +17,6 @@ export default { component.width = 150; component.height = 50; - assert.equal( target.innerHTML, `` ); + assert.equal( target.innerHTML, '' ); } }; diff --git a/test/runtime/samples/svg-child-component-declared-namespace/_config.js b/test/runtime/samples/svg-child-component-declared-namespace/_config.js index e7f8397390..a3676db286 100644 --- a/test/runtime/samples/svg-child-component-declared-namespace/_config.js +++ b/test/runtime/samples/svg-child-component-declared-namespace/_config.js @@ -6,7 +6,7 @@ export default { height: 100 }, - html: ``, + html: '', test({ assert, component, target }) { const svg = target.querySelector( 'svg' ); @@ -17,6 +17,6 @@ export default { component.width = 150; component.height = 50; - assert.equal( target.innerHTML, `` ); + assert.equal( target.innerHTML, '' ); } }; diff --git a/test/runtime/samples/svg-class/_config.js b/test/runtime/samples/svg-class/_config.js index 3bb353cf58..36f5d06b1c 100644 --- a/test/runtime/samples/svg-class/_config.js +++ b/test/runtime/samples/svg-class/_config.js @@ -1,7 +1,7 @@ // this looks like another JSDOM quirk — svg.className = 'foo' behaves // differently from browsers. So this test succeeds even when it should fail export default { - html: ``, + html: "", test({ assert, component, target }) { const svg = target.querySelector('svg'); diff --git a/test/runtime/samples/svg-tspan-preserve-space/_config.js b/test/runtime/samples/svg-tspan-preserve-space/_config.js index 283af0a2b0..1042ba1821 100644 --- a/test/runtime/samples/svg-tspan-preserve-space/_config.js +++ b/test/runtime/samples/svg-tspan-preserve-space/_config.js @@ -1,3 +1,3 @@ export default { - html: `foo barfoo bar`, + html: 'foo barfoo bar' }; diff --git a/test/runtime/samples/svg-xmlns/_config.js b/test/runtime/samples/svg-xmlns/_config.js index daf6ef03e4..5cec8da04a 100644 --- a/test/runtime/samples/svg-xmlns/_config.js +++ b/test/runtime/samples/svg-xmlns/_config.js @@ -8,7 +8,7 @@ export default { height: 100 }, - html: ``, + html: '', test({ assert, component, target }) { const svg = target.querySelector( 'svg' ); @@ -19,6 +19,6 @@ export default { component.width = 150; component.height = 50; - assert.equal( target.innerHTML, `` ); + assert.equal( target.innerHTML, '' ); } }; diff --git a/test/runtime/samples/svg/_config.js b/test/runtime/samples/svg/_config.js index e7f8397390..a3676db286 100644 --- a/test/runtime/samples/svg/_config.js +++ b/test/runtime/samples/svg/_config.js @@ -6,7 +6,7 @@ export default { height: 100 }, - html: ``, + html: '', test({ assert, component, target }) { const svg = target.querySelector( 'svg' ); @@ -17,6 +17,6 @@ export default { component.width = 150; component.height = 50; - assert.equal( target.innerHTML, `` ); + assert.equal( target.innerHTML, '' ); } }; diff --git a/test/runtime/samples/template/_config.js b/test/runtime/samples/template/_config.js index ccc04a1c91..fd9bb3af67 100644 --- a/test/runtime/samples/template/_config.js +++ b/test/runtime/samples/template/_config.js @@ -20,4 +20,4 @@ export default {
foo
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/textarea-children/_config.js b/test/runtime/samples/textarea-children/_config.js index 8f46370b07..f80b66df1f 100644 --- a/test/runtime/samples/textarea-children/_config.js +++ b/test/runtime/samples/textarea-children/_config.js @@ -5,13 +5,13 @@ export default { foo: 42 }, - html: ``, + html: '', test({ assert, component, target }) { const textarea = target.querySelector( 'textarea' ); - assert.strictEqual( textarea.value, `\n\t

not actually an element. 42

\n` ); + assert.strictEqual( textarea.value, '\n\t

not actually an element. 42

\n' ); component.foo = 43; - assert.strictEqual( textarea.value, `\n\t

not actually an element. 43

\n` ); + assert.strictEqual( textarea.value, '\n\t

not actually an element. 43

\n' ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/textarea-value/_config.js b/test/runtime/samples/textarea-value/_config.js index 412754b51f..93079e5928 100644 --- a/test/runtime/samples/textarea-value/_config.js +++ b/test/runtime/samples/textarea-value/_config.js @@ -5,7 +5,7 @@ export default { foo: 42 }, - html: ``, + html: '', test({ assert, component, target }) { const textarea = target.querySelector( 'textarea' ); @@ -14,4 +14,4 @@ export default { component.foo = 43; assert.strictEqual( textarea.value, '43' ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/this-in-function-expressions/_config.js b/test/runtime/samples/this-in-function-expressions/_config.js index 4110d05a48..57f23a472b 100644 --- a/test/runtime/samples/this-in-function-expressions/_config.js +++ b/test/runtime/samples/this-in-function-expressions/_config.js @@ -1,10 +1,10 @@ export default { - async test({ assert, component, target, window, raf }) { - const [_, btn] = target.querySelectorAll("button"); - const clickEvent = new window.MouseEvent("click"); + async test({ assert, target, window }) { + const [, btn] = target.querySelectorAll('button'); + const clickEvent = new window.MouseEvent('click'); await btn.dispatchEvent(clickEvent); assert.equal(btn.x, 1); - }, + } }; diff --git a/test/runtime/samples/transition-css-deferred-removal/_config.js b/test/runtime/samples/transition-css-deferred-removal/_config.js index cd9dbfeb73..763f004835 100644 --- a/test/runtime/samples/transition-css-deferred-removal/_config.js +++ b/test/runtime/samples/transition-css-deferred-removal/_config.js @@ -20,5 +20,5 @@ export default { outer.style.animation, inner.style.animation ], animations); - }, + } }; diff --git a/test/runtime/samples/transition-css-duration/_config.js b/test/runtime/samples/transition-css-duration/_config.js index 28a78944bb..a448c3f164 100644 --- a/test/runtime/samples/transition-css-duration/_config.js +++ b/test/runtime/samples/transition-css-duration/_config.js @@ -9,5 +9,5 @@ export default { raf.tick(26); assert.ok(~div.style.animation.indexOf('25ms')); - }, + } }; diff --git a/test/runtime/samples/transition-css-iframe/_config.js b/test/runtime/samples/transition-css-iframe/_config.js index 507efe44f4..612ee8e5ba 100644 --- a/test/runtime/samples/transition-css-iframe/_config.js +++ b/test/runtime/samples/transition-css-iframe/_config.js @@ -14,5 +14,5 @@ export default { raf.tick(26); assert.ok(~div.style.animation.indexOf('25ms')); - }, + } }; diff --git a/test/runtime/samples/transition-css-in-out-in/_config.js b/test/runtime/samples/transition-css-in-out-in/_config.js index 10719280e9..cd7ae14ce8 100644 --- a/test/runtime/samples/transition-css-in-out-in/_config.js +++ b/test/runtime/samples/transition-css-in-out-in/_config.js @@ -3,18 +3,18 @@ export default { component.visible = true; const div = target.querySelector('div'); - assert.equal(div.style.animation, `__svelte_3809512021_0 100ms linear 0ms 1 both`); + assert.equal(div.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both'); raf.tick(50); component.visible = false; // both in and out styles - assert.equal(div.style.animation, `__svelte_3809512021_0 100ms linear 0ms 1 both, __svelte_3750847757_0 100ms linear 0ms 1 both`); + assert.equal(div.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both, __svelte_3750847757_0 100ms linear 0ms 1 both'); raf.tick(75); component.visible = true; // reset original styles - assert.equal(div.style.animation, `__svelte_3809512021_1 100ms linear 0ms 1 both`); - }, + assert.equal(div.style.animation, '__svelte_3809512021_1 100ms linear 0ms 1 both'); + } }; diff --git a/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js b/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js index e78862e86c..75843d624e 100644 --- a/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js +++ b/test/runtime/samples/transition-js-aborted-outro-in-each/_config.js @@ -35,5 +35,5 @@ export default { assert.equal(spans[0].foo, 1); assert.equal(spans[1].foo, 1); assert.equal(spans[2].foo, 1); - }, + } }; diff --git a/test/runtime/samples/transition-js-aborted-outro/_config.js b/test/runtime/samples/transition-js-aborted-outro/_config.js index d61407e1bd..7ecc212739 100644 --- a/test/runtime/samples/transition-js-aborted-outro/_config.js +++ b/test/runtime/samples/transition-js-aborted-outro/_config.js @@ -1,6 +1,6 @@ export default { props: { - visible: true, + visible: true }, test({ assert, component, target, raf }) { @@ -20,5 +20,5 @@ export default { assert.htmlEqual(target.innerHTML, ` hello `); - }, + } }; diff --git a/test/runtime/samples/transition-js-args-dynamic/_config.js b/test/runtime/samples/transition-js-args-dynamic/_config.js new file mode 100644 index 0000000000..513a17486a --- /dev/null +++ b/test/runtime/samples/transition-js-args-dynamic/_config.js @@ -0,0 +1,15 @@ +export default { + test({ assert, component, target, window, raf }) { + component.visible = true; + + const div = target.querySelector('div'); + + assert.equal(div.value, 0); + + raf.tick(200); + + div.value = 'test'; + component.visible = false; + assert.equal(div.value, 'test'); + } +}; diff --git a/test/runtime/samples/transition-js-args-dynamic/main.svelte b/test/runtime/samples/transition-js-args-dynamic/main.svelte new file mode 100644 index 0000000000..1bb149de32 --- /dev/null +++ b/test/runtime/samples/transition-js-args-dynamic/main.svelte @@ -0,0 +1,17 @@ + + +{#if visible} +
+{/if} \ No newline at end of file diff --git a/test/runtime/samples/transition-js-await-block/_config.js b/test/runtime/samples/transition-js-await-block/_config.js index 80546ae6b8..696a2dd5d4 100644 --- a/test/runtime/samples/transition-js-await-block/_config.js +++ b/test/runtime/samples/transition-js-await-block/_config.js @@ -1,9 +1,7 @@ let fulfil; -let reject; -const promise = new Promise((f, r) => { +const promise = new Promise((f) => { fulfil = f; - reject = r; }); export default { diff --git a/test/runtime/samples/transition-js-deferred-b/_config.js b/test/runtime/samples/transition-js-deferred-b/_config.js index 05929964cd..031943f6e3 100644 --- a/test/runtime/samples/transition-js-deferred-b/_config.js +++ b/test/runtime/samples/transition-js-deferred-b/_config.js @@ -9,5 +9,5 @@ export default { raf.tick(50); assert.equal(div.foo, 0.5); }); - }, + } }; diff --git a/test/runtime/samples/transition-js-deferred/_config.js b/test/runtime/samples/transition-js-deferred/_config.js index 9d6833d2f4..9e4c0e82bb 100644 --- a/test/runtime/samples/transition-js-deferred/_config.js +++ b/test/runtime/samples/transition-js-deferred/_config.js @@ -9,5 +9,5 @@ export default { raf.tick(50); assert.equal(div.foo, 0.5); }); - }, + } }; diff --git a/test/runtime/samples/transition-js-delay-in-out/_config.js b/test/runtime/samples/transition-js-delay-in-out/_config.js index fb77fca015..bb00604dd9 100644 --- a/test/runtime/samples/transition-js-delay-in-out/_config.js +++ b/test/runtime/samples/transition-js-delay-in-out/_config.js @@ -19,4 +19,4 @@ export default { raf.tick(300); assert.equal(div.bar, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-delay/_config.js b/test/runtime/samples/transition-js-delay/_config.js index a0613737b2..4567573661 100644 --- a/test/runtime/samples/transition-js-delay/_config.js +++ b/test/runtime/samples/transition-js-delay/_config.js @@ -24,4 +24,4 @@ export default { raf.tick(250); assert.equal(div.foo, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-destroyed-before-end/_config.js b/test/runtime/samples/transition-js-destroyed-before-end/_config.js index 7cedf8519a..59615bd7a5 100644 --- a/test/runtime/samples/transition-js-destroyed-before-end/_config.js +++ b/test/runtime/samples/transition-js-destroyed-before-end/_config.js @@ -13,5 +13,5 @@ export default { component.$destroy(); raf.tick(100); - }, + } }; diff --git a/test/runtime/samples/transition-js-dynamic-component/_config.js b/test/runtime/samples/transition-js-dynamic-component/_config.js index c7affda071..e8104a67e5 100644 --- a/test/runtime/samples/transition-js-dynamic-component/_config.js +++ b/test/runtime/samples/transition-js-dynamic-component/_config.js @@ -1,6 +1,6 @@ export default { props: { - x: true, + x: true }, html: ` @@ -31,4 +31,4 @@ export default {
b
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js index aa0bd9e1aa..95fe7b01f3 100644 --- a/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-dynamic-if-block-bidi/_config.js @@ -33,4 +33,4 @@ export default { raf.tick(225); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-intro-outro/_config.js b/test/runtime/samples/transition-js-each-block-intro-outro/_config.js index 3a764c5612..9b83a1a1d3 100644 --- a/test/runtime/samples/transition-js-each-block-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-intro-outro/_config.js @@ -38,4 +38,4 @@ export default { assert.equal(divs[1].bar, 1); assert.equal(divs[2].bar, 1); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-intro/_config.js b/test/runtime/samples/transition-js-each-block-intro/_config.js index 3d143ea514..42d69665cf 100644 --- a/test/runtime/samples/transition-js-each-block-intro/_config.js +++ b/test/runtime/samples/transition-js-each-block-intro/_config.js @@ -29,4 +29,4 @@ export default { assert.equal(divs[2].foo, 0.75); assert.equal(divs[3].foo, 0.25); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js index 083752cbd9..9927289ee5 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-intro-outro/_config.js @@ -60,4 +60,4 @@ export default { assert.equal(divs[1].foo, 1); assert.equal(divs[2].foo, 1); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js index 5886cc5c6f..c37cb8101d 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-intro/_config.js @@ -44,4 +44,4 @@ export default { assert.equal(divs[2].foo, 0.75); assert.equal(divs[3].foo, 0.75); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js index 03e8c147cb..1c98ec3198 100644 --- a/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-keyed-outro/_config.js @@ -25,4 +25,4 @@ export default { assert.equal( divs[1].foo, 0.5 ); assert.equal( divs[2].foo, undefined ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-block-outro/_config.js b/test/runtime/samples/transition-js-each-block-outro/_config.js index f8d4410e99..e9a7644383 100644 --- a/test/runtime/samples/transition-js-each-block-outro/_config.js +++ b/test/runtime/samples/transition-js-each-block-outro/_config.js @@ -16,4 +16,4 @@ export default { raf.tick( 100 ); assert.htmlEqual(target.innerHTML, '
a
'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-else-block-intro-outro/_config.js b/test/runtime/samples/transition-js-each-else-block-intro-outro/_config.js new file mode 100644 index 0000000000..d51fdecb2e --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-intro-outro/_config.js @@ -0,0 +1,54 @@ +export default { + props: { + things: ['a', 'b', 'c'] + }, + + test({ assert, component, target, window, raf }) { + component.things = []; + let div = target.querySelector('div'); + assert.equal(div.foo, 0); + + raf.tick(200); + assert.equal(div.foo, 0.5); + + raf.tick(300); + assert.equal(div.foo, 0.75); + + raf.tick(400); + assert.equal(div.foo, 1); + + raf.tick(600); + component.things = ['a', 'b', 'c']; + + raf.tick(700); + assert.equal(div.foo, 1); + assert.equal(div.bar, 0.75); + + raf.tick(800); + assert.equal(div.foo, 1); + assert.equal(div.bar, 0.5); + + raf.tick(900); + assert.equal(div.foo, 1); + assert.equal(div.bar, 0.25); + + // test outro before intro complete + raf.tick(1000); + component.things = []; + div = target.querySelector('div'); + + raf.tick(1200); + assert.equal(div.foo, 0.5); + + component.things = ['a', 'b', 'c']; + raf.tick(1300); + assert.equal(div.foo, 0.75); + assert.equal(div.bar, 0.75); + + raf.tick(1400); + assert.equal(div.foo, 1); + assert.equal(div.bar, 0.5); + + raf.tick(2000); + } +}; diff --git a/test/runtime/samples/transition-js-each-else-block-intro-outro/main.svelte b/test/runtime/samples/transition-js-each-else-block-intro-outro/main.svelte new file mode 100644 index 0000000000..1691e77f52 --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-intro-outro/main.svelte @@ -0,0 +1,27 @@ + + +{#each things as thing} +

{thing}

+{:else} +
else
+{/each} \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-else-block-intro/_config.js b/test/runtime/samples/transition-js-each-else-block-intro/_config.js new file mode 100644 index 0000000000..dccfbd1a03 --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-intro/_config.js @@ -0,0 +1,22 @@ +export default { + props: { + things: ['a', 'b', 'c'] + }, + + test({ assert, component, target, window, raf }) { + component.things = []; + const div = target.querySelector('div'); + assert.equal(div.foo, 0); + + raf.tick(200); + assert.equal(div.foo, 0.5); + + raf.tick(300); + assert.equal(div.foo, 0.75); + + raf.tick(400); + assert.equal(div.foo, 1); + + raf.tick(500); + } +}; diff --git a/test/runtime/samples/transition-js-each-else-block-intro/main.svelte b/test/runtime/samples/transition-js-each-else-block-intro/main.svelte new file mode 100644 index 0000000000..bda8746c46 --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-intro/main.svelte @@ -0,0 +1,18 @@ + + +{#each things as thing} +

{thing}

+{:else} +
else
+{/each} \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-else-block-outro/_config.js b/test/runtime/samples/transition-js-each-else-block-outro/_config.js new file mode 100644 index 0000000000..163cbbd08d --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-outro/_config.js @@ -0,0 +1,20 @@ +export default { + props: { + things: [] + }, + test({ assert, component, target, window, raf }) { + const div = target.querySelector('div'); + component.things = ['a', 'b', 'c']; + + raf.tick(200); + assert.equal(div.foo, 0.5); + + raf.tick(300); + assert.equal(div.foo, 0.25); + + raf.tick(400); + assert.equal(div.foo, 0); + + raf.tick(500); + } +}; diff --git a/test/runtime/samples/transition-js-each-else-block-outro/main.svelte b/test/runtime/samples/transition-js-each-else-block-outro/main.svelte new file mode 100644 index 0000000000..246c146127 --- /dev/null +++ b/test/runtime/samples/transition-js-each-else-block-outro/main.svelte @@ -0,0 +1,18 @@ + + +{#each things as thing} +

{thing}

+{:else} +
else
+{/each} \ No newline at end of file diff --git a/test/runtime/samples/transition-js-each-keyed-unchanged/_config.js b/test/runtime/samples/transition-js-each-keyed-unchanged/_config.js index b3a1882196..a36b1a4610 100644 --- a/test/runtime/samples/transition-js-each-keyed-unchanged/_config.js +++ b/test/runtime/samples/transition-js-each-keyed-unchanged/_config.js @@ -22,4 +22,4 @@ export default { assert.equal(divs1[3].foo, undefined); assert.equal(divs1[4].foo, undefined); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-each-unchanged/_config.js b/test/runtime/samples/transition-js-each-unchanged/_config.js index 9bd2206211..671aa2af74 100644 --- a/test/runtime/samples/transition-js-each-unchanged/_config.js +++ b/test/runtime/samples/transition-js-each-unchanged/_config.js @@ -22,4 +22,4 @@ export default { assert.equal(divs1[3].foo, undefined); assert.equal(divs1[4].foo, undefined); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-events-in-out/_config.js b/test/runtime/samples/transition-js-events-in-out/_config.js index 854e7e2f4b..588a4edbd7 100644 --- a/test/runtime/samples/transition-js-events-in-out/_config.js +++ b/test/runtime/samples/transition-js-events-in-out/_config.js @@ -68,4 +68,4 @@ export default {

d

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-events/_config.js b/test/runtime/samples/transition-js-events/_config.js index 00d83cb275..54b068dace 100644 --- a/test/runtime/samples/transition-js-events/_config.js +++ b/test/runtime/samples/transition-js-events/_config.js @@ -67,4 +67,4 @@ export default {

d

`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-bidi/_config.js b/test/runtime/samples/transition-js-if-block-bidi/_config.js index a070f978e2..1587a92ad6 100644 --- a/test/runtime/samples/transition-js-if-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-if-block-bidi/_config.js @@ -25,4 +25,4 @@ export default { raf.tick(900); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js index 338586636b..fb885b0826 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js @@ -25,4 +25,4 @@ export default {
4
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js index 04df38a09c..09511fe976 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-3/_config.js @@ -30,4 +30,4 @@ export default {
5
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js index 4c75e3ef06..712be980aa 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js @@ -42,4 +42,4 @@ export default {
3
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-intro-outro/_config.js b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js index e6512c93ed..06f72653e4 100644 --- a/test/runtime/samples/transition-js-if-block-intro-outro/_config.js +++ b/test/runtime/samples/transition-js-if-block-intro-outro/_config.js @@ -41,4 +41,4 @@ export default { raf.tick(2000); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-intro/_config.js b/test/runtime/samples/transition-js-if-block-intro/_config.js index 93ef8391f5..8be3b718f8 100644 --- a/test/runtime/samples/transition-js-if-block-intro/_config.js +++ b/test/runtime/samples/transition-js-if-block-intro/_config.js @@ -12,4 +12,4 @@ export default { raf.tick(500); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-block-outro-timeout/_config.js b/test/runtime/samples/transition-js-if-block-outro-timeout/_config.js index 5c6e103a5a..3ead1ad6b4 100644 --- a/test/runtime/samples/transition-js-if-block-outro-timeout/_config.js +++ b/test/runtime/samples/transition-js-if-block-outro-timeout/_config.js @@ -16,4 +16,4 @@ export default { assert.equal(component.div, undefined); assert.equal(target.querySelector('div'), undefined); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-else-block-dynamic-outro/_config.js b/test/runtime/samples/transition-js-if-else-block-dynamic-outro/_config.js index c15b3ac9c9..4985d39850 100644 --- a/test/runtime/samples/transition-js-if-else-block-dynamic-outro/_config.js +++ b/test/runtime/samples/transition-js-if-else-block-dynamic-outro/_config.js @@ -18,4 +18,4 @@ export default { raf.tick(100); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-else-block-intro/_config.js b/test/runtime/samples/transition-js-if-else-block-intro/_config.js index c5eccf50e5..1f3b6fd118 100644 --- a/test/runtime/samples/transition-js-if-else-block-intro/_config.js +++ b/test/runtime/samples/transition-js-if-else-block-intro/_config.js @@ -18,4 +18,4 @@ export default { raf.tick(1000); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-else-block-outro/_config.js b/test/runtime/samples/transition-js-if-else-block-outro/_config.js index 4332ce82aa..1dc5af8f6c 100644 --- a/test/runtime/samples/transition-js-if-else-block-outro/_config.js +++ b/test/runtime/samples/transition-js-if-else-block-outro/_config.js @@ -14,4 +14,4 @@ export default { raf.tick(100); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-elseif-block-outro/_config.js b/test/runtime/samples/transition-js-if-elseif-block-outro/_config.js index f8886f889d..b11f33e7c1 100644 --- a/test/runtime/samples/transition-js-if-elseif-block-outro/_config.js +++ b/test/runtime/samples/transition-js-if-elseif-block-outro/_config.js @@ -20,4 +20,4 @@ export default { raf.tick(100); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js b/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js index 8a6269ad60..3f1b714a7c 100644 --- a/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js +++ b/test/runtime/samples/transition-js-if-outro-unrelated-component-binding-update/_config.js @@ -1,9 +1,9 @@ export default { async test({ assert, target, window, raf }) { - const button = target.querySelector("button"); - const event = new window.MouseEvent("click"); + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); await button.dispatchEvent(event); raf.tick(500); - assert.htmlEqual(target.innerHTML, ""); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js b/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js index 41d28fabf0..beea5d4a77 100644 --- a/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js +++ b/test/runtime/samples/transition-js-if-outro-unrelated-component-store-update/_config.js @@ -2,6 +2,6 @@ export default { async test({ assert, target, component, raf }) { await component.condition.set(false); raf.tick(500); - assert.htmlEqual(target.innerHTML, ""); - }, + assert.htmlEqual(target.innerHTML, ''); + } }; diff --git a/test/runtime/samples/transition-js-intro-enabled-by-option/_config.js b/test/runtime/samples/transition-js-intro-enabled-by-option/_config.js index 4b5f1cf987..af8e957b19 100644 --- a/test/runtime/samples/transition-js-intro-enabled-by-option/_config.js +++ b/test/runtime/samples/transition-js-intro-enabled-by-option/_config.js @@ -9,5 +9,5 @@ export default { raf.tick(50); assert.equal(div.foo, 0.5); - }, + } }; diff --git a/test/runtime/samples/transition-js-intro-skipped-by-default-nested/_config.js b/test/runtime/samples/transition-js-intro-skipped-by-default-nested/_config.js index 26bf248d57..e209e0a80c 100644 --- a/test/runtime/samples/transition-js-intro-skipped-by-default-nested/_config.js +++ b/test/runtime/samples/transition-js-intro-skipped-by-default-nested/_config.js @@ -5,5 +5,5 @@ export default { raf.tick(50); assert.equal(div.foo, undefined); - }, + } }; diff --git a/test/runtime/samples/transition-js-intro-skipped-by-default/_config.js b/test/runtime/samples/transition-js-intro-skipped-by-default/_config.js index 26bf248d57..e209e0a80c 100644 --- a/test/runtime/samples/transition-js-intro-skipped-by-default/_config.js +++ b/test/runtime/samples/transition-js-intro-skipped-by-default/_config.js @@ -5,5 +5,5 @@ export default { raf.tick(50); assert.equal(div.foo, undefined); - }, + } }; diff --git a/test/runtime/samples/transition-js-local-and-global/_config.js b/test/runtime/samples/transition-js-local-and-global/_config.js index b7f8baa7ee..09aefb6913 100644 --- a/test/runtime/samples/transition-js-local-and-global/_config.js +++ b/test/runtime/samples/transition-js-local-and-global/_config.js @@ -63,5 +63,5 @@ export default { raf.tick(400); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-local-nested-each-keyed/_config.js b/test/runtime/samples/transition-js-local-nested-each-keyed/_config.js index 0595e67013..14ad247187 100644 --- a/test/runtime/samples/transition-js-local-nested-each-keyed/_config.js +++ b/test/runtime/samples/transition-js-local-nested-each-keyed/_config.js @@ -26,5 +26,5 @@ export default { component.x = false; assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-local-nested-each/_config.js b/test/runtime/samples/transition-js-local-nested-each/_config.js index 0595e67013..14ad247187 100644 --- a/test/runtime/samples/transition-js-local-nested-each/_config.js +++ b/test/runtime/samples/transition-js-local-nested-each/_config.js @@ -26,5 +26,5 @@ export default { component.x = false; assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-local-nested-if/_config.js b/test/runtime/samples/transition-js-local-nested-if/_config.js index d1550c0cff..9f4e5a0bb0 100644 --- a/test/runtime/samples/transition-js-local-nested-if/_config.js +++ b/test/runtime/samples/transition-js-local-nested-if/_config.js @@ -36,5 +36,5 @@ export default { raf.tick(200); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-local/_config.js b/test/runtime/samples/transition-js-local/_config.js index fa8a55bfcd..5f9cf9048a 100644 --- a/test/runtime/samples/transition-js-local/_config.js +++ b/test/runtime/samples/transition-js-local/_config.js @@ -36,5 +36,5 @@ export default { raf.tick(200); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js b/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js index d6566ba61c..c2d782c0f2 100644 --- a/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js +++ b/test/runtime/samples/transition-js-nested-each-keyed-2/_config.js @@ -7,5 +7,5 @@ export default { test({ assert, component, target, window, raf }) { component.x = false; assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-nested-each-keyed/_config.js b/test/runtime/samples/transition-js-nested-each-keyed/_config.js index 3d2fe3c32e..5ec416afd9 100644 --- a/test/runtime/samples/transition-js-nested-each-keyed/_config.js +++ b/test/runtime/samples/transition-js-nested-each-keyed/_config.js @@ -21,5 +21,5 @@ export default { raf.tick(200); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-nested-each/_config.js b/test/runtime/samples/transition-js-nested-each/_config.js index c21024dd69..a74aba5610 100644 --- a/test/runtime/samples/transition-js-nested-each/_config.js +++ b/test/runtime/samples/transition-js-nested-each/_config.js @@ -21,5 +21,5 @@ export default { raf.tick(200); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-nested-if/_config.js b/test/runtime/samples/transition-js-nested-if/_config.js index 2fdd17da93..7d48077aca 100644 --- a/test/runtime/samples/transition-js-nested-if/_config.js +++ b/test/runtime/samples/transition-js-nested-if/_config.js @@ -21,5 +21,5 @@ export default { raf.tick(200); assert.htmlEqual(target.innerHTML, ''); - }, + } }; diff --git a/test/runtime/samples/transition-js-nested-intro/_config.js b/test/runtime/samples/transition-js-nested-intro/_config.js index 9072e885fc..9c23290b1a 100644 --- a/test/runtime/samples/transition-js-nested-intro/_config.js +++ b/test/runtime/samples/transition-js-nested-intro/_config.js @@ -16,4 +16,4 @@ export default { raf.tick(150); assert.equal(div.foo, 1); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/transition-js-parameterised-with-state/_config.js b/test/runtime/samples/transition-js-parameterised-with-state/_config.js index 64e40dc63d..b143e8fdd6 100644 --- a/test/runtime/samples/transition-js-parameterised-with-state/_config.js +++ b/test/runtime/samples/transition-js-parameterised-with-state/_config.js @@ -15,5 +15,5 @@ export default { assert.equal(div.foo, 200); raf.tick(101); - }, + } }; diff --git a/test/runtime/samples/transition-js-parameterised/_config.js b/test/runtime/samples/transition-js-parameterised/_config.js index 1370905547..6655cd374d 100644 --- a/test/runtime/samples/transition-js-parameterised/_config.js +++ b/test/runtime/samples/transition-js-parameterised/_config.js @@ -11,5 +11,5 @@ export default { assert.equal(div.foo, 200); raf.tick(101); - }, + } }; diff --git a/test/runtime/samples/transition-js-slot/_config.js b/test/runtime/samples/transition-js-slot/_config.js index a32e4bda72..e4d1c85a9f 100644 --- a/test/runtime/samples/transition-js-slot/_config.js +++ b/test/runtime/samples/transition-js-slot/_config.js @@ -23,4 +23,4 @@ export default { raf.tick(100); assert.equal(p.foo, 0); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/unchanged-expression-escape/_config.js b/test/runtime/samples/unchanged-expression-escape/_config.js index 11a54c0fe9..38c5728a06 100644 --- a/test/runtime/samples/unchanged-expression-escape/_config.js +++ b/test/runtime/samples/unchanged-expression-escape/_config.js @@ -3,5 +3,5 @@ export default {

Hello world, what's up? this & that

Hello world, what's up? this & that

Hello world, what's up? this & that

- `, + ` }; diff --git a/test/runtime/samples/unchanged-expression-xss/_config.js b/test/runtime/samples/unchanged-expression-xss/_config.js index fa5453dbf3..4b9f1deff2 100644 --- a/test/runtime/samples/unchanged-expression-xss/_config.js +++ b/test/runtime/samples/unchanged-expression-xss/_config.js @@ -1,3 +1,3 @@ export default { - html: `

<b\nstyle='color:\nred;'>RED?!?</b>

`, + html: "

<b\nstyle='color:\nred;'>RED?!?</b>

" }; diff --git a/test/runtime/samples/whitespace-each-block/_config.js b/test/runtime/samples/whitespace-each-block/_config.js index 5913ec41cc..269e21781b 100644 --- a/test/runtime/samples/whitespace-each-block/_config.js +++ b/test/runtime/samples/whitespace-each-block/_config.js @@ -6,7 +6,7 @@ export default { test({ assert, component, target }) { assert.equal( target.textContent, - `a b c ` + 'a b c ' ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/whitespace-list/_config.js b/test/runtime/samples/whitespace-list/_config.js index 0b96503508..1ba852726c 100644 --- a/test/runtime/samples/whitespace-list/_config.js +++ b/test/runtime/samples/whitespace-list/_config.js @@ -18,5 +18,5 @@ export default { const ul = target.querySelector('ul'); assert.equal(ul.childNodes.length, 5); - }, + } }; diff --git a/test/runtime/samples/whitespace-normal/_config.js b/test/runtime/samples/whitespace-normal/_config.js index e6716b46a8..9b82576c06 100644 --- a/test/runtime/samples/whitespace-normal/_config.js +++ b/test/runtime/samples/whitespace-normal/_config.js @@ -6,7 +6,7 @@ export default { test({ assert, component, target }) { assert.equal( target.textContent, - `Hello world! How are you?` + 'Hello world! How are you?' ); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/window-bind-scroll-update/_config.js b/test/runtime/samples/window-bind-scroll-update/_config.js index cb13ea11c2..ac6f54ad55 100644 --- a/test/runtime/samples/window-bind-scroll-update/_config.js +++ b/test/runtime/samples/window-bind-scroll-update/_config.js @@ -1,4 +1,4 @@ -import { env, useFakeTimers } from "../../../helpers"; +import { env, useFakeTimers } from '../../../helpers'; let clock; @@ -33,5 +33,5 @@ export default { clock.flush(); assert.equal(window.pageYOffset, 100); - }, + } }; diff --git a/test/runtime/samples/window-binding-resize/_config.js b/test/runtime/samples/window-binding-resize/_config.js index 1429f67db8..c396666014 100644 --- a/test/runtime/samples/window-binding-resize/_config.js +++ b/test/runtime/samples/window-binding-resize/_config.js @@ -1,5 +1,5 @@ export default { - html: `
1024x768
`, + html: '
1024x768
', before_test() { Object.defineProperties(window, { @@ -36,4 +36,4 @@ export default {
567x456
`); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/window-binding-scroll-store/_config.js b/test/runtime/samples/window-binding-scroll-store/_config.js index dbab4b36ac..0ce87efee0 100644 --- a/test/runtime/samples/window-binding-scroll-store/_config.js +++ b/test/runtime/samples/window-binding-scroll-store/_config.js @@ -4,8 +4,8 @@ export default { Object.defineProperties(window, { pageYOffset: { value: 0, - configurable: true, - }, + configurable: true + } }); }, async test({ assert, component, target, window }) { @@ -15,15 +15,15 @@ export default { Object.defineProperties(window, { pageYOffset: { value: 234, - configurable: true, - }, + configurable: true + } }); await window.dispatchEvent(event); assert.htmlEqual( target.innerHTML, - `

scroll\ny\nis\n234.\n234\n*\n234\n=\n54756

` + '

scroll\ny\nis\n234.\n234\n*\n234\n=\n54756

' ); - }, + } }; diff --git a/test/runtime/samples/window-event-context/_config.js b/test/runtime/samples/window-event-context/_config.js index 458a15719f..c07dd811b5 100644 --- a/test/runtime/samples/window-event-context/_config.js +++ b/test/runtime/samples/window-event-context/_config.js @@ -3,7 +3,7 @@ export default { foo: true }, - html: `true`, + html: 'true', skip: /^v4/.test(process.version), // node 4 apparently does some dumb stuff skip_if_ssr: true, // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason @@ -13,10 +13,10 @@ export default { await window.dispatchEvent(event); assert.equal(component.foo, false); - assert.htmlEqual(target.innerHTML, `false`); + assert.htmlEqual(target.innerHTML, 'false'); await window.dispatchEvent(event); assert.equal(component.foo, true); - assert.htmlEqual(target.innerHTML, `true`); + assert.htmlEqual(target.innerHTML, 'true'); } -}; \ No newline at end of file +}; diff --git a/test/runtime/samples/window-event-custom/_config.js b/test/runtime/samples/window-event-custom/_config.js index 1c1075c0de..15644bc8e8 100644 --- a/test/runtime/samples/window-event-custom/_config.js +++ b/test/runtime/samples/window-event-custom/_config.js @@ -1,5 +1,5 @@ export default { - html: `

escaped: false

`, + html: '

escaped: false

', async test({ assert, component, target, window }) { const event = new window.KeyboardEvent('keydown', { @@ -11,5 +11,5 @@ export default { assert.htmlEqual(target.innerHTML, `

escaped: true

`); - }, + } }; diff --git a/test/runtime/samples/window-event/_config.js b/test/runtime/samples/window-event/_config.js index bd09487f5e..90c6562f95 100644 --- a/test/runtime/samples/window-event/_config.js +++ b/test/runtime/samples/window-event/_config.js @@ -1,5 +1,5 @@ export default { - html: `
undefinedxundefined
`, + html: '
undefinedxundefined
', skip_if_ssr: true, // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason @@ -23,4 +23,4 @@ export default {
567x456
`); } -}; \ No newline at end of file +}; diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.ts similarity index 85% rename from test/server-side-rendering/index.js rename to test/server-side-rendering/index.ts index 2d539782ff..ef2a88ecbe 100644 --- a/test/server-side-rendering/index.js +++ b/test/server-side-rendering/index.ts @@ -1,9 +1,9 @@ -import * as assert from "assert"; -import * as fs from "fs"; -import * as path from "path"; -import * as glob from 'tiny-glob/sync.js'; +import * as fs from 'fs'; +import * as path from 'path'; +import glob from 'tiny-glob/sync.js'; import { + assert, showOutput, loadConfig, loadSvelte, @@ -12,13 +12,13 @@ import { cleanRequireCache, shouldUpdateExpected, mkdirp -} from "../helpers.js"; +} from '../helpers'; function tryToReadFile(file) { try { - return fs.readFileSync(file, "utf-8"); + return fs.readFileSync(file, 'utf-8'); } catch (err) { - if (err.code !== "ENOENT") throw err; + if (err.code !== 'ENOENT') throw err; return null; } } @@ -26,7 +26,7 @@ function tryToReadFile(file) { const sveltePath = process.cwd().split('\\').join('/'); let compile = null; -describe("ssr", () => { +describe('ssr', () => { before(() => { compile = loadSvelte(true).compile; @@ -34,7 +34,7 @@ describe("ssr", () => { }); fs.readdirSync(`${__dirname}/samples`).forEach(dir => { - if (dir[0] === ".") return; + if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); @@ -44,7 +44,7 @@ describe("ssr", () => { const show = /\.show/.test(dir); if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); + throw new Error('Forgot to remove `solo: true` from test'); } (solo ? it.only : it)(dir, () => { @@ -59,13 +59,13 @@ describe("ssr", () => { format: 'cjs' }; - require("../../register")(compileOptions); + require('../../register')(compileOptions); try { const Component = require(`${dir}/main.svelte`).default; const expectedHtml = tryToReadFile(`${dir}/_expected.html`); - const expectedCss = tryToReadFile(`${dir}/_expected.css`) || ""; + const expectedCss = tryToReadFile(`${dir}/_expected.css`) || ''; const props = tryToLoadJson(`${dir}/data.json`) || undefined; @@ -88,8 +88,8 @@ describe("ssr", () => { try { assert.equal( - css.code.replace(/^\s+/gm, "").replace(/[\r\n]/g, ""), - expectedCss.replace(/^\s+/gm, "").replace(/[\r\n]/g, "") + css.code.replace(/^\s+/gm, '').replace(/[\r\n]/g, ''), + expectedCss.replace(/^\s+/gm, '').replace(/[\r\n]/g, '') ); } catch (error) { if (shouldUpdateExpected()) { @@ -128,20 +128,20 @@ describe("ssr", () => { }); // duplicate client-side tests, as far as possible - fs.readdirSync("test/runtime/samples").forEach(dir => { - if (dir[0] === ".") return; + fs.readdirSync('test/runtime/samples').forEach(dir => { + if (dir[0] === '.') return; const config = loadConfig(`./runtime/samples/${dir}/_config.js`); const solo = config.solo || /\.solo/.test(dir); if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); + throw new Error('Forgot to remove `solo: true` from test'); } if (config.skip_if_ssr) return; (config.skip ? it.skip : solo ? it.only : it)(dir, () => { - const cwd = path.resolve("test/runtime/samples", dir); + const cwd = path.resolve('test/runtime/samples', dir); cleanRequireCache(); @@ -154,7 +154,7 @@ describe("ssr", () => { format: 'cjs' }; - require("../../register")(compileOptions); + require('../../register')(compileOptions); glob('**/*.svelte', { cwd }).forEach(file => { if (file[0] === '_') return; diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js deleted file mode 100644 index 0b0424a764..0000000000 --- a/test/sourcemaps/index.js +++ /dev/null @@ -1,73 +0,0 @@ -import * as fs from "fs"; -import * as path from "path"; -import * as assert from "assert"; -import { svelte } from "../helpers.js"; -import { SourceMapConsumer } from "source-map"; -import { getLocator } from "locate-character"; - -describe("sourcemaps", () => { - fs.readdirSync(`${__dirname}/samples`).forEach(dir => { - if (dir[0] === ".") return; - - // add .solo to a sample directory name to only run that test - const solo = /\.solo/.test(dir); - const skip = /\.skip/.test(dir); - - if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); - } - - (solo ? it.only : skip ? it.skip : it)(dir, async () => { - const filename = path.resolve( - `${__dirname}/samples/${dir}/input.svelte` - ); - const outputFilename = path.resolve( - `${__dirname}/samples/${dir}/output` - ); - - const input = fs.readFileSync(filename, "utf-8").replace(/\s+$/, ""); - const { js, css } = svelte.compile(input, { - filename, - outputFilename: `${outputFilename}.js`, - cssOutputFilename: `${outputFilename}.css` - }); - - const _code = js.code.replace(/Svelte v\d+\.\d+\.\d+/, match => match.replace(/\d/g, 'x')); - - fs.writeFileSync( - `${outputFilename}.js`, - `${_code}\n//# sourceMappingURL=output.js.map` - ); - fs.writeFileSync( - `${outputFilename}.js.map`, - JSON.stringify(js.map, null, " ") - ); - - if (css.code) { - fs.writeFileSync( - `${outputFilename}.css`, - `${css.code}\n/*# sourceMappingURL=output.css.map */` - ); - fs.writeFileSync( - `${outputFilename}.css.map`, - JSON.stringify(css.map, null, " ") - ); - } - - assert.deepEqual(js.map.sources, ["input.svelte"]); - if (css.map) assert.deepEqual(css.map.sources, ["input.svelte"]); - - const { test } = require(`./samples/${dir}/test.js`); - - const locateInSource = getLocator(input); - - const smc = await new SourceMapConsumer(js.map); - const locateInGenerated = getLocator(_code); - - const smcCss = css.map && await new SourceMapConsumer(css.map); - const locateInGeneratedCss = getLocator(css.code || ''); - - test({ assert, code: _code, map: js.map, smc, smcCss, locateInSource, locateInGenerated, locateInGeneratedCss }); - }); - }); -}); diff --git a/test/sourcemaps/index.ts b/test/sourcemaps/index.ts new file mode 100644 index 0000000000..7659948744 --- /dev/null +++ b/test/sourcemaps/index.ts @@ -0,0 +1,113 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as assert from 'assert'; +import { loadConfig, svelte } from '../helpers'; +// keep source-map at version 0.7.x +// https://github.com/mozilla/source-map/issues/400 +import { getLocator } from 'locate-character'; +import { SourceMapConsumer } from 'source-map'; + + +describe('sourcemaps', () => { + fs.readdirSync(`${__dirname}/samples`).forEach(dir => { + if (dir[0] === '.') return; + + const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); + + // add .solo to a sample directory name to only run that test + const solo = config.solo || /\.solo/.test(dir); + const skip = config.skip || /\.skip/.test(dir); + + if (solo && process.env.CI) { + throw new Error('Forgot to remove `solo: true` from test'); + } + + (solo ? it.only : skip ? it.skip : it)(dir, async () => { + const { test } = require(`./samples/${dir}/test.js`); + const inputFile = path.resolve(`${__dirname}/samples/${dir}/input.svelte`); + const outputName = '_actual'; + const outputBase = path.resolve(`${__dirname}/samples/${dir}/${outputName}`); + + const inputCode = fs.readFileSync(inputFile, 'utf-8'); + const input = { + code: inputCode, + locate: getLocator(inputCode) + }; + + const preprocessed = await svelte.preprocess( + input.code, + config.preprocess || {}, + { + filename: 'input.svelte' + } + ); + + const { js, css } = svelte.compile( + preprocessed.code, { + filename: 'input.svelte', + // filenames for sourcemaps + outputFilename: `${outputName}.js`, + cssOutputFilename: `${outputName}.css` + }); + + js.code = js.code.replace( + /generated by Svelte v\d+\.\d+\.\d+/, + match => match.replace(/\d/g, 'x') + ); + + fs.writeFileSync(`${outputBase}.svelte`, preprocessed.code); + if (preprocessed.map) { + fs.writeFileSync( + `${outputBase}.svelte.map`, + // TODO encode mappings for output - svelte.preprocess returns decoded mappings + JSON.stringify(preprocessed.map, null, 2) + ); + } + fs.writeFileSync( + `${outputBase}.js`, + `${js.code}\n//# sourceMappingURL=${outputName}.js.map` + ); + fs.writeFileSync( + `${outputBase}.js.map`, + JSON.stringify(js.map, null, 2) + ); + if (css.code) { + fs.writeFileSync( + `${outputBase}.css`, + `${css.code}\n/*# sourceMappingURL=${outputName}.css.map */` + ); + fs.writeFileSync( + `${outputBase}.css.map`, + JSON.stringify(css.map, null, ' ') + ); + } + + assert.deepEqual( + js.map.sources.slice().sort(), + (config.js_map_sources || ['input.svelte']).sort() + ); + if (css.map) { + assert.deepEqual( + css.map.sources.slice().sort(), + (config.css_map_sources || ['input.svelte']).sort() + ); + } + + // use locate_1 with mapConsumer: + // lines are one-based, columns are zero-based + + preprocessed.mapConsumer = preprocessed.map && await new SourceMapConsumer(preprocessed.map); + preprocessed.locate = getLocator(preprocessed.code); + preprocessed.locate_1 = getLocator(preprocessed.code, { offsetLine: 1 }); + + js.mapConsumer = js.map && await new SourceMapConsumer(js.map); + js.locate = getLocator(js.code); + js.locate_1 = getLocator(js.code, { offsetLine: 1 }); + + css.mapConsumer = css.map && await new SourceMapConsumer(css.map); + css.locate = getLocator(css.code || ''); + css.locate_1 = getLocator(css.code || '', { offsetLine: 1 }); + test({ assert, input, preprocessed, js, css }); + }); + }); +}); diff --git a/test/sourcemaps/samples/basic/test.js b/test/sourcemaps/samples/basic/test.js index 7059761674..34c619c128 100644 --- a/test/sourcemaps/samples/basic/test.js +++ b/test/sourcemaps/samples/basic/test.js @@ -1,12 +1,12 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource('foo.bar.baz'); +export function test({ assert, input, js }) { + const expected = input.locate('foo.bar.baz'); let start; let actual; - start = locateInGenerated('ctx[0].bar.baz'); + start = js.locate('ctx[0].bar.baz'); - actual = smc.originalPositionFor({ + actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); @@ -18,9 +18,9 @@ export function test({ assert, smc, locateInSource, locateInGenerated }) { column: expected.column }); - start = locateInGenerated('ctx[0].bar.baz', start.character + 1); + start = js.locate('ctx[0].bar.baz', start.character + 1); - actual = smc.originalPositionFor({ + actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/sourcemaps/samples/binding-shorthand.skip/test.js b/test/sourcemaps/samples/binding-shorthand.skip/test.js index cdfbbdc091..13ecdbf889 100644 --- a/test/sourcemaps/samples/binding-shorthand.skip/test.js +++ b/test/sourcemaps/samples/binding-shorthand.skip/test.js @@ -1,13 +1,14 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource('potato'); +export function test({ assert, input, js }) { + const expected = input.locate('potato'); let start; - start = locateInGenerated('potato'); - start = locateInGenerated('potato', start.character + 1); - start = locateInGenerated('potato', start.character + 1); // we need the third instance of 'potato' + start = js.locate('potato'); + start = js.locate('potato', start.character + 1); + start = js.locate('potato', start.character + 1); + // we need the third instance of 'potato' - const actual = smc.originalPositionFor({ + const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/sourcemaps/samples/binding/test.js b/test/sourcemaps/samples/binding/test.js index 31c0e98442..3cb3246e50 100644 --- a/test/sourcemaps/samples/binding/test.js +++ b/test/sourcemaps/samples/binding/test.js @@ -1,12 +1,12 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource('bar.baz'); +export function test({ assert, input, js }) { + const expected = input.locate('bar.baz'); let start; let actual; - start = locateInGenerated('bar.baz'); + start = js.locate('bar.baz'); - actual = smc.originalPositionFor({ + actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); @@ -18,9 +18,9 @@ export function test({ assert, smc, locateInSource, locateInGenerated }) { column: expected.column }); - start = locateInGenerated('bar.baz', start.character + 1); + start = js.locate('bar.baz', start.character + 1); - actual = smc.originalPositionFor({ + actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/sourcemaps/samples/css/test.js b/test/sourcemaps/samples/css/test.js index 54082bd4ee..1e0dda1dff 100644 --- a/test/sourcemaps/samples/css/test.js +++ b/test/sourcemaps/samples/css/test.js @@ -1,14 +1,14 @@ -export function test({ assert, smcCss, locateInSource, locateInGeneratedCss }) { - const expected = locateInSource( '.foo' ); +export function test({ assert, input, css }) { + const expected = input.locate('.foo'); - const start = locateInGeneratedCss( '.foo' ); + const start = css.locate('.foo'); - const actual = smcCss.originalPositionFor({ + const actual = css.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); - assert.deepEqual( actual, { + assert.deepEqual(actual, { source: 'input.svelte', name: null, line: expected.line + 1, diff --git a/test/sourcemaps/samples/each-block/test.js b/test/sourcemaps/samples/each-block/test.js index 35479986a5..08b37686a4 100644 --- a/test/sourcemaps/samples/each-block/test.js +++ b/test/sourcemaps/samples/each-block/test.js @@ -1,10 +1,10 @@ -export function test({ assert, code, smc, map, locateInSource, locateInGenerated }) { - const startIndex = code.indexOf('create_main_fragment'); +export function test({ assert, input, js }) { + const startIndex = js.code.indexOf('create_main_fragment'); - const expected = locateInSource('each'); - const start = locateInGenerated('length', startIndex); + const expected = input.locate('each'); + const start = js.locate('length', startIndex); - const actual = smc.originalPositionFor({ + const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/sourcemaps/samples/script-after-comment/test.js b/test/sourcemaps/samples/script-after-comment/test.js index b473970112..06ecc46929 100644 --- a/test/sourcemaps/samples/script-after-comment/test.js +++ b/test/sourcemaps/samples/script-after-comment/test.js @@ -1,13 +1,13 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource( 'assertThisLine' ); - const start = locateInGenerated( 'assertThisLine' ); +export function test({ assert, input, js }) { + const expected = input.locate('assertThisLine'); + const start = js.locate('assertThisLine'); - const actual = smc.originalPositionFor({ + const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); - assert.deepEqual( actual, { + assert.deepEqual(actual, { source: 'input.svelte', name: null, line: expected.line + 1, diff --git a/test/sourcemaps/samples/script/test.js b/test/sourcemaps/samples/script/test.js index 73971ef487..e6a91f51e1 100644 --- a/test/sourcemaps/samples/script/test.js +++ b/test/sourcemaps/samples/script/test.js @@ -1,8 +1,8 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource( '42' ); - const start = locateInGenerated( '42' ); +export function test({ assert, input, js }) { + const expected = input.locate('42'); + const start = js.locate('42'); - const actual = smc.originalPositionFor({ + const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/sourcemaps/samples/static-no-script/test.js b/test/sourcemaps/samples/static-no-script/test.js index a8f4d89ab8..c683c94d6b 100644 --- a/test/sourcemaps/samples/static-no-script/test.js +++ b/test/sourcemaps/samples/static-no-script/test.js @@ -1,9 +1,9 @@ -const fs = require( 'fs' ); -const path = require( 'path' ); +const fs = require('fs'); +const path = require('path'); -export function test({ assert, map }) { - assert.deepEqual( map.sources, [ 'input.svelte' ]); - assert.deepEqual( map.sourcesContent, [ - fs.readFileSync( path.join( __dirname, 'input.svelte' ), 'utf-8' ) +export function test({ assert, js }) { + assert.deepEqual(js.map.sources, ['input.svelte']); + assert.deepEqual(js.map.sourcesContent, [ + fs.readFileSync(path.join(__dirname, 'input.svelte'), 'utf-8') ]); } diff --git a/test/sourcemaps/samples/two-scripts/test.js b/test/sourcemaps/samples/two-scripts/test.js index b473970112..70901af8c9 100644 --- a/test/sourcemaps/samples/two-scripts/test.js +++ b/test/sourcemaps/samples/two-scripts/test.js @@ -1,8 +1,8 @@ -export function test({ assert, smc, locateInSource, locateInGenerated }) { - const expected = locateInSource( 'assertThisLine' ); - const start = locateInGenerated( 'assertThisLine' ); +export function test({ assert, input, js }) { + const expected = input.locate( 'assertThisLine' ); + const start = js.locate( 'assertThisLine' ); - const actual = smc.originalPositionFor({ + const actual = js.mapConsumer.originalPositionFor({ line: start.line + 1, column: start.column }); diff --git a/test/stats/index.js b/test/stats/index.ts similarity index 95% rename from test/stats/index.js rename to test/stats/index.ts index acea7a4663..a6efd93d22 100644 --- a/test/stats/index.js +++ b/test/stats/index.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as assert from 'assert'; -import { svelte, loadConfig, tryToLoadJson } from '../helpers.js'; +import { svelte, loadConfig, tryToLoadJson } from '../helpers'; describe('stats', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { diff --git a/test/stats/samples/basic/_config.js b/test/stats/samples/basic/_config.js index 434e11bd76..7f1d557d23 100644 --- a/test/stats/samples/basic/_config.js +++ b/test/stats/samples/basic/_config.js @@ -3,4 +3,4 @@ export default { assert.equal(typeof stats.timings, 'object'); assert.equal(typeof stats.timings.total, 'number'); } -}; \ No newline at end of file +}; diff --git a/test/test.js b/test/test.ts similarity index 84% rename from test/test.js rename to test/test.ts index 6ea4bd60ab..181e9351c1 100644 --- a/test/test.js +++ b/test/test.ts @@ -3,12 +3,12 @@ const glob = require('tiny-glob/sync.js'); require('./setup'); // bind internal to jsdom -require('./helpers'); +require('./helpers.ts'); require('../internal'); console.clear(); -const test_folders = glob('*/index.js', { cwd: 'test' }); +const test_folders = glob('*/index.ts', { cwd: 'test' }); const solo_folders = test_folders.filter(folder => /\.solo/.test(folder)); if (solo_folders.length) { diff --git a/test/validator/index.js b/test/validator/index.ts similarity index 71% rename from test/validator/index.js rename to test/validator/index.ts index 433e1a94ae..1709b7a706 100644 --- a/test/validator/index.js +++ b/test/validator/index.ts @@ -1,23 +1,23 @@ -import * as fs from "fs"; -import * as assert from "assert"; -import { svelte, loadConfig, tryToLoadJson } from "../helpers.js"; +import * as fs from 'fs'; +import * as assert from 'assert'; +import { svelte, loadConfig, tryToLoadJson } from '../helpers'; -describe("validate", () => { +describe('validate', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { - if (dir[0] === ".") return; + if (dir[0] === '.') return; // add .solo to a sample directory name to only run that test const solo = /\.solo/.test(dir); const skip = /\.skip/.test(dir); if (solo && process.env.CI) { - throw new Error("Forgot to remove `solo: true` from test"); + throw new Error('Forgot to remove `solo: true` from test'); } (solo ? it.only : skip ? it.skip : it)(dir, () => { const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); - const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, "utf-8").replace(/\s+$/, "").replace(/\r/g, ""); + const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8').replace(/\s+$/, '').replace(/\r/g, ''); const expected_warnings = tryToLoadJson(`${__dirname}/samples/${dir}/warnings.json`) || []; const expected_errors = tryToLoadJson(`${__dirname}/samples/${dir}/errors.json`); const options = tryToLoadJson(`${__dirname}/samples/${dir}/options.json`); @@ -30,7 +30,7 @@ describe("validate", () => { legacy: config.legacy, generate: false, customElement: config.customElement, - ...options, + ...options }); assert.deepEqual(warnings.map(w => ({ @@ -69,18 +69,18 @@ describe("validate", () => { }); }); - it("errors if options.name is illegal", () => { + it('errors if options.name is illegal', () => { assert.throws(() => { - svelte.compile("
", { - name: "not.valid", + svelte.compile('
', { + name: 'not.valid', generate: false }); }, /options\.name must be a valid identifier/); }); - it("warns if options.name is not capitalised", () => { - const { warnings } = svelte.compile("
", { - name: "lowercase", + it('warns if options.name is not capitalised', () => { + const { warnings } = svelte.compile('
', { + name: 'lowercase', generate: false }); @@ -88,14 +88,14 @@ describe("validate", () => { code: w.code, message: w.message })), [{ - code: `options-lowercase-name`, - message: "options.name should be capitalised" + code: 'options-lowercase-name', + message: 'options.name should be capitalised' }]); }); - it("does not warn if options.name begins with non-alphabetic character", () => { - const { warnings } = svelte.compile("
", { - name: "_", + it('does not warn if options.name begins with non-alphabetic character', () => { + const { warnings } = svelte.compile('
', { + name: '_', generate: false }); diff --git a/test/validator/samples/a11y-label-has-associated-control/input.svelte b/test/validator/samples/a11y-label-has-associated-control/input.svelte new file mode 100644 index 0000000000..43304689dc --- /dev/null +++ b/test/validator/samples/a11y-label-has-associated-control/input.svelte @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/validator/samples/a11y-label-has-associated-control/warnings.json b/test/validator/samples/a11y-label-has-associated-control/warnings.json new file mode 100644 index 0000000000..b70a1a47de --- /dev/null +++ b/test/validator/samples/a11y-label-has-associated-control/warnings.json @@ -0,0 +1,32 @@ +[ + { + "code": "a11y-label-has-associated-control", + "end": { + "character": 16, + "column": 16, + "line": 1 + }, + "message": "A11y: A form label must be associated with a control.", + "pos": 0, + "start": { + "character": 0, + "column": 0, + "line": 1 + } + }, + { + "code": "a11y-label-has-associated-control", + "end": { + "character": 149, + "column": 30, + "line": 6 + }, + "message": "A11y: A form label must be associated with a control.", + "pos": 119, + "start": { + "character": 119, + "column": 0, + "line": 6 + } + } +] diff --git a/test/validator/samples/a11y-media-has-caption/input.svelte b/test/validator/samples/a11y-media-has-caption/input.svelte new file mode 100644 index 0000000000..105269cddb --- /dev/null +++ b/test/validator/samples/a11y-media-has-caption/input.svelte @@ -0,0 +1,4 @@ + + + + diff --git a/test/validator/samples/a11y-media-has-caption/warnings.json b/test/validator/samples/a11y-media-has-caption/warnings.json new file mode 100644 index 0000000000..a8c894b1d4 --- /dev/null +++ b/test/validator/samples/a11y-media-has-caption/warnings.json @@ -0,0 +1,32 @@ +[ + { + "code": "a11y-media-has-caption", + "end": { + "character": 55, + "column": 15, + "line": 2 + }, + "message": "A11y: Media elements must have a ", + "pos": 40, + "start": { + "character": 40, + "column": 0, + "line": 2 + } + }, + { + "code": "a11y-media-has-caption", + "end": { + "character": 80, + "column": 24, + "line": 3 + }, + "message": "A11y: Media elements must have a ", + "pos": 56, + "start": { + "character": 56, + "column": 0, + "line": 3 + } + } +] diff --git a/test/validator/samples/action-object/input.svelte b/test/validator/samples/action-object/input.svelte new file mode 100644 index 0000000000..e0962fa594 --- /dev/null +++ b/test/validator/samples/action-object/input.svelte @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/test/validator/samples/action-object/warnings.json b/test/validator/samples/action-object/warnings.json new file mode 100644 index 0000000000..e1ccbb55a2 --- /dev/null +++ b/test/validator/samples/action-object/warnings.json @@ -0,0 +1,17 @@ +[ + { + "code": "missing-declaration", + "end": { + "character": 217, + "column": 39, + "line": 11 + }, + "message": "'foo' is not defined", + "pos": 186, + "start": { + "character": 186, + "column": 8, + "line": 11 + } + } +] diff --git a/test/validator/samples/component-name-lowercase/input.svelte b/test/validator/samples/component-name-lowercase/input.svelte new file mode 100644 index 0000000000..ebd7cf3481 --- /dev/null +++ b/test/validator/samples/component-name-lowercase/input.svelte @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/test/validator/samples/component-name-lowercase/warnings.json b/test/validator/samples/component-name-lowercase/warnings.json new file mode 100644 index 0000000000..37765b423d --- /dev/null +++ b/test/validator/samples/component-name-lowercase/warnings.json @@ -0,0 +1,17 @@ +[ + { + "code": "component-name-lowercase", + "message": " will be treated as an HTML element unless it begins with a capital letter", + "pos": 82, + "start": { + "character": 82, + "column": 0, + "line": 6 + }, + "end": { + "character": 102, + "column": 20, + "line": 6 + } + } +] diff --git a/test/validator/samples/each-block-multiple-children/_config.js b/test/validator/samples/each-block-multiple-children/_config.js index e26996239d..083edcd210 100644 --- a/test/validator/samples/each-block-multiple-children/_config.js +++ b/test/validator/samples/each-block-multiple-children/_config.js @@ -1,3 +1,3 @@ export default { dev: true -}; \ No newline at end of file +}; diff --git a/test/validator/samples/event-modifiers-invalid-nonpassive/errors.json b/test/validator/samples/event-modifiers-invalid-nonpassive/errors.json new file mode 100644 index 0000000000..a7e5a2a76c --- /dev/null +++ b/test/validator/samples/event-modifiers-invalid-nonpassive/errors.json @@ -0,0 +1,15 @@ +[{ + "message": "The 'passive' and 'nonpassive' modifiers cannot be used together", + "code": "invalid-event-modifier", + "start": { + "line": 1, + "column": 5, + "character": 5 + }, + "end": { + "line": 1, + "column": 51, + "character": 51 + }, + "pos": 5 +}] diff --git a/test/validator/samples/event-modifiers-invalid-nonpassive/input.svelte b/test/validator/samples/event-modifiers-invalid-nonpassive/input.svelte new file mode 100644 index 0000000000..3557aa4b1d --- /dev/null +++ b/test/validator/samples/event-modifiers-invalid-nonpassive/input.svelte @@ -0,0 +1,3 @@ +
+ oops +
\ No newline at end of file diff --git a/test/validator/samples/event-modifiers-invalid/errors.json b/test/validator/samples/event-modifiers-invalid/errors.json index 8be2ca7348..59a142d632 100644 --- a/test/validator/samples/event-modifiers-invalid/errors.json +++ b/test/validator/samples/event-modifiers-invalid/errors.json @@ -1,5 +1,5 @@ [{ - "message": "Valid event modifiers are preventDefault, stopPropagation, capture, once, passive or self", + "message": "Valid event modifiers are preventDefault, stopPropagation, capture, once, passive, nonpassive or self", "code": "invalid-event-modifier", "start": { "line": 1, diff --git a/test/validator/samples/event-modifiers-legacy/_config.js b/test/validator/samples/event-modifiers-legacy/_config.js index 0179e05ec4..52f59c8767 100644 --- a/test/validator/samples/event-modifiers-legacy/_config.js +++ b/test/validator/samples/event-modifiers-legacy/_config.js @@ -1,3 +1,3 @@ export default { legacy: true -}; \ No newline at end of file +}; diff --git a/test/validator/samples/import-meta/errors.json b/test/validator/samples/import-meta/errors.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/test/validator/samples/import-meta/errors.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test/validator/samples/import-meta/input.svelte b/test/validator/samples/import-meta/input.svelte new file mode 100644 index 0000000000..a5ce32dd77 --- /dev/null +++ b/test/validator/samples/import-meta/input.svelte @@ -0,0 +1,6 @@ + + +{url} +{import.meta.url} diff --git a/test/validator/samples/non-empty-block-dev/_config.js b/test/validator/samples/non-empty-block-dev/_config.js index e26996239d..083edcd210 100644 --- a/test/validator/samples/non-empty-block-dev/_config.js +++ b/test/validator/samples/non-empty-block-dev/_config.js @@ -1,3 +1,3 @@ export default { dev: true -}; \ No newline at end of file +}; diff --git a/test/vars/index.js b/test/vars/index.ts similarity index 95% rename from test/vars/index.js rename to test/vars/index.ts index a12ac177f2..4cebf7fbb4 100644 --- a/test/vars/index.js +++ b/test/vars/index.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as assert from 'assert'; -import { svelte, loadConfig, tryToLoadJson } from '../helpers.js'; +import { svelte, loadConfig, tryToLoadJson } from '../helpers'; describe('vars', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { diff --git a/test/vars/samples/$$props-logicless/_config.js b/test/vars/samples/$$props-logicless/_config.js index 20f9b99466..05bbe7e0b2 100644 --- a/test/vars/samples/$$props-logicless/_config.js +++ b/test/vars/samples/$$props-logicless/_config.js @@ -14,4 +14,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/$$props/_config.js b/test/vars/samples/$$props/_config.js index 20f9b99466..05bbe7e0b2 100644 --- a/test/vars/samples/$$props/_config.js +++ b/test/vars/samples/$$props/_config.js @@ -14,4 +14,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/assumed-global/_config.js b/test/vars/samples/assumed-global/_config.js index 2b84e83f12..782760bb8b 100644 --- a/test/vars/samples/assumed-global/_config.js +++ b/test/vars/samples/assumed-global/_config.js @@ -1,5 +1,5 @@ export default { test(assert, vars) { assert.deepEqual(vars, []); - }, + } }; diff --git a/test/vars/samples/component-namespaced/_config.js b/test/vars/samples/component-namespaced/_config.js index a801c52780..8ed4872355 100644 --- a/test/vars/samples/component-namespaced/_config.js +++ b/test/vars/samples/component-namespaced/_config.js @@ -14,4 +14,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/duplicate-globals/_config.js b/test/vars/samples/duplicate-globals/_config.js index 2b84e83f12..782760bb8b 100644 --- a/test/vars/samples/duplicate-globals/_config.js +++ b/test/vars/samples/duplicate-globals/_config.js @@ -1,5 +1,5 @@ export default { test(assert, vars) { assert.deepEqual(vars, []); - }, + } }; diff --git a/test/vars/samples/duplicate-non-hoistable/_config.js b/test/vars/samples/duplicate-non-hoistable/_config.js index 4ebc5b00cf..bd70e29800 100644 --- a/test/vars/samples/duplicate-non-hoistable/_config.js +++ b/test/vars/samples/duplicate-non-hoistable/_config.js @@ -13,5 +13,5 @@ export default { writable: true } ]); - }, + } }; diff --git a/test/vars/samples/duplicate-vars/_config.js b/test/vars/samples/duplicate-vars/_config.js index eb10c44a9a..749a0c59af 100644 --- a/test/vars/samples/duplicate-vars/_config.js +++ b/test/vars/samples/duplicate-vars/_config.js @@ -24,5 +24,5 @@ export default { writable: true } ]); - }, + } }; diff --git a/test/vars/samples/implicit-reactive/_config.js b/test/vars/samples/implicit-reactive/_config.js index 770de590e6..a8bf261d4f 100644 --- a/test/vars/samples/implicit-reactive/_config.js +++ b/test/vars/samples/implicit-reactive/_config.js @@ -24,5 +24,5 @@ export default { writable: true } ]); - }, + } }; diff --git a/test/vars/samples/imports/_config.js b/test/vars/samples/imports/_config.js index ecf120c7d6..47e8c0c5d9 100644 --- a/test/vars/samples/imports/_config.js +++ b/test/vars/samples/imports/_config.js @@ -36,4 +36,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/modules-vars/_config.js b/test/vars/samples/modules-vars/_config.js index e178941db6..52b8940148 100644 --- a/test/vars/samples/modules-vars/_config.js +++ b/test/vars/samples/modules-vars/_config.js @@ -2,7 +2,7 @@ export default { test(assert, vars) { assert.deepEqual(vars, [ { - name: "a", + name: 'a', export_name: null, injected: false, module: true, @@ -13,7 +13,7 @@ export default { writable: true }, { - name: "b", + name: 'b', export_name: null, injected: false, module: true, @@ -24,7 +24,7 @@ export default { writable: true }, { - name: "c", + name: 'c', export_name: null, injected: false, module: true, @@ -35,7 +35,7 @@ export default { writable: true }, { - name: "d", + name: 'd', export_name: null, injected: false, module: true, @@ -46,7 +46,7 @@ export default { writable: true }, { - name: "c", + name: 'c', export_name: null, injected: false, module: false, @@ -57,7 +57,7 @@ export default { writable: true }, { - name: "foo", + name: 'foo', export_name: null, injected: false, module: false, diff --git a/test/vars/samples/mutated-vs-reassigned-bindings/_config.js b/test/vars/samples/mutated-vs-reassigned-bindings/_config.js index ba499674d2..65c7d5cc90 100644 --- a/test/vars/samples/mutated-vs-reassigned-bindings/_config.js +++ b/test/vars/samples/mutated-vs-reassigned-bindings/_config.js @@ -25,4 +25,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/mutated-vs-reassigned/_config.js b/test/vars/samples/mutated-vs-reassigned/_config.js index ba499674d2..65c7d5cc90 100644 --- a/test/vars/samples/mutated-vs-reassigned/_config.js +++ b/test/vars/samples/mutated-vs-reassigned/_config.js @@ -25,4 +25,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/props/_config.js b/test/vars/samples/props/_config.js index a51c93fb03..d5f5d1cc2b 100644 --- a/test/vars/samples/props/_config.js +++ b/test/vars/samples/props/_config.js @@ -47,4 +47,4 @@ export default { } ]); } -}; \ No newline at end of file +}; diff --git a/test/vars/samples/referenced-from-script/_config.js b/test/vars/samples/referenced-from-script/_config.js index 191a52f8cc..ec068cb1d7 100644 --- a/test/vars/samples/referenced-from-script/_config.js +++ b/test/vars/samples/referenced-from-script/_config.js @@ -10,7 +10,7 @@ export default { reassigned: false, referenced: false, writable: false, - referenced_from_script: false, + referenced_from_script: false }, { name: 'j', @@ -21,7 +21,7 @@ export default { reassigned: false, referenced: false, writable: false, - referenced_from_script: false, + referenced_from_script: false }, { name: 'k', @@ -32,7 +32,7 @@ export default { reassigned: false, referenced: false, writable: false, - referenced_from_script: false, + referenced_from_script: false }, { name: 'a', @@ -43,7 +43,7 @@ export default { reassigned: true, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'b', @@ -54,7 +54,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'c', @@ -65,7 +65,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'd', @@ -76,7 +76,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'e', @@ -87,7 +87,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: false, + referenced_from_script: false }, { name: 'f', @@ -98,7 +98,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: false, + referenced_from_script: false }, { name: 'g', @@ -109,7 +109,7 @@ export default { reassigned: false, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'h', @@ -120,7 +120,7 @@ export default { reassigned: true, referenced: false, writable: true, - referenced_from_script: true, + referenced_from_script: true }, { name: 'foo', @@ -131,7 +131,7 @@ export default { reassigned: false, referenced: false, writable: false, - referenced_from_script: false, + referenced_from_script: false }, { name: 'l', @@ -142,7 +142,7 @@ export default { reassigned: false, referenced: false, referenced_from_script: true, - writable: false, + writable: false }, { name: 'bar', @@ -153,8 +153,8 @@ export default { reassigned: false, referenced: false, writable: false, - referenced_from_script: false, - }, + referenced_from_script: false + } ]); - }, + } }; diff --git a/test/vars/samples/template-references/_config.js b/test/vars/samples/template-references/_config.js index 674e351517..34c07e19e0 100644 --- a/test/vars/samples/template-references/_config.js +++ b/test/vars/samples/template-references/_config.js @@ -10,7 +10,7 @@ export default { reassigned: false, referenced: true, referenced_from_script: false, - writable: false, + writable: false }, { export_name: null, @@ -21,7 +21,7 @@ export default { reassigned: false, referenced: true, referenced_from_script: false, - writable: true, + writable: true }, { export_name: null, @@ -32,8 +32,8 @@ export default { reassigned: false, referenced: true, referenced_from_script: false, - writable: true, - }, + writable: true + } ]); - }, + } }; diff --git a/test/vars/samples/undeclared/_config.js b/test/vars/samples/undeclared/_config.js index 2b84e83f12..782760bb8b 100644 --- a/test/vars/samples/undeclared/_config.js +++ b/test/vars/samples/undeclared/_config.js @@ -1,5 +1,5 @@ export default { test(assert, vars) { assert.deepEqual(vars, []); - }, + } };