diff --git a/.eslintignore b/.eslintignore index 1682c3706de6..a84efdafe36f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ src/shared shared.js +test/test.js \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 862286e3955d..9eb0f073979a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - "4" - "6" - "node" env: diff --git a/mocha.coverage.opts b/mocha.coverage.opts index 5ad6a0e7a44a..27e9bc5f94a8 100644 --- a/mocha.coverage.opts +++ b/mocha.coverage.opts @@ -2,4 +2,4 @@ --require reify --recursive ./**/__test__.js -test/*.js +test/*/index.js diff --git a/mocha.opts b/mocha.opts index d10eaa31b315..4e8a550a4c9c 100644 --- a/mocha.opts +++ b/mocha.opts @@ -1,4 +1 @@ ---require reify ---recursive -./**/__test__.js -test/*.js +test/test.js diff --git a/package.json b/package.json index 49c3d803c7e9..481bb8fbd2e9 100644 --- a/package.json +++ b/package.json @@ -44,9 +44,17 @@ }, "devDependencies": { "acorn": "^4.0.4", + "babel": "^6.23.0", + "babel-core": "^6.23.1", "babel-plugin-istanbul": "^3.0.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", - "babel-register": "^6.18.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.23.0", + "babel-plugin-transform-es2015-destructuring": "^6.23.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", + "babel-plugin-transform-es2015-parameters": "^6.23.0", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-preset-env": "^1.2.1", + "babel-register": "^6.23.0", "codecov": "^1.0.1", "console-group": "^0.3.2", "css-tree": "^1.0.0-alpha16", @@ -54,6 +62,7 @@ "eslint-plugin-import": "^2.2.0", "estree-walker": "^0.3.0", "fuzzyset.js": "0.0.1", + "glob": "^7.1.1", "jsdom": "^9.9.1", "locate-character": "^2.0.0", "mocha": "^3.2.0", @@ -78,6 +87,11 @@ }, "babel": { "plugins": [ + "transform-es2015-arrow-functions", + "transform-es2015-block-scoping", + "transform-es2015-spread", + "transform-es2015-parameters", + "transform-es2015-destructuring", "transform-es2015-modules-commonjs" ] } diff --git a/rollup/rollup.config.main.js b/rollup/rollup.config.main.js index 790c9b232d04..334ead686038 100644 --- a/rollup/rollup.config.main.js +++ b/rollup/rollup.config.main.js @@ -1,6 +1,7 @@ import nodeResolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; import json from 'rollup-plugin-json'; +import buble from 'rollup-plugin-buble'; export default { entry: 'src/index.js', @@ -11,7 +12,14 @@ export default { plugins: [ nodeResolve({ jsnext: true, module: true }), commonjs(), - json() + json(), + buble({ + include: 'src/**', + exclude: 'src/shared/**', + transforms: { + dangerousTaggedTemplateString: true + } + }) ], external: [ 'magic-string' ], globals: { diff --git a/rollup/rollup.config.ssr.js b/rollup/rollup.config.ssr.js index 6f8922a85462..6d16a185ae61 100644 --- a/rollup/rollup.config.ssr.js +++ b/rollup/rollup.config.ssr.js @@ -1,6 +1,7 @@ import * as path from 'path'; import nodeResolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; +import buble from 'rollup-plugin-buble'; export default { entry: 'src/server-side-rendering/register.js', @@ -10,7 +11,14 @@ export default { ], plugins: [ nodeResolve({ jsnext: true, module: true }), - commonjs() + commonjs(), + buble({ + include: 'src/**', + exclude: 'src/shared/**', + transforms: { + dangerousTaggedTemplateString: true + } + }) ], external: [ path.resolve( 'src/index.js' ), 'fs', 'path', 'magic-string' ], paths: { diff --git a/src/generators/dom/visitors/Component.js b/src/generators/dom/visitors/Component.js index f0d0b53d9542..990b947f7cdf 100644 --- a/src/generators/dom/visitors/Component.js +++ b/src/generators/dom/visitors/Component.js @@ -16,7 +16,7 @@ export default { namespace: generator.current.namespace, isComponent: true, - allUsedContexts: new Set(), + allUsedContexts: [], init: new CodeBuilder(), update: new CodeBuilder() @@ -28,10 +28,8 @@ export default { addComponentAttributes( generator, node, local ); - if ( local.allUsedContexts.size ) { - const contextNames = [...local.allUsedContexts]; - - const initialProps = contextNames.map( contextName => { + if ( local.allUsedContexts.length ) { + const initialProps = local.allUsedContexts.map( contextName => { if ( contextName === 'root' ) return `root: root`; const listName = generator.current.listNames[ contextName ]; @@ -40,7 +38,7 @@ export default { return `${listName}: ${listName},\n${indexName}: ${indexName}`; }).join( ',\n' ); - const updates = contextNames.map( contextName => { + const updates = local.allUsedContexts.map( contextName => { if ( contextName === 'root' ) return `${name}._context.root = root;`; const listName = generator.current.listNames[ contextName ]; diff --git a/src/generators/dom/visitors/Element.js b/src/generators/dom/visitors/Element.js index 3338c088ef2b..275f98429e44 100644 --- a/src/generators/dom/visitors/Element.js +++ b/src/generators/dom/visitors/Element.js @@ -17,7 +17,7 @@ export default { namespace: node.name === 'svg' ? 'http://www.w3.org/2000/svg' : generator.current.namespace, isComponent: false, - allUsedContexts: new Set(), + allUsedContexts: [], init: new CodeBuilder(), update: new CodeBuilder() @@ -27,10 +27,8 @@ export default { addElementAttributes( generator, node, local ); - if ( local.allUsedContexts.size ) { - const contextNames = [...local.allUsedContexts]; - - const initialProps = contextNames.map( contextName => { + if ( local.allUsedContexts.length ) { + const initialProps = local.allUsedContexts.map( contextName => { if ( contextName === 'root' ) return `root: root`; const listName = generator.current.listNames[ contextName ]; @@ -39,7 +37,7 @@ export default { return `${listName}: ${listName},\n${indexName}: ${indexName}`; }).join( ',\n' ); - const updates = contextNames.map( contextName => { + const updates = local.allUsedContexts.map( contextName => { if ( contextName === 'root' ) return `${name}.__svelte.root = root;`; const listName = generator.current.listNames[ contextName ]; diff --git a/src/generators/dom/visitors/attributes/addComponentAttributes.js b/src/generators/dom/visitors/attributes/addComponentAttributes.js index 4b05faffac7d..888b3ca3d551 100644 --- a/src/generators/dom/visitors/attributes/addComponentAttributes.js +++ b/src/generators/dom/visitors/attributes/addComponentAttributes.js @@ -82,18 +82,18 @@ export default function addComponentAttributes ( generator, node, local ) { generator.addSourcemapLocations( attribute.expression ); generator.code.prependRight( attribute.expression.start, 'component.' ); - const usedContexts = new Set(); + const usedContexts = []; attribute.expression.arguments.forEach( arg => { const { contexts } = generator.contextualise( arg, true, true ); contexts.forEach( context => { - usedContexts.add( context ); - local.allUsedContexts.add( context ); + if ( !~usedContexts.indexOf( context ) ) usedContexts.push( context ); + if ( !~local.allUsedContexts.indexOf( context ) ) local.allUsedContexts.push( context ); }); }); // TODO hoist event handlers? can do `this.__component.method(...)` - const declarations = [...usedContexts].map( name => { + const declarations = usedContexts.map( name => { if ( name === 'root' ) return 'var root = this._context.root;'; const listName = generator.current.listNames[ name ]; diff --git a/src/generators/dom/visitors/attributes/addElementAttributes.js b/src/generators/dom/visitors/attributes/addElementAttributes.js index 60dcdc7d2379..6c85f6a73c2f 100644 --- a/src/generators/dom/visitors/attributes/addElementAttributes.js +++ b/src/generators/dom/visitors/attributes/addElementAttributes.js @@ -155,18 +155,18 @@ export default function addElementAttributes ( generator, node, local ) { generator.code.prependRight( attribute.expression.start, 'component.' ); } - const usedContexts = new Set(); + const usedContexts = []; attribute.expression.arguments.forEach( arg => { const { contexts } = generator.contextualise( arg, true ); contexts.forEach( context => { - usedContexts.add( context ); - local.allUsedContexts.add( context ); + if ( !~usedContexts.indexOf( context ) ) usedContexts.push( context ); + if ( !~local.allUsedContexts.indexOf( context ) ) local.allUsedContexts.push( context ); }); }); // TODO hoist event handlers? can do `this.__component.method(...)` - const declarations = [...usedContexts].map( name => { + const declarations = usedContexts.map( name => { if ( name === 'root' ) return 'var root = this.__svelte.root;'; const listName = generator.current.listNames[ name ]; diff --git a/src/generators/dom/visitors/attributes/binding/index.js b/src/generators/dom/visitors/attributes/binding/index.js index c435d36b1cb6..c2d579e254b4 100644 --- a/src/generators/dom/visitors/attributes/binding/index.js +++ b/src/generators/dom/visitors/attributes/binding/index.js @@ -8,7 +8,9 @@ export default function createBinding ( generator, node, attribute, current, loc const deep = parts.length > 1; const contextual = parts[0] in current.contexts; - if ( contextual ) local.allUsedContexts.add( parts[0] ); + if ( contextual && !~local.allUsedContexts.indexOf( parts[0] ) ) { + local.allUsedContexts.push( parts[0] ); + } if ( local.isComponent ) { let obj; @@ -174,11 +176,11 @@ export default function createBinding ( generator, node, attribute, current, loc node.initialUpdate = updateElement; - local.update.addLine( - `if ( !${local.name}_updating ) { + local.update.addLine( deindent` + if ( !${local.name}_updating ) { ${updateElement} - }` - ); + } + ` ); generator.current.builders.teardown.addLine( deindent` ${generator.helper( 'removeEventListener' )}( ${local.name}, '${eventName}', ${handler} ); diff --git a/src/parse/read/script.js b/src/parse/read/script.js index 09e1ba917497..641a3898045a 100644 --- a/src/parse/read/script.js +++ b/src/parse/read/script.js @@ -1,28 +1,14 @@ -import { parse, tokenizer } from 'acorn'; +import { parse } from 'acorn'; import spaces from '../../utils/spaces.js'; +const scriptClosingTag = '<\/script>'; + export default function readScript ( parser, start, attributes ) { const scriptStart = parser.index; - let scriptEnd = null; - - for ( const token of tokenizer( parser.remaining() ) ) { - parser.index = scriptStart + token.end; - parser.allowWhitespace(); - - scriptEnd = parser.index; - - if ( parser.eat( '/script>' ) ) { - // this happens with trailing comments! - scriptEnd -= 1; - break; - } - - if ( parser.eat( '<\/script>' ) ) { - break; - } - } + const scriptEnd = parser.template.indexOf( scriptClosingTag, scriptStart ); const source = spaces( scriptStart ) + parser.template.slice( scriptStart, scriptEnd ); + parser.index = scriptEnd + scriptClosingTag.length; let ast; @@ -38,7 +24,6 @@ export default function readScript ( parser, start, attributes ) { if ( !ast.body.length ) return null; ast.start = scriptStart; - return { start, end: parser.index, diff --git a/test/create.js b/test/create/index.js similarity index 89% rename from test/create.js rename to test/create/index.js index 153192de27d3..8e5ac8abf435 100644 --- a/test/create.js +++ b/test/create/index.js @@ -1,6 +1,6 @@ -import deindent from '../src/utils/deindent.js'; +import deindent from '../../src/utils/deindent.js'; import assert from 'assert'; -import { svelte } from './helpers.js'; +import { svelte } from '../helpers.js'; describe( 'create', () => { it( 'should return a component constructor', () => { diff --git a/test/formats.js b/test/formats/index.js similarity index 97% rename from test/formats.js rename to test/formats/index.js index 16ad77ce556e..b7fb5e444a01 100644 --- a/test/formats.js +++ b/test/formats/index.js @@ -1,6 +1,6 @@ -import deindent from '../src/utils/deindent.js'; +import deindent from '../../src/utils/deindent.js'; import assert from 'assert'; -import { svelte, env, setupHtmlEqual } from './helpers.js'; +import { svelte, env, setupHtmlEqual } from '../helpers.js'; function testAmd ( code, expectedId, dependencies, html ) { const fn = new Function( 'define', code ); diff --git a/test/generate.js b/test/generator/index.js similarity index 82% rename from test/generate.js rename to test/generator/index.js index 113c162dc95e..2f647bec1a72 100644 --- a/test/generate.js +++ b/test/generator/index.js @@ -1,10 +1,11 @@ -import spaces from '../src/utils/spaces.js'; +import spaces from '../../src/utils/spaces.js'; import assert from 'assert'; import * as path from 'path'; import * as fs from 'fs'; import * as acorn from 'acorn'; +import * as babel from 'babel-core'; -import { addLineNumbers, loadConfig, svelte, env, setupHtmlEqual } from './helpers.js'; +import { addLineNumbers, loadConfig, svelte, env, setupHtmlEqual } from '../helpers.js'; let showCompiledCode = false; let compileOptions = null; @@ -14,12 +15,18 @@ function getName ( filename ) { return base[0].toUpperCase() + base.slice( 1 ); } +const nodeVersionMatch = /^v(\d)/.exec( process.version ); +const legacy = +nodeVersionMatch[1] < 6; +const babelrc = require( '../../package.json' ).babel; + require.extensions[ '.html' ] = function ( module, filename ) { const options = Object.assign({ filename, name: getName( filename ) }, compileOptions ); - const { code } = svelte.compile( fs.readFileSync( filename, 'utf-8' ), options ); + let { code } = svelte.compile( fs.readFileSync( filename, 'utf-8' ), options ); if ( showCompiledCode ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console + if ( legacy ) code = babel.transform( code, babelrc ).code; + return module._compile( code, filename ); }; @@ -29,7 +36,7 @@ describe( 'generate', () => { function runTest ( dir, shared ) { if ( dir[0] === '.' ) return; - const config = loadConfig( `./generator/${dir}/_config.js` ); + const config = loadConfig( `./generator/samples/${dir}/_config.js` ); if ( config.solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); @@ -44,7 +51,7 @@ describe( 'generate', () => { compileOptions.dev = config.dev; try { - const source = fs.readFileSync( `test/generator/${dir}/main.html`, 'utf-8' ); + const source = fs.readFileSync( `test/generator/samples/${dir}/main.html`, 'utf-8' ); compiled = svelte.compile( source, compileOptions ); } catch ( err ) { if ( config.compileError ) { @@ -76,7 +83,7 @@ describe( 'generate', () => { let SvelteComponent; try { - SvelteComponent = require( `./generator/${dir}/main.html` ).default; + SvelteComponent = require( `./samples/${dir}/main.html` ).default; } catch ( err ) { if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console throw err; @@ -126,13 +133,13 @@ describe( 'generate', () => { } describe( 'inline helpers', () => { - fs.readdirSync( 'test/generator' ).forEach( dir => { + fs.readdirSync( 'test/generator/samples' ).forEach( dir => { runTest( dir, null ); }); }); describe( 'shared helpers', () => { - fs.readdirSync( 'test/generator' ).forEach( dir => { + fs.readdirSync( 'test/generator/samples' ).forEach( dir => { runTest( dir, path.resolve( 'shared.js' ) ); }); }); diff --git a/test/generator/attribute-dynamic-multiple/_config.js b/test/generator/samples/attribute-dynamic-multiple/_config.js similarity index 100% rename from test/generator/attribute-dynamic-multiple/_config.js rename to test/generator/samples/attribute-dynamic-multiple/_config.js diff --git a/test/generator/attribute-dynamic-multiple/main.html b/test/generator/samples/attribute-dynamic-multiple/main.html similarity index 100% rename from test/generator/attribute-dynamic-multiple/main.html rename to test/generator/samples/attribute-dynamic-multiple/main.html diff --git a/test/generator/attribute-dynamic/_config.js b/test/generator/samples/attribute-dynamic/_config.js similarity index 100% rename from test/generator/attribute-dynamic/_config.js rename to test/generator/samples/attribute-dynamic/_config.js diff --git a/test/generator/attribute-dynamic/main.html b/test/generator/samples/attribute-dynamic/main.html similarity index 100% rename from test/generator/attribute-dynamic/main.html rename to test/generator/samples/attribute-dynamic/main.html diff --git a/test/generator/attribute-empty-svg/_config.js b/test/generator/samples/attribute-empty-svg/_config.js similarity index 100% rename from test/generator/attribute-empty-svg/_config.js rename to test/generator/samples/attribute-empty-svg/_config.js diff --git a/test/generator/attribute-empty-svg/main.html b/test/generator/samples/attribute-empty-svg/main.html similarity index 100% rename from test/generator/attribute-empty-svg/main.html rename to test/generator/samples/attribute-empty-svg/main.html diff --git a/test/generator/attribute-empty/_config.js b/test/generator/samples/attribute-empty/_config.js similarity index 100% rename from test/generator/attribute-empty/_config.js rename to test/generator/samples/attribute-empty/_config.js diff --git a/test/generator/attribute-empty/main.html b/test/generator/samples/attribute-empty/main.html similarity index 100% rename from test/generator/attribute-empty/main.html rename to test/generator/samples/attribute-empty/main.html diff --git a/test/generator/attribute-partial-number/Component.html b/test/generator/samples/attribute-partial-number/Component.html similarity index 100% rename from test/generator/attribute-partial-number/Component.html rename to test/generator/samples/attribute-partial-number/Component.html diff --git a/test/generator/attribute-partial-number/_config.js b/test/generator/samples/attribute-partial-number/_config.js similarity index 100% rename from test/generator/attribute-partial-number/_config.js rename to test/generator/samples/attribute-partial-number/_config.js diff --git a/test/generator/attribute-partial-number/main.html b/test/generator/samples/attribute-partial-number/main.html similarity index 100% rename from test/generator/attribute-partial-number/main.html rename to test/generator/samples/attribute-partial-number/main.html diff --git a/test/generator/attribute-static-boolean/_config.js b/test/generator/samples/attribute-static-boolean/_config.js similarity index 100% rename from test/generator/attribute-static-boolean/_config.js rename to test/generator/samples/attribute-static-boolean/_config.js diff --git a/test/generator/attribute-static-boolean/main.html b/test/generator/samples/attribute-static-boolean/main.html similarity index 100% rename from test/generator/attribute-static-boolean/main.html rename to test/generator/samples/attribute-static-boolean/main.html diff --git a/test/generator/attribute-static/_config.js b/test/generator/samples/attribute-static/_config.js similarity index 100% rename from test/generator/attribute-static/_config.js rename to test/generator/samples/attribute-static/_config.js diff --git a/test/generator/attribute-static/main.html b/test/generator/samples/attribute-static/main.html similarity index 100% rename from test/generator/attribute-static/main.html rename to test/generator/samples/attribute-static/main.html diff --git a/test/generator/autofocus/_config.js b/test/generator/samples/autofocus/_config.js similarity index 100% rename from test/generator/autofocus/_config.js rename to test/generator/samples/autofocus/_config.js diff --git a/test/generator/autofocus/main.html b/test/generator/samples/autofocus/main.html similarity index 100% rename from test/generator/autofocus/main.html rename to test/generator/samples/autofocus/main.html diff --git a/test/generator/binding-input-checkbox-deep-contextual/_config.js b/test/generator/samples/binding-input-checkbox-deep-contextual/_config.js similarity index 100% rename from test/generator/binding-input-checkbox-deep-contextual/_config.js rename to test/generator/samples/binding-input-checkbox-deep-contextual/_config.js diff --git a/test/generator/binding-input-checkbox-deep-contextual/main.html b/test/generator/samples/binding-input-checkbox-deep-contextual/main.html similarity index 100% rename from test/generator/binding-input-checkbox-deep-contextual/main.html rename to test/generator/samples/binding-input-checkbox-deep-contextual/main.html diff --git a/test/generator/binding-input-checkbox/_config.js b/test/generator/samples/binding-input-checkbox/_config.js similarity index 100% rename from test/generator/binding-input-checkbox/_config.js rename to test/generator/samples/binding-input-checkbox/_config.js diff --git a/test/generator/binding-input-checkbox/main.html b/test/generator/samples/binding-input-checkbox/main.html similarity index 100% rename from test/generator/binding-input-checkbox/main.html rename to test/generator/samples/binding-input-checkbox/main.html diff --git a/test/generator/binding-input-text-contextual/_config.js b/test/generator/samples/binding-input-text-contextual/_config.js similarity index 100% rename from test/generator/binding-input-text-contextual/_config.js rename to test/generator/samples/binding-input-text-contextual/_config.js diff --git a/test/generator/binding-input-text-contextual/main.html b/test/generator/samples/binding-input-text-contextual/main.html similarity index 100% rename from test/generator/binding-input-text-contextual/main.html rename to test/generator/samples/binding-input-text-contextual/main.html diff --git a/test/generator/binding-input-text-deep-contextual/_config.js b/test/generator/samples/binding-input-text-deep-contextual/_config.js similarity index 100% rename from test/generator/binding-input-text-deep-contextual/_config.js rename to test/generator/samples/binding-input-text-deep-contextual/_config.js diff --git a/test/generator/binding-input-text-deep-contextual/main.html b/test/generator/samples/binding-input-text-deep-contextual/main.html similarity index 100% rename from test/generator/binding-input-text-deep-contextual/main.html rename to test/generator/samples/binding-input-text-deep-contextual/main.html diff --git a/test/generator/binding-input-text-deep/_config.js b/test/generator/samples/binding-input-text-deep/_config.js similarity index 100% rename from test/generator/binding-input-text-deep/_config.js rename to test/generator/samples/binding-input-text-deep/_config.js diff --git a/test/generator/binding-input-text-deep/main.html b/test/generator/samples/binding-input-text-deep/main.html similarity index 100% rename from test/generator/binding-input-text-deep/main.html rename to test/generator/samples/binding-input-text-deep/main.html diff --git a/test/generator/binding-input-text/_config.js b/test/generator/samples/binding-input-text/_config.js similarity index 100% rename from test/generator/binding-input-text/_config.js rename to test/generator/samples/binding-input-text/_config.js diff --git a/test/generator/binding-input-text/main.html b/test/generator/samples/binding-input-text/main.html similarity index 100% rename from test/generator/binding-input-text/main.html rename to test/generator/samples/binding-input-text/main.html diff --git a/test/generator/binding-select-initial-value/_config.js b/test/generator/samples/binding-select-initial-value/_config.js similarity index 100% rename from test/generator/binding-select-initial-value/_config.js rename to test/generator/samples/binding-select-initial-value/_config.js diff --git a/test/generator/binding-select-initial-value/main.html b/test/generator/samples/binding-select-initial-value/main.html similarity index 100% rename from test/generator/binding-select-initial-value/main.html rename to test/generator/samples/binding-select-initial-value/main.html diff --git a/test/generator/binding-select-multiple/_config.js b/test/generator/samples/binding-select-multiple/_config.js similarity index 100% rename from test/generator/binding-select-multiple/_config.js rename to test/generator/samples/binding-select-multiple/_config.js diff --git a/test/generator/binding-select-multiple/main.html b/test/generator/samples/binding-select-multiple/main.html similarity index 100% rename from test/generator/binding-select-multiple/main.html rename to test/generator/samples/binding-select-multiple/main.html diff --git a/test/generator/binding-select/_config.js b/test/generator/samples/binding-select/_config.js similarity index 100% rename from test/generator/binding-select/_config.js rename to test/generator/samples/binding-select/_config.js diff --git a/test/generator/binding-select/main.html b/test/generator/samples/binding-select/main.html similarity index 100% rename from test/generator/binding-select/main.html rename to test/generator/samples/binding-select/main.html diff --git a/test/generator/binding-textarea/_config.js b/test/generator/samples/binding-textarea/_config.js similarity index 100% rename from test/generator/binding-textarea/_config.js rename to test/generator/samples/binding-textarea/_config.js diff --git a/test/generator/binding-textarea/main.html b/test/generator/samples/binding-textarea/main.html similarity index 100% rename from test/generator/binding-textarea/main.html rename to test/generator/samples/binding-textarea/main.html diff --git a/test/generator/component-binding-conditional-b/Bar.html b/test/generator/samples/component-binding-conditional-b/Bar.html similarity index 100% rename from test/generator/component-binding-conditional-b/Bar.html rename to test/generator/samples/component-binding-conditional-b/Bar.html diff --git a/test/generator/component-binding-conditional-b/Baz.html b/test/generator/samples/component-binding-conditional-b/Baz.html similarity index 100% rename from test/generator/component-binding-conditional-b/Baz.html rename to test/generator/samples/component-binding-conditional-b/Baz.html diff --git a/test/generator/component-binding-conditional-b/Foo.html b/test/generator/samples/component-binding-conditional-b/Foo.html similarity index 100% rename from test/generator/component-binding-conditional-b/Foo.html rename to test/generator/samples/component-binding-conditional-b/Foo.html diff --git a/test/generator/component-binding-conditional-b/_config.js b/test/generator/samples/component-binding-conditional-b/_config.js similarity index 100% rename from test/generator/component-binding-conditional-b/_config.js rename to test/generator/samples/component-binding-conditional-b/_config.js diff --git a/test/generator/component-binding-conditional-b/main.html b/test/generator/samples/component-binding-conditional-b/main.html similarity index 100% rename from test/generator/component-binding-conditional-b/main.html rename to test/generator/samples/component-binding-conditional-b/main.html diff --git a/test/generator/component-binding-conditional/Bar.html b/test/generator/samples/component-binding-conditional/Bar.html similarity index 100% rename from test/generator/component-binding-conditional/Bar.html rename to test/generator/samples/component-binding-conditional/Bar.html diff --git a/test/generator/component-binding-conditional/Baz.html b/test/generator/samples/component-binding-conditional/Baz.html similarity index 100% rename from test/generator/component-binding-conditional/Baz.html rename to test/generator/samples/component-binding-conditional/Baz.html diff --git a/test/generator/component-binding-conditional/Foo.html b/test/generator/samples/component-binding-conditional/Foo.html similarity index 100% rename from test/generator/component-binding-conditional/Foo.html rename to test/generator/samples/component-binding-conditional/Foo.html diff --git a/test/generator/component-binding-conditional/_config.js b/test/generator/samples/component-binding-conditional/_config.js similarity index 100% rename from test/generator/component-binding-conditional/_config.js rename to test/generator/samples/component-binding-conditional/_config.js diff --git a/test/generator/component-binding-conditional/main.html b/test/generator/samples/component-binding-conditional/main.html similarity index 100% rename from test/generator/component-binding-conditional/main.html rename to test/generator/samples/component-binding-conditional/main.html diff --git a/test/generator/component-binding-each-nested/Widget.html b/test/generator/samples/component-binding-each-nested/Widget.html similarity index 100% rename from test/generator/component-binding-each-nested/Widget.html rename to test/generator/samples/component-binding-each-nested/Widget.html diff --git a/test/generator/component-binding-each-nested/_config.js b/test/generator/samples/component-binding-each-nested/_config.js similarity index 100% rename from test/generator/component-binding-each-nested/_config.js rename to test/generator/samples/component-binding-each-nested/_config.js diff --git a/test/generator/component-binding-each-nested/main.html b/test/generator/samples/component-binding-each-nested/main.html similarity index 100% rename from test/generator/component-binding-each-nested/main.html rename to test/generator/samples/component-binding-each-nested/main.html diff --git a/test/generator/component-binding-each/Widget.html b/test/generator/samples/component-binding-each/Widget.html similarity index 100% rename from test/generator/component-binding-each/Widget.html rename to test/generator/samples/component-binding-each/Widget.html diff --git a/test/generator/component-binding-each/_config.js b/test/generator/samples/component-binding-each/_config.js similarity index 100% rename from test/generator/component-binding-each/_config.js rename to test/generator/samples/component-binding-each/_config.js diff --git a/test/generator/component-binding-each/main.html b/test/generator/samples/component-binding-each/main.html similarity index 100% rename from test/generator/component-binding-each/main.html rename to test/generator/samples/component-binding-each/main.html diff --git a/test/generator/component-binding-nested/Bar.html b/test/generator/samples/component-binding-nested/Bar.html similarity index 100% rename from test/generator/component-binding-nested/Bar.html rename to test/generator/samples/component-binding-nested/Bar.html diff --git a/test/generator/component-binding-nested/Baz.html b/test/generator/samples/component-binding-nested/Baz.html similarity index 100% rename from test/generator/component-binding-nested/Baz.html rename to test/generator/samples/component-binding-nested/Baz.html diff --git a/test/generator/component-binding-nested/Foo.html b/test/generator/samples/component-binding-nested/Foo.html similarity index 100% rename from test/generator/component-binding-nested/Foo.html rename to test/generator/samples/component-binding-nested/Foo.html diff --git a/test/generator/component-binding-nested/_config.js b/test/generator/samples/component-binding-nested/_config.js similarity index 100% rename from test/generator/component-binding-nested/_config.js rename to test/generator/samples/component-binding-nested/_config.js diff --git a/test/generator/component-binding-nested/main.html b/test/generator/samples/component-binding-nested/main.html similarity index 100% rename from test/generator/component-binding-nested/main.html rename to test/generator/samples/component-binding-nested/main.html diff --git a/test/generator/component-binding-parent-supercedes-child/Counter.html b/test/generator/samples/component-binding-parent-supercedes-child/Counter.html similarity index 100% rename from test/generator/component-binding-parent-supercedes-child/Counter.html rename to test/generator/samples/component-binding-parent-supercedes-child/Counter.html diff --git a/test/generator/component-binding-parent-supercedes-child/_config.js b/test/generator/samples/component-binding-parent-supercedes-child/_config.js similarity index 100% rename from test/generator/component-binding-parent-supercedes-child/_config.js rename to test/generator/samples/component-binding-parent-supercedes-child/_config.js diff --git a/test/generator/component-binding-parent-supercedes-child/main.html b/test/generator/samples/component-binding-parent-supercedes-child/main.html similarity index 100% rename from test/generator/component-binding-parent-supercedes-child/main.html rename to test/generator/samples/component-binding-parent-supercedes-child/main.html diff --git a/test/generator/component-binding/Counter.html b/test/generator/samples/component-binding/Counter.html similarity index 100% rename from test/generator/component-binding/Counter.html rename to test/generator/samples/component-binding/Counter.html diff --git a/test/generator/component-binding/_config.js b/test/generator/samples/component-binding/_config.js similarity index 100% rename from test/generator/component-binding/_config.js rename to test/generator/samples/component-binding/_config.js diff --git a/test/generator/component-binding/main.html b/test/generator/samples/component-binding/main.html similarity index 100% rename from test/generator/component-binding/main.html rename to test/generator/samples/component-binding/main.html diff --git a/test/generator/component-data-dynamic-late/Widget.html b/test/generator/samples/component-data-dynamic-late/Widget.html similarity index 100% rename from test/generator/component-data-dynamic-late/Widget.html rename to test/generator/samples/component-data-dynamic-late/Widget.html diff --git a/test/generator/component-data-dynamic-late/_config.js b/test/generator/samples/component-data-dynamic-late/_config.js similarity index 100% rename from test/generator/component-data-dynamic-late/_config.js rename to test/generator/samples/component-data-dynamic-late/_config.js diff --git a/test/generator/component-data-dynamic-late/main.html b/test/generator/samples/component-data-dynamic-late/main.html similarity index 100% rename from test/generator/component-data-dynamic-late/main.html rename to test/generator/samples/component-data-dynamic-late/main.html diff --git a/test/generator/component-data-dynamic/Widget.html b/test/generator/samples/component-data-dynamic/Widget.html similarity index 100% rename from test/generator/component-data-dynamic/Widget.html rename to test/generator/samples/component-data-dynamic/Widget.html diff --git a/test/generator/component-data-dynamic/_config.js b/test/generator/samples/component-data-dynamic/_config.js similarity index 100% rename from test/generator/component-data-dynamic/_config.js rename to test/generator/samples/component-data-dynamic/_config.js diff --git a/test/generator/component-data-dynamic/main.html b/test/generator/samples/component-data-dynamic/main.html similarity index 100% rename from test/generator/component-data-dynamic/main.html rename to test/generator/samples/component-data-dynamic/main.html diff --git a/test/generator/component-data-empty/Widget.html b/test/generator/samples/component-data-empty/Widget.html similarity index 100% rename from test/generator/component-data-empty/Widget.html rename to test/generator/samples/component-data-empty/Widget.html diff --git a/test/generator/component-data-empty/_config.js b/test/generator/samples/component-data-empty/_config.js similarity index 100% rename from test/generator/component-data-empty/_config.js rename to test/generator/samples/component-data-empty/_config.js diff --git a/test/generator/component-data-empty/main.html b/test/generator/samples/component-data-empty/main.html similarity index 100% rename from test/generator/component-data-empty/main.html rename to test/generator/samples/component-data-empty/main.html diff --git a/test/generator/component-data-static-boolean/Foo.html b/test/generator/samples/component-data-static-boolean/Foo.html similarity index 100% rename from test/generator/component-data-static-boolean/Foo.html rename to test/generator/samples/component-data-static-boolean/Foo.html diff --git a/test/generator/component-data-static-boolean/_config.js b/test/generator/samples/component-data-static-boolean/_config.js similarity index 100% rename from test/generator/component-data-static-boolean/_config.js rename to test/generator/samples/component-data-static-boolean/_config.js diff --git a/test/generator/component-data-static-boolean/main.html b/test/generator/samples/component-data-static-boolean/main.html similarity index 100% rename from test/generator/component-data-static-boolean/main.html rename to test/generator/samples/component-data-static-boolean/main.html diff --git a/test/generator/component-data-static/Widget.html b/test/generator/samples/component-data-static/Widget.html similarity index 100% rename from test/generator/component-data-static/Widget.html rename to test/generator/samples/component-data-static/Widget.html diff --git a/test/generator/component-data-static/_config.js b/test/generator/samples/component-data-static/_config.js similarity index 100% rename from test/generator/component-data-static/_config.js rename to test/generator/samples/component-data-static/_config.js diff --git a/test/generator/component-data-static/main.html b/test/generator/samples/component-data-static/main.html similarity index 100% rename from test/generator/component-data-static/main.html rename to test/generator/samples/component-data-static/main.html diff --git a/test/generator/component-events-data/Widget.html b/test/generator/samples/component-events-data/Widget.html similarity index 100% rename from test/generator/component-events-data/Widget.html rename to test/generator/samples/component-events-data/Widget.html diff --git a/test/generator/component-events-data/_config.js b/test/generator/samples/component-events-data/_config.js similarity index 100% rename from test/generator/component-events-data/_config.js rename to test/generator/samples/component-events-data/_config.js diff --git a/test/generator/component-events-data/main.html b/test/generator/samples/component-events-data/main.html similarity index 100% rename from test/generator/component-events-data/main.html rename to test/generator/samples/component-events-data/main.html diff --git a/test/generator/component-events-each/Widget.html b/test/generator/samples/component-events-each/Widget.html similarity index 100% rename from test/generator/component-events-each/Widget.html rename to test/generator/samples/component-events-each/Widget.html diff --git a/test/generator/component-events-each/_config.js b/test/generator/samples/component-events-each/_config.js similarity index 100% rename from test/generator/component-events-each/_config.js rename to test/generator/samples/component-events-each/_config.js diff --git a/test/generator/component-events-each/main.html b/test/generator/samples/component-events-each/main.html similarity index 100% rename from test/generator/component-events-each/main.html rename to test/generator/samples/component-events-each/main.html diff --git a/test/generator/component-events/Widget.html b/test/generator/samples/component-events/Widget.html similarity index 100% rename from test/generator/component-events/Widget.html rename to test/generator/samples/component-events/Widget.html diff --git a/test/generator/component-events/_config.js b/test/generator/samples/component-events/_config.js similarity index 100% rename from test/generator/component-events/_config.js rename to test/generator/samples/component-events/_config.js diff --git a/test/generator/component-events/main.html b/test/generator/samples/component-events/main.html similarity index 100% rename from test/generator/component-events/main.html rename to test/generator/samples/component-events/main.html diff --git a/test/generator/component-not-void/Link.html b/test/generator/samples/component-not-void/Link.html similarity index 100% rename from test/generator/component-not-void/Link.html rename to test/generator/samples/component-not-void/Link.html diff --git a/test/generator/component-not-void/_config.js b/test/generator/samples/component-not-void/_config.js similarity index 100% rename from test/generator/component-not-void/_config.js rename to test/generator/samples/component-not-void/_config.js diff --git a/test/generator/component-not-void/main.html b/test/generator/samples/component-not-void/main.html similarity index 100% rename from test/generator/component-not-void/main.html rename to test/generator/samples/component-not-void/main.html diff --git a/test/generator/component-ref/Widget.html b/test/generator/samples/component-ref/Widget.html similarity index 100% rename from test/generator/component-ref/Widget.html rename to test/generator/samples/component-ref/Widget.html diff --git a/test/generator/component-ref/_config.js b/test/generator/samples/component-ref/_config.js similarity index 100% rename from test/generator/component-ref/_config.js rename to test/generator/samples/component-ref/_config.js diff --git a/test/generator/component-ref/main.html b/test/generator/samples/component-ref/main.html similarity index 100% rename from test/generator/component-ref/main.html rename to test/generator/samples/component-ref/main.html diff --git a/test/generator/component-yield-if/Widget.html b/test/generator/samples/component-yield-if/Widget.html similarity index 100% rename from test/generator/component-yield-if/Widget.html rename to test/generator/samples/component-yield-if/Widget.html diff --git a/test/generator/component-yield-if/_config.js b/test/generator/samples/component-yield-if/_config.js similarity index 100% rename from test/generator/component-yield-if/_config.js rename to test/generator/samples/component-yield-if/_config.js diff --git a/test/generator/component-yield-if/main.html b/test/generator/samples/component-yield-if/main.html similarity index 100% rename from test/generator/component-yield-if/main.html rename to test/generator/samples/component-yield-if/main.html diff --git a/test/generator/component-yield-multiple-in-each/Widget.html b/test/generator/samples/component-yield-multiple-in-each/Widget.html similarity index 100% rename from test/generator/component-yield-multiple-in-each/Widget.html rename to test/generator/samples/component-yield-multiple-in-each/Widget.html diff --git a/test/generator/component-yield-multiple-in-each/_config.js b/test/generator/samples/component-yield-multiple-in-each/_config.js similarity index 100% rename from test/generator/component-yield-multiple-in-each/_config.js rename to test/generator/samples/component-yield-multiple-in-each/_config.js diff --git a/test/generator/component-yield-multiple-in-each/main.html b/test/generator/samples/component-yield-multiple-in-each/main.html similarity index 100% rename from test/generator/component-yield-multiple-in-each/main.html rename to test/generator/samples/component-yield-multiple-in-each/main.html diff --git a/test/generator/component-yield-multiple-in-if/Widget.html b/test/generator/samples/component-yield-multiple-in-if/Widget.html similarity index 100% rename from test/generator/component-yield-multiple-in-if/Widget.html rename to test/generator/samples/component-yield-multiple-in-if/Widget.html diff --git a/test/generator/component-yield-multiple-in-if/_config.js b/test/generator/samples/component-yield-multiple-in-if/_config.js similarity index 100% rename from test/generator/component-yield-multiple-in-if/_config.js rename to test/generator/samples/component-yield-multiple-in-if/_config.js diff --git a/test/generator/component-yield-multiple-in-if/main.html b/test/generator/samples/component-yield-multiple-in-if/main.html similarity index 100% rename from test/generator/component-yield-multiple-in-if/main.html rename to test/generator/samples/component-yield-multiple-in-if/main.html diff --git a/test/generator/component-yield-parent/Widget.html b/test/generator/samples/component-yield-parent/Widget.html similarity index 100% rename from test/generator/component-yield-parent/Widget.html rename to test/generator/samples/component-yield-parent/Widget.html diff --git a/test/generator/component-yield-parent/_config.js b/test/generator/samples/component-yield-parent/_config.js similarity index 100% rename from test/generator/component-yield-parent/_config.js rename to test/generator/samples/component-yield-parent/_config.js diff --git a/test/generator/component-yield-parent/main.html b/test/generator/samples/component-yield-parent/main.html similarity index 100% rename from test/generator/component-yield-parent/main.html rename to test/generator/samples/component-yield-parent/main.html diff --git a/test/generator/component-yield/_config.js b/test/generator/samples/component-yield/_config.js similarity index 100% rename from test/generator/component-yield/_config.js rename to test/generator/samples/component-yield/_config.js diff --git a/test/generator/component-yield/main.html b/test/generator/samples/component-yield/main.html similarity index 100% rename from test/generator/component-yield/main.html rename to test/generator/samples/component-yield/main.html diff --git a/test/generator/component/Widget.html b/test/generator/samples/component/Widget.html similarity index 100% rename from test/generator/component/Widget.html rename to test/generator/samples/component/Widget.html diff --git a/test/generator/component/_config.js b/test/generator/samples/component/_config.js similarity index 100% rename from test/generator/component/_config.js rename to test/generator/samples/component/_config.js diff --git a/test/generator/component/main.html b/test/generator/samples/component/main.html similarity index 100% rename from test/generator/component/main.html rename to test/generator/samples/component/main.html diff --git a/test/generator/computed-function/_config.js b/test/generator/samples/computed-function/_config.js similarity index 100% rename from test/generator/computed-function/_config.js rename to test/generator/samples/computed-function/_config.js diff --git a/test/generator/computed-function/main.html b/test/generator/samples/computed-function/main.html similarity index 100% rename from test/generator/computed-function/main.html rename to test/generator/samples/computed-function/main.html diff --git a/test/generator/computed-values-default/_config.js b/test/generator/samples/computed-values-default/_config.js similarity index 60% rename from test/generator/computed-values-default/_config.js rename to test/generator/samples/computed-values-default/_config.js index 63db59a8a384..55d9bc8f94af 100644 --- a/test/generator/computed-values-default/_config.js +++ b/test/generator/samples/computed-values-default/_config.js @@ -1,6 +1,8 @@ export default { html: '

2

', + 'skip-ssr': /^v4/.test( process.version ), // we're not transpiling server-side tests in Node 4, because it's tricky + test ( assert, component, target ) { component.set({ a: 2 }); assert.equal( target.innerHTML, '

4

' ); diff --git a/test/generator/computed-values-default/main.html b/test/generator/samples/computed-values-default/main.html similarity index 100% rename from test/generator/computed-values-default/main.html rename to test/generator/samples/computed-values-default/main.html diff --git a/test/generator/computed-values/_config.js b/test/generator/samples/computed-values/_config.js similarity index 100% rename from test/generator/computed-values/_config.js rename to test/generator/samples/computed-values/_config.js diff --git a/test/generator/computed-values/main.html b/test/generator/samples/computed-values/main.html similarity index 100% rename from test/generator/computed-values/main.html rename to test/generator/samples/computed-values/main.html diff --git a/test/generator/css-comments/_config.js b/test/generator/samples/css-comments/_config.js similarity index 100% rename from test/generator/css-comments/_config.js rename to test/generator/samples/css-comments/_config.js diff --git a/test/generator/css-comments/main.html b/test/generator/samples/css-comments/main.html similarity index 100% rename from test/generator/css-comments/main.html rename to test/generator/samples/css-comments/main.html diff --git a/test/generator/css-false/Widget.html b/test/generator/samples/css-false/Widget.html similarity index 100% rename from test/generator/css-false/Widget.html rename to test/generator/samples/css-false/Widget.html diff --git a/test/generator/css-false/_config.js b/test/generator/samples/css-false/_config.js similarity index 100% rename from test/generator/css-false/_config.js rename to test/generator/samples/css-false/_config.js diff --git a/test/generator/css-false/main.html b/test/generator/samples/css-false/main.html similarity index 100% rename from test/generator/css-false/main.html rename to test/generator/samples/css-false/main.html diff --git a/test/generator/css-space-in-attribute/Widget.html b/test/generator/samples/css-space-in-attribute/Widget.html similarity index 100% rename from test/generator/css-space-in-attribute/Widget.html rename to test/generator/samples/css-space-in-attribute/Widget.html diff --git a/test/generator/css-space-in-attribute/_config.js b/test/generator/samples/css-space-in-attribute/_config.js similarity index 100% rename from test/generator/css-space-in-attribute/_config.js rename to test/generator/samples/css-space-in-attribute/_config.js diff --git a/test/generator/css-space-in-attribute/main.html b/test/generator/samples/css-space-in-attribute/main.html similarity index 100% rename from test/generator/css-space-in-attribute/main.html rename to test/generator/samples/css-space-in-attribute/main.html diff --git a/test/generator/css/Widget.html b/test/generator/samples/css/Widget.html similarity index 100% rename from test/generator/css/Widget.html rename to test/generator/samples/css/Widget.html diff --git a/test/generator/css/_config.js b/test/generator/samples/css/_config.js similarity index 100% rename from test/generator/css/_config.js rename to test/generator/samples/css/_config.js diff --git a/test/generator/css/main.html b/test/generator/samples/css/main.html similarity index 100% rename from test/generator/css/main.html rename to test/generator/samples/css/main.html diff --git a/test/generator/custom-method/_config.js b/test/generator/samples/custom-method/_config.js similarity index 100% rename from test/generator/custom-method/_config.js rename to test/generator/samples/custom-method/_config.js diff --git a/test/generator/custom-method/main.html b/test/generator/samples/custom-method/main.html similarity index 100% rename from test/generator/custom-method/main.html rename to test/generator/samples/custom-method/main.html diff --git a/test/generator/deconflict-builtins/_config.js b/test/generator/samples/deconflict-builtins/_config.js similarity index 100% rename from test/generator/deconflict-builtins/_config.js rename to test/generator/samples/deconflict-builtins/_config.js diff --git a/test/generator/deconflict-builtins/get.js b/test/generator/samples/deconflict-builtins/get.js similarity index 100% rename from test/generator/deconflict-builtins/get.js rename to test/generator/samples/deconflict-builtins/get.js diff --git a/test/generator/deconflict-builtins/main.html b/test/generator/samples/deconflict-builtins/main.html similarity index 100% rename from test/generator/deconflict-builtins/main.html rename to test/generator/samples/deconflict-builtins/main.html diff --git a/test/generator/deconflict-contexts/_config.js b/test/generator/samples/deconflict-contexts/_config.js similarity index 100% rename from test/generator/deconflict-contexts/_config.js rename to test/generator/samples/deconflict-contexts/_config.js diff --git a/test/generator/deconflict-contexts/main.html b/test/generator/samples/deconflict-contexts/main.html similarity index 100% rename from test/generator/deconflict-contexts/main.html rename to test/generator/samples/deconflict-contexts/main.html diff --git a/test/generator/default-data-function/_config.js b/test/generator/samples/default-data-function/_config.js similarity index 100% rename from test/generator/default-data-function/_config.js rename to test/generator/samples/default-data-function/_config.js diff --git a/test/generator/default-data-function/main.html b/test/generator/samples/default-data-function/main.html similarity index 100% rename from test/generator/default-data-function/main.html rename to test/generator/samples/default-data-function/main.html diff --git a/test/generator/default-data-override/_config.js b/test/generator/samples/default-data-override/_config.js similarity index 100% rename from test/generator/default-data-override/_config.js rename to test/generator/samples/default-data-override/_config.js diff --git a/test/generator/default-data-override/main.html b/test/generator/samples/default-data-override/main.html similarity index 100% rename from test/generator/default-data-override/main.html rename to test/generator/samples/default-data-override/main.html diff --git a/test/generator/default-data/_config.js b/test/generator/samples/default-data/_config.js similarity index 100% rename from test/generator/default-data/_config.js rename to test/generator/samples/default-data/_config.js diff --git a/test/generator/default-data/main.html b/test/generator/samples/default-data/main.html similarity index 100% rename from test/generator/default-data/main.html rename to test/generator/samples/default-data/main.html diff --git a/test/generator/destructuring/_config.js b/test/generator/samples/destructuring/_config.js similarity index 100% rename from test/generator/destructuring/_config.js rename to test/generator/samples/destructuring/_config.js diff --git a/test/generator/destructuring/main.html b/test/generator/samples/destructuring/main.html similarity index 100% rename from test/generator/destructuring/main.html rename to test/generator/samples/destructuring/main.html diff --git a/test/generator/dev-warning-missing-data-binding/_config.js b/test/generator/samples/dev-warning-missing-data-binding/_config.js similarity index 100% rename from test/generator/dev-warning-missing-data-binding/_config.js rename to test/generator/samples/dev-warning-missing-data-binding/_config.js diff --git a/test/generator/dev-warning-missing-data-binding/main.html b/test/generator/samples/dev-warning-missing-data-binding/main.html similarity index 100% rename from test/generator/dev-warning-missing-data-binding/main.html rename to test/generator/samples/dev-warning-missing-data-binding/main.html diff --git a/test/generator/dev-warning-missing-data/_config.js b/test/generator/samples/dev-warning-missing-data/_config.js similarity index 100% rename from test/generator/dev-warning-missing-data/_config.js rename to test/generator/samples/dev-warning-missing-data/_config.js diff --git a/test/generator/dev-warning-missing-data/main.html b/test/generator/samples/dev-warning-missing-data/main.html similarity index 100% rename from test/generator/dev-warning-missing-data/main.html rename to test/generator/samples/dev-warning-missing-data/main.html diff --git a/test/generator/each-block-containing-if/_config.js b/test/generator/samples/each-block-containing-if/_config.js similarity index 100% rename from test/generator/each-block-containing-if/_config.js rename to test/generator/samples/each-block-containing-if/_config.js diff --git a/test/generator/each-block-containing-if/main.html b/test/generator/samples/each-block-containing-if/main.html similarity index 100% rename from test/generator/each-block-containing-if/main.html rename to test/generator/samples/each-block-containing-if/main.html diff --git a/test/generator/each-block-else/_config.js b/test/generator/samples/each-block-else/_config.js similarity index 100% rename from test/generator/each-block-else/_config.js rename to test/generator/samples/each-block-else/_config.js diff --git a/test/generator/each-block-else/main.html b/test/generator/samples/each-block-else/main.html similarity index 100% rename from test/generator/each-block-else/main.html rename to test/generator/samples/each-block-else/main.html diff --git a/test/generator/each-block-indexed/_config.js b/test/generator/samples/each-block-indexed/_config.js similarity index 100% rename from test/generator/each-block-indexed/_config.js rename to test/generator/samples/each-block-indexed/_config.js diff --git a/test/generator/each-block-indexed/main.html b/test/generator/samples/each-block-indexed/main.html similarity index 100% rename from test/generator/each-block-indexed/main.html rename to test/generator/samples/each-block-indexed/main.html diff --git a/test/generator/each-block-keyed/_config.js b/test/generator/samples/each-block-keyed/_config.js similarity index 100% rename from test/generator/each-block-keyed/_config.js rename to test/generator/samples/each-block-keyed/_config.js diff --git a/test/generator/each-block-keyed/main.html b/test/generator/samples/each-block-keyed/main.html similarity index 100% rename from test/generator/each-block-keyed/main.html rename to test/generator/samples/each-block-keyed/main.html diff --git a/test/generator/each-block-random-permute/_config.js b/test/generator/samples/each-block-random-permute/_config.js similarity index 100% rename from test/generator/each-block-random-permute/_config.js rename to test/generator/samples/each-block-random-permute/_config.js diff --git a/test/generator/each-block-random-permute/main.html b/test/generator/samples/each-block-random-permute/main.html similarity index 100% rename from test/generator/each-block-random-permute/main.html rename to test/generator/samples/each-block-random-permute/main.html diff --git a/test/generator/each-block-text-node/_config.js b/test/generator/samples/each-block-text-node/_config.js similarity index 100% rename from test/generator/each-block-text-node/_config.js rename to test/generator/samples/each-block-text-node/_config.js diff --git a/test/generator/each-block-text-node/main.html b/test/generator/samples/each-block-text-node/main.html similarity index 100% rename from test/generator/each-block-text-node/main.html rename to test/generator/samples/each-block-text-node/main.html diff --git a/test/generator/each-block/_config.js b/test/generator/samples/each-block/_config.js similarity index 100% rename from test/generator/each-block/_config.js rename to test/generator/samples/each-block/_config.js diff --git a/test/generator/each-block/main.html b/test/generator/samples/each-block/main.html similarity index 100% rename from test/generator/each-block/main.html rename to test/generator/samples/each-block/main.html diff --git a/test/generator/each-blocks-expression/_config.js b/test/generator/samples/each-blocks-expression/_config.js similarity index 100% rename from test/generator/each-blocks-expression/_config.js rename to test/generator/samples/each-blocks-expression/_config.js diff --git a/test/generator/each-blocks-expression/main.html b/test/generator/samples/each-blocks-expression/main.html similarity index 100% rename from test/generator/each-blocks-expression/main.html rename to test/generator/samples/each-blocks-expression/main.html diff --git a/test/generator/each-blocks-nested-b/_config.js b/test/generator/samples/each-blocks-nested-b/_config.js similarity index 100% rename from test/generator/each-blocks-nested-b/_config.js rename to test/generator/samples/each-blocks-nested-b/_config.js diff --git a/test/generator/each-blocks-nested-b/main.html b/test/generator/samples/each-blocks-nested-b/main.html similarity index 100% rename from test/generator/each-blocks-nested-b/main.html rename to test/generator/samples/each-blocks-nested-b/main.html diff --git a/test/generator/each-blocks-nested/_config.js b/test/generator/samples/each-blocks-nested/_config.js similarity index 100% rename from test/generator/each-blocks-nested/_config.js rename to test/generator/samples/each-blocks-nested/_config.js diff --git a/test/generator/each-blocks-nested/main.html b/test/generator/samples/each-blocks-nested/main.html similarity index 100% rename from test/generator/each-blocks-nested/main.html rename to test/generator/samples/each-blocks-nested/main.html diff --git a/test/generator/event-handler-custom-context/_config.js b/test/generator/samples/event-handler-custom-context/_config.js similarity index 100% rename from test/generator/event-handler-custom-context/_config.js rename to test/generator/samples/event-handler-custom-context/_config.js diff --git a/test/generator/event-handler-custom-context/main.html b/test/generator/samples/event-handler-custom-context/main.html similarity index 100% rename from test/generator/event-handler-custom-context/main.html rename to test/generator/samples/event-handler-custom-context/main.html diff --git a/test/generator/event-handler-custom/_config.js b/test/generator/samples/event-handler-custom/_config.js similarity index 100% rename from test/generator/event-handler-custom/_config.js rename to test/generator/samples/event-handler-custom/_config.js diff --git a/test/generator/event-handler-custom/main.html b/test/generator/samples/event-handler-custom/main.html similarity index 100% rename from test/generator/event-handler-custom/main.html rename to test/generator/samples/event-handler-custom/main.html diff --git a/test/generator/event-handler-event-methods/_config.js b/test/generator/samples/event-handler-event-methods/_config.js similarity index 100% rename from test/generator/event-handler-event-methods/_config.js rename to test/generator/samples/event-handler-event-methods/_config.js diff --git a/test/generator/event-handler-event-methods/main.html b/test/generator/samples/event-handler-event-methods/main.html similarity index 100% rename from test/generator/event-handler-event-methods/main.html rename to test/generator/samples/event-handler-event-methods/main.html diff --git a/test/generator/event-handler-removal/_config.js b/test/generator/samples/event-handler-removal/_config.js similarity index 100% rename from test/generator/event-handler-removal/_config.js rename to test/generator/samples/event-handler-removal/_config.js diff --git a/test/generator/event-handler-removal/main.html b/test/generator/samples/event-handler-removal/main.html similarity index 100% rename from test/generator/event-handler-removal/main.html rename to test/generator/samples/event-handler-removal/main.html diff --git a/test/generator/event-handler-this-methods/_config.js b/test/generator/samples/event-handler-this-methods/_config.js similarity index 100% rename from test/generator/event-handler-this-methods/_config.js rename to test/generator/samples/event-handler-this-methods/_config.js diff --git a/test/generator/event-handler-this-methods/main.html b/test/generator/samples/event-handler-this-methods/main.html similarity index 100% rename from test/generator/event-handler-this-methods/main.html rename to test/generator/samples/event-handler-this-methods/main.html diff --git a/test/generator/event-handler/_config.js b/test/generator/samples/event-handler/_config.js similarity index 100% rename from test/generator/event-handler/_config.js rename to test/generator/samples/event-handler/_config.js diff --git a/test/generator/event-handler/main.html b/test/generator/samples/event-handler/main.html similarity index 100% rename from test/generator/event-handler/main.html rename to test/generator/samples/event-handler/main.html diff --git a/test/generator/events-custom/_config.js b/test/generator/samples/events-custom/_config.js similarity index 100% rename from test/generator/events-custom/_config.js rename to test/generator/samples/events-custom/_config.js diff --git a/test/generator/events-custom/main.html b/test/generator/samples/events-custom/main.html similarity index 100% rename from test/generator/events-custom/main.html rename to test/generator/samples/events-custom/main.html diff --git a/test/generator/events-lifecycle/_config.js b/test/generator/samples/events-lifecycle/_config.js similarity index 100% rename from test/generator/events-lifecycle/_config.js rename to test/generator/samples/events-lifecycle/_config.js diff --git a/test/generator/events-lifecycle/main.html b/test/generator/samples/events-lifecycle/main.html similarity index 100% rename from test/generator/events-lifecycle/main.html rename to test/generator/samples/events-lifecycle/main.html diff --git a/test/generator/function-in-expression/_config.js b/test/generator/samples/function-in-expression/_config.js similarity index 100% rename from test/generator/function-in-expression/_config.js rename to test/generator/samples/function-in-expression/_config.js diff --git a/test/generator/function-in-expression/main.html b/test/generator/samples/function-in-expression/main.html similarity index 100% rename from test/generator/function-in-expression/main.html rename to test/generator/samples/function-in-expression/main.html diff --git a/test/generator/get-state/_config.js b/test/generator/samples/get-state/_config.js similarity index 100% rename from test/generator/get-state/_config.js rename to test/generator/samples/get-state/_config.js diff --git a/test/generator/get-state/main.html b/test/generator/samples/get-state/main.html similarity index 100% rename from test/generator/get-state/main.html rename to test/generator/samples/get-state/main.html diff --git a/test/generator/globals-accessible-directly/_config.js b/test/generator/samples/globals-accessible-directly/_config.js similarity index 100% rename from test/generator/globals-accessible-directly/_config.js rename to test/generator/samples/globals-accessible-directly/_config.js diff --git a/test/generator/globals-accessible-directly/main.html b/test/generator/samples/globals-accessible-directly/main.html similarity index 100% rename from test/generator/globals-accessible-directly/main.html rename to test/generator/samples/globals-accessible-directly/main.html diff --git a/test/generator/globals-not-dereferenced/_config.js b/test/generator/samples/globals-not-dereferenced/_config.js similarity index 100% rename from test/generator/globals-not-dereferenced/_config.js rename to test/generator/samples/globals-not-dereferenced/_config.js diff --git a/test/generator/globals-not-dereferenced/main.html b/test/generator/samples/globals-not-dereferenced/main.html similarity index 100% rename from test/generator/globals-not-dereferenced/main.html rename to test/generator/samples/globals-not-dereferenced/main.html diff --git a/test/generator/globals-shadowed-by-data/_config.js b/test/generator/samples/globals-shadowed-by-data/_config.js similarity index 100% rename from test/generator/globals-shadowed-by-data/_config.js rename to test/generator/samples/globals-shadowed-by-data/_config.js diff --git a/test/generator/globals-shadowed-by-data/main.html b/test/generator/samples/globals-shadowed-by-data/main.html similarity index 100% rename from test/generator/globals-shadowed-by-data/main.html rename to test/generator/samples/globals-shadowed-by-data/main.html diff --git a/test/generator/globals-shadowed-by-helpers/_config.js b/test/generator/samples/globals-shadowed-by-helpers/_config.js similarity index 100% rename from test/generator/globals-shadowed-by-helpers/_config.js rename to test/generator/samples/globals-shadowed-by-helpers/_config.js diff --git a/test/generator/globals-shadowed-by-helpers/main.html b/test/generator/samples/globals-shadowed-by-helpers/main.html similarity index 100% rename from test/generator/globals-shadowed-by-helpers/main.html rename to test/generator/samples/globals-shadowed-by-helpers/main.html diff --git a/test/generator/hello-world/_config.js b/test/generator/samples/hello-world/_config.js similarity index 100% rename from test/generator/hello-world/_config.js rename to test/generator/samples/hello-world/_config.js diff --git a/test/generator/hello-world/main.html b/test/generator/samples/hello-world/main.html similarity index 100% rename from test/generator/hello-world/main.html rename to test/generator/samples/hello-world/main.html diff --git a/test/generator/helpers/_config.js b/test/generator/samples/helpers/_config.js similarity index 100% rename from test/generator/helpers/_config.js rename to test/generator/samples/helpers/_config.js diff --git a/test/generator/helpers/main.html b/test/generator/samples/helpers/main.html similarity index 100% rename from test/generator/helpers/main.html rename to test/generator/samples/helpers/main.html diff --git a/test/generator/if-block-else/_config.js b/test/generator/samples/if-block-else/_config.js similarity index 100% rename from test/generator/if-block-else/_config.js rename to test/generator/samples/if-block-else/_config.js diff --git a/test/generator/if-block-else/main.html b/test/generator/samples/if-block-else/main.html similarity index 100% rename from test/generator/if-block-else/main.html rename to test/generator/samples/if-block-else/main.html diff --git a/test/generator/if-block-elseif-text/_config.js b/test/generator/samples/if-block-elseif-text/_config.js similarity index 100% rename from test/generator/if-block-elseif-text/_config.js rename to test/generator/samples/if-block-elseif-text/_config.js diff --git a/test/generator/if-block-elseif-text/main.html b/test/generator/samples/if-block-elseif-text/main.html similarity index 100% rename from test/generator/if-block-elseif-text/main.html rename to test/generator/samples/if-block-elseif-text/main.html diff --git a/test/generator/if-block-elseif/_config.js b/test/generator/samples/if-block-elseif/_config.js similarity index 100% rename from test/generator/if-block-elseif/_config.js rename to test/generator/samples/if-block-elseif/_config.js diff --git a/test/generator/if-block-elseif/main.html b/test/generator/samples/if-block-elseif/main.html similarity index 100% rename from test/generator/if-block-elseif/main.html rename to test/generator/samples/if-block-elseif/main.html diff --git a/test/generator/if-block-expression/_config.js b/test/generator/samples/if-block-expression/_config.js similarity index 100% rename from test/generator/if-block-expression/_config.js rename to test/generator/samples/if-block-expression/_config.js diff --git a/test/generator/if-block-expression/main.html b/test/generator/samples/if-block-expression/main.html similarity index 100% rename from test/generator/if-block-expression/main.html rename to test/generator/samples/if-block-expression/main.html diff --git a/test/generator/if-block-widget/Widget.html b/test/generator/samples/if-block-widget/Widget.html similarity index 100% rename from test/generator/if-block-widget/Widget.html rename to test/generator/samples/if-block-widget/Widget.html diff --git a/test/generator/if-block-widget/_config.js b/test/generator/samples/if-block-widget/_config.js similarity index 100% rename from test/generator/if-block-widget/_config.js rename to test/generator/samples/if-block-widget/_config.js diff --git a/test/generator/if-block-widget/main.html b/test/generator/samples/if-block-widget/main.html similarity index 100% rename from test/generator/if-block-widget/main.html rename to test/generator/samples/if-block-widget/main.html diff --git a/test/generator/if-block/_config.js b/test/generator/samples/if-block/_config.js similarity index 100% rename from test/generator/if-block/_config.js rename to test/generator/samples/if-block/_config.js diff --git a/test/generator/if-block/main.html b/test/generator/samples/if-block/main.html similarity index 100% rename from test/generator/if-block/main.html rename to test/generator/samples/if-block/main.html diff --git a/test/generator/inline-expressions/_config.js b/test/generator/samples/inline-expressions/_config.js similarity index 100% rename from test/generator/inline-expressions/_config.js rename to test/generator/samples/inline-expressions/_config.js diff --git a/test/generator/inline-expressions/main.html b/test/generator/samples/inline-expressions/main.html similarity index 100% rename from test/generator/inline-expressions/main.html rename to test/generator/samples/inline-expressions/main.html diff --git a/test/generator/input-list/_config.js b/test/generator/samples/input-list/_config.js similarity index 100% rename from test/generator/input-list/_config.js rename to test/generator/samples/input-list/_config.js diff --git a/test/generator/input-list/main.html b/test/generator/samples/input-list/main.html similarity index 100% rename from test/generator/input-list/main.html rename to test/generator/samples/input-list/main.html diff --git a/test/generator/lifecycle-events/_config.js b/test/generator/samples/lifecycle-events/_config.js similarity index 100% rename from test/generator/lifecycle-events/_config.js rename to test/generator/samples/lifecycle-events/_config.js diff --git a/test/generator/lifecycle-events/main.html b/test/generator/samples/lifecycle-events/main.html similarity index 100% rename from test/generator/lifecycle-events/main.html rename to test/generator/samples/lifecycle-events/main.html diff --git a/test/generator/names-deconflicted-nested/_config.js b/test/generator/samples/names-deconflicted-nested/_config.js similarity index 100% rename from test/generator/names-deconflicted-nested/_config.js rename to test/generator/samples/names-deconflicted-nested/_config.js diff --git a/test/generator/names-deconflicted-nested/main.html b/test/generator/samples/names-deconflicted-nested/main.html similarity index 100% rename from test/generator/names-deconflicted-nested/main.html rename to test/generator/samples/names-deconflicted-nested/main.html diff --git a/test/generator/names-deconflicted/Widget.html b/test/generator/samples/names-deconflicted/Widget.html similarity index 100% rename from test/generator/names-deconflicted/Widget.html rename to test/generator/samples/names-deconflicted/Widget.html diff --git a/test/generator/names-deconflicted/_config.js b/test/generator/samples/names-deconflicted/_config.js similarity index 100% rename from test/generator/names-deconflicted/_config.js rename to test/generator/samples/names-deconflicted/_config.js diff --git a/test/generator/names-deconflicted/main.html b/test/generator/samples/names-deconflicted/main.html similarity index 100% rename from test/generator/names-deconflicted/main.html rename to test/generator/samples/names-deconflicted/main.html diff --git a/test/generator/nbsp/_config.js b/test/generator/samples/nbsp/_config.js similarity index 100% rename from test/generator/nbsp/_config.js rename to test/generator/samples/nbsp/_config.js diff --git a/test/generator/nbsp/main.html b/test/generator/samples/nbsp/main.html similarity index 100% rename from test/generator/nbsp/main.html rename to test/generator/samples/nbsp/main.html diff --git a/test/generator/observe-component-ignores-irrelevant-changes/Foo.html b/test/generator/samples/observe-component-ignores-irrelevant-changes/Foo.html similarity index 100% rename from test/generator/observe-component-ignores-irrelevant-changes/Foo.html rename to test/generator/samples/observe-component-ignores-irrelevant-changes/Foo.html diff --git a/test/generator/observe-component-ignores-irrelevant-changes/_config.js b/test/generator/samples/observe-component-ignores-irrelevant-changes/_config.js similarity index 100% rename from test/generator/observe-component-ignores-irrelevant-changes/_config.js rename to test/generator/samples/observe-component-ignores-irrelevant-changes/_config.js diff --git a/test/generator/observe-component-ignores-irrelevant-changes/main.html b/test/generator/samples/observe-component-ignores-irrelevant-changes/main.html similarity index 100% rename from test/generator/observe-component-ignores-irrelevant-changes/main.html rename to test/generator/samples/observe-component-ignores-irrelevant-changes/main.html diff --git a/test/generator/observe-prevents-loop/_config.js b/test/generator/samples/observe-prevents-loop/_config.js similarity index 100% rename from test/generator/observe-prevents-loop/_config.js rename to test/generator/samples/observe-prevents-loop/_config.js diff --git a/test/generator/observe-prevents-loop/main.html b/test/generator/samples/observe-prevents-loop/main.html similarity index 100% rename from test/generator/observe-prevents-loop/main.html rename to test/generator/samples/observe-prevents-loop/main.html diff --git a/test/generator/onrender-chain/Item.html b/test/generator/samples/onrender-chain/Item.html similarity index 100% rename from test/generator/onrender-chain/Item.html rename to test/generator/samples/onrender-chain/Item.html diff --git a/test/generator/onrender-chain/List.html b/test/generator/samples/onrender-chain/List.html similarity index 100% rename from test/generator/onrender-chain/List.html rename to test/generator/samples/onrender-chain/List.html diff --git a/test/generator/onrender-chain/_config.js b/test/generator/samples/onrender-chain/_config.js similarity index 100% rename from test/generator/onrender-chain/_config.js rename to test/generator/samples/onrender-chain/_config.js diff --git a/test/generator/onrender-chain/main.html b/test/generator/samples/onrender-chain/main.html similarity index 100% rename from test/generator/onrender-chain/main.html rename to test/generator/samples/onrender-chain/main.html diff --git a/test/generator/onrender-fires-when-ready-nested/ParentWidget.html b/test/generator/samples/onrender-fires-when-ready-nested/ParentWidget.html similarity index 100% rename from test/generator/onrender-fires-when-ready-nested/ParentWidget.html rename to test/generator/samples/onrender-fires-when-ready-nested/ParentWidget.html diff --git a/test/generator/onrender-fires-when-ready-nested/Widget.html b/test/generator/samples/onrender-fires-when-ready-nested/Widget.html similarity index 100% rename from test/generator/onrender-fires-when-ready-nested/Widget.html rename to test/generator/samples/onrender-fires-when-ready-nested/Widget.html diff --git a/test/generator/onrender-fires-when-ready-nested/_config.js b/test/generator/samples/onrender-fires-when-ready-nested/_config.js similarity index 100% rename from test/generator/onrender-fires-when-ready-nested/_config.js rename to test/generator/samples/onrender-fires-when-ready-nested/_config.js diff --git a/test/generator/onrender-fires-when-ready-nested/main.html b/test/generator/samples/onrender-fires-when-ready-nested/main.html similarity index 100% rename from test/generator/onrender-fires-when-ready-nested/main.html rename to test/generator/samples/onrender-fires-when-ready-nested/main.html diff --git a/test/generator/onrender-fires-when-ready/Widget.html b/test/generator/samples/onrender-fires-when-ready/Widget.html similarity index 100% rename from test/generator/onrender-fires-when-ready/Widget.html rename to test/generator/samples/onrender-fires-when-ready/Widget.html diff --git a/test/generator/onrender-fires-when-ready/_config.js b/test/generator/samples/onrender-fires-when-ready/_config.js similarity index 100% rename from test/generator/onrender-fires-when-ready/_config.js rename to test/generator/samples/onrender-fires-when-ready/_config.js diff --git a/test/generator/onrender-fires-when-ready/main.html b/test/generator/samples/onrender-fires-when-ready/main.html similarity index 100% rename from test/generator/onrender-fires-when-ready/main.html rename to test/generator/samples/onrender-fires-when-ready/main.html diff --git a/test/generator/pass-no-options/_config.js b/test/generator/samples/pass-no-options/_config.js similarity index 100% rename from test/generator/pass-no-options/_config.js rename to test/generator/samples/pass-no-options/_config.js diff --git a/test/generator/pass-no-options/main.html b/test/generator/samples/pass-no-options/main.html similarity index 100% rename from test/generator/pass-no-options/main.html rename to test/generator/samples/pass-no-options/main.html diff --git a/test/generator/raw-mustaches-preserved/_config.js b/test/generator/samples/raw-mustaches-preserved/_config.js similarity index 100% rename from test/generator/raw-mustaches-preserved/_config.js rename to test/generator/samples/raw-mustaches-preserved/_config.js diff --git a/test/generator/raw-mustaches-preserved/main.html b/test/generator/samples/raw-mustaches-preserved/main.html similarity index 100% rename from test/generator/raw-mustaches-preserved/main.html rename to test/generator/samples/raw-mustaches-preserved/main.html diff --git a/test/generator/raw-mustaches/_config.js b/test/generator/samples/raw-mustaches/_config.js similarity index 100% rename from test/generator/raw-mustaches/_config.js rename to test/generator/samples/raw-mustaches/_config.js diff --git a/test/generator/raw-mustaches/main.html b/test/generator/samples/raw-mustaches/main.html similarity index 100% rename from test/generator/raw-mustaches/main.html rename to test/generator/samples/raw-mustaches/main.html diff --git a/test/generator/refs-unset/_config.js b/test/generator/samples/refs-unset/_config.js similarity index 100% rename from test/generator/refs-unset/_config.js rename to test/generator/samples/refs-unset/_config.js diff --git a/test/generator/refs-unset/main.html b/test/generator/samples/refs-unset/main.html similarity index 100% rename from test/generator/refs-unset/main.html rename to test/generator/samples/refs-unset/main.html diff --git a/test/generator/refs/_config.js b/test/generator/samples/refs/_config.js similarity index 100% rename from test/generator/refs/_config.js rename to test/generator/samples/refs/_config.js diff --git a/test/generator/refs/main.html b/test/generator/samples/refs/main.html similarity index 100% rename from test/generator/refs/main.html rename to test/generator/samples/refs/main.html diff --git a/test/generator/select/_config.js b/test/generator/samples/select/_config.js similarity index 100% rename from test/generator/select/_config.js rename to test/generator/samples/select/_config.js diff --git a/test/generator/select/main.html b/test/generator/samples/select/main.html similarity index 100% rename from test/generator/select/main.html rename to test/generator/samples/select/main.html diff --git a/test/generator/self-reference-tree/_config.js b/test/generator/samples/self-reference-tree/_config.js similarity index 100% rename from test/generator/self-reference-tree/_config.js rename to test/generator/samples/self-reference-tree/_config.js diff --git a/test/generator/self-reference-tree/main.html b/test/generator/samples/self-reference-tree/main.html similarity index 100% rename from test/generator/self-reference-tree/main.html rename to test/generator/samples/self-reference-tree/main.html diff --git a/test/generator/self-reference/_config.js b/test/generator/samples/self-reference/_config.js similarity index 100% rename from test/generator/self-reference/_config.js rename to test/generator/samples/self-reference/_config.js diff --git a/test/generator/self-reference/main.html b/test/generator/samples/self-reference/main.html similarity index 100% rename from test/generator/self-reference/main.html rename to test/generator/samples/self-reference/main.html diff --git a/test/generator/set-in-observe-dedupes-renders/Widget.html b/test/generator/samples/set-in-observe-dedupes-renders/Widget.html similarity index 100% rename from test/generator/set-in-observe-dedupes-renders/Widget.html rename to test/generator/samples/set-in-observe-dedupes-renders/Widget.html diff --git a/test/generator/set-in-observe-dedupes-renders/_config.js b/test/generator/samples/set-in-observe-dedupes-renders/_config.js similarity index 100% rename from test/generator/set-in-observe-dedupes-renders/_config.js rename to test/generator/samples/set-in-observe-dedupes-renders/_config.js diff --git a/test/generator/set-in-observe-dedupes-renders/main.html b/test/generator/samples/set-in-observe-dedupes-renders/main.html similarity index 100% rename from test/generator/set-in-observe-dedupes-renders/main.html rename to test/generator/samples/set-in-observe-dedupes-renders/main.html diff --git a/test/generator/set-in-observe/_config.js b/test/generator/samples/set-in-observe/_config.js similarity index 100% rename from test/generator/set-in-observe/_config.js rename to test/generator/samples/set-in-observe/_config.js diff --git a/test/generator/set-in-observe/main.html b/test/generator/samples/set-in-observe/main.html similarity index 100% rename from test/generator/set-in-observe/main.html rename to test/generator/samples/set-in-observe/main.html diff --git a/test/generator/set-in-onrender/_config.js b/test/generator/samples/set-in-onrender/_config.js similarity index 100% rename from test/generator/set-in-onrender/_config.js rename to test/generator/samples/set-in-onrender/_config.js diff --git a/test/generator/set-in-onrender/main.html b/test/generator/samples/set-in-onrender/main.html similarity index 100% rename from test/generator/set-in-onrender/main.html rename to test/generator/samples/set-in-onrender/main.html diff --git a/test/generator/set-prevents-loop/Foo.html b/test/generator/samples/set-prevents-loop/Foo.html similarity index 100% rename from test/generator/set-prevents-loop/Foo.html rename to test/generator/samples/set-prevents-loop/Foo.html diff --git a/test/generator/set-prevents-loop/_config.js b/test/generator/samples/set-prevents-loop/_config.js similarity index 100% rename from test/generator/set-prevents-loop/_config.js rename to test/generator/samples/set-prevents-loop/_config.js diff --git a/test/generator/set-prevents-loop/main.html b/test/generator/samples/set-prevents-loop/main.html similarity index 100% rename from test/generator/set-prevents-loop/main.html rename to test/generator/samples/set-prevents-loop/main.html diff --git a/test/generator/single-static-element/_config.js b/test/generator/samples/single-static-element/_config.js similarity index 100% rename from test/generator/single-static-element/_config.js rename to test/generator/samples/single-static-element/_config.js diff --git a/test/generator/single-static-element/main.html b/test/generator/samples/single-static-element/main.html similarity index 100% rename from test/generator/single-static-element/main.html rename to test/generator/samples/single-static-element/main.html diff --git a/test/generator/single-text-node/_config.js b/test/generator/samples/single-text-node/_config.js similarity index 100% rename from test/generator/single-text-node/_config.js rename to test/generator/samples/single-text-node/_config.js diff --git a/test/generator/single-text-node/main.html b/test/generator/samples/single-text-node/main.html similarity index 100% rename from test/generator/single-text-node/main.html rename to test/generator/samples/single-text-node/main.html diff --git a/test/generator/svg-attributes/_config.js b/test/generator/samples/svg-attributes/_config.js similarity index 100% rename from test/generator/svg-attributes/_config.js rename to test/generator/samples/svg-attributes/_config.js diff --git a/test/generator/svg-attributes/main.html b/test/generator/samples/svg-attributes/main.html similarity index 100% rename from test/generator/svg-attributes/main.html rename to test/generator/samples/svg-attributes/main.html diff --git a/test/generator/svg-child-component-declared-namespace-shorthand/Rect.html b/test/generator/samples/svg-child-component-declared-namespace-shorthand/Rect.html similarity index 100% rename from test/generator/svg-child-component-declared-namespace-shorthand/Rect.html rename to test/generator/samples/svg-child-component-declared-namespace-shorthand/Rect.html diff --git a/test/generator/svg-child-component-declared-namespace-shorthand/_config.js b/test/generator/samples/svg-child-component-declared-namespace-shorthand/_config.js similarity index 100% rename from test/generator/svg-child-component-declared-namespace-shorthand/_config.js rename to test/generator/samples/svg-child-component-declared-namespace-shorthand/_config.js diff --git a/test/generator/svg-child-component-declared-namespace-shorthand/main.html b/test/generator/samples/svg-child-component-declared-namespace-shorthand/main.html similarity index 100% rename from test/generator/svg-child-component-declared-namespace-shorthand/main.html rename to test/generator/samples/svg-child-component-declared-namespace-shorthand/main.html diff --git a/test/generator/svg-child-component-declared-namespace/Rect.html b/test/generator/samples/svg-child-component-declared-namespace/Rect.html similarity index 100% rename from test/generator/svg-child-component-declared-namespace/Rect.html rename to test/generator/samples/svg-child-component-declared-namespace/Rect.html diff --git a/test/generator/svg-child-component-declared-namespace/_config.js b/test/generator/samples/svg-child-component-declared-namespace/_config.js similarity index 100% rename from test/generator/svg-child-component-declared-namespace/_config.js rename to test/generator/samples/svg-child-component-declared-namespace/_config.js diff --git a/test/generator/svg-child-component-declared-namespace/main.html b/test/generator/samples/svg-child-component-declared-namespace/main.html similarity index 100% rename from test/generator/svg-child-component-declared-namespace/main.html rename to test/generator/samples/svg-child-component-declared-namespace/main.html diff --git a/test/generator/svg-class/_config.js b/test/generator/samples/svg-class/_config.js similarity index 100% rename from test/generator/svg-class/_config.js rename to test/generator/samples/svg-class/_config.js diff --git a/test/generator/svg-class/main.html b/test/generator/samples/svg-class/main.html similarity index 100% rename from test/generator/svg-class/main.html rename to test/generator/samples/svg-class/main.html diff --git a/test/generator/svg-each-block-namespace/_config.js b/test/generator/samples/svg-each-block-namespace/_config.js similarity index 100% rename from test/generator/svg-each-block-namespace/_config.js rename to test/generator/samples/svg-each-block-namespace/_config.js diff --git a/test/generator/svg-each-block-namespace/main.html b/test/generator/samples/svg-each-block-namespace/main.html similarity index 100% rename from test/generator/svg-each-block-namespace/main.html rename to test/generator/samples/svg-each-block-namespace/main.html diff --git a/test/generator/svg-multiple/_config.js b/test/generator/samples/svg-multiple/_config.js similarity index 100% rename from test/generator/svg-multiple/_config.js rename to test/generator/samples/svg-multiple/_config.js diff --git a/test/generator/svg-multiple/main.html b/test/generator/samples/svg-multiple/main.html similarity index 100% rename from test/generator/svg-multiple/main.html rename to test/generator/samples/svg-multiple/main.html diff --git a/test/generator/svg-no-whitespace/_config.js b/test/generator/samples/svg-no-whitespace/_config.js similarity index 100% rename from test/generator/svg-no-whitespace/_config.js rename to test/generator/samples/svg-no-whitespace/_config.js diff --git a/test/generator/svg-no-whitespace/main.html b/test/generator/samples/svg-no-whitespace/main.html similarity index 100% rename from test/generator/svg-no-whitespace/main.html rename to test/generator/samples/svg-no-whitespace/main.html diff --git a/test/generator/svg-xlink/_config.js b/test/generator/samples/svg-xlink/_config.js similarity index 100% rename from test/generator/svg-xlink/_config.js rename to test/generator/samples/svg-xlink/_config.js diff --git a/test/generator/svg-xlink/main.html b/test/generator/samples/svg-xlink/main.html similarity index 100% rename from test/generator/svg-xlink/main.html rename to test/generator/samples/svg-xlink/main.html diff --git a/test/generator/svg-xmlns/_config.js b/test/generator/samples/svg-xmlns/_config.js similarity index 100% rename from test/generator/svg-xmlns/_config.js rename to test/generator/samples/svg-xmlns/_config.js diff --git a/test/generator/svg-xmlns/main.html b/test/generator/samples/svg-xmlns/main.html similarity index 100% rename from test/generator/svg-xmlns/main.html rename to test/generator/samples/svg-xmlns/main.html diff --git a/test/generator/svg/_config.js b/test/generator/samples/svg/_config.js similarity index 100% rename from test/generator/svg/_config.js rename to test/generator/samples/svg/_config.js diff --git a/test/generator/svg/main.html b/test/generator/samples/svg/main.html similarity index 100% rename from test/generator/svg/main.html rename to test/generator/samples/svg/main.html diff --git a/test/parse.js b/test/parser/index.js similarity index 70% rename from test/parse.js rename to test/parser/index.js index 68e3d18664d8..ed3f62368a34 100644 --- a/test/parse.js +++ b/test/parser/index.js @@ -1,24 +1,24 @@ import assert from 'assert'; import * as fs from 'fs'; -import { svelte, exists } from './helpers.js'; +import { svelte, exists } from '../helpers.js'; describe( 'parse', () => { - fs.readdirSync( 'test/parser' ).forEach( dir => { + fs.readdirSync( 'test/parser/samples' ).forEach( dir => { if ( dir[0] === '.' ) return; - const solo = exists( `test/parser/${dir}/solo` ); + const solo = exists( `test/parser/samples/${dir}/solo` ); if ( solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); } ( solo ? it.only : it )( dir, () => { - const input = fs.readFileSync( `test/parser/${dir}/input.html`, 'utf-8' ).replace( /\s+$/, '' ); + const input = fs.readFileSync( `test/parser/samples/${dir}/input.html`, 'utf-8' ).replace( /\s+$/, '' ); try { const actual = svelte.parse( input ); - fs.writeFileSync( `test/parser/${dir}/_actual.json`, JSON.stringify( actual, null, '\t' ) ); - const expected = require( `./parser/${dir}/output.json` ); + fs.writeFileSync( `test/parser/samples/${dir}/_actual.json`, JSON.stringify( actual, null, '\t' ) ); + const expected = require( `./samples/${dir}/output.json` ); assert.deepEqual( actual.html, expected.html ); assert.deepEqual( actual.css, expected.css ); @@ -27,7 +27,7 @@ describe( 'parse', () => { if ( err.name !== 'ParseError' ) throw err; try { - const expected = require( `./parser/${dir}/error.json` ); + const expected = require( `./samples/${dir}/error.json` ); assert.equal( err.message, expected.message ); assert.deepEqual( err.loc, expected.loc ); diff --git a/test/parser/attribute-dynamic-boolean/input.html b/test/parser/samples/attribute-dynamic-boolean/input.html similarity index 100% rename from test/parser/attribute-dynamic-boolean/input.html rename to test/parser/samples/attribute-dynamic-boolean/input.html diff --git a/test/parser/attribute-dynamic-boolean/output.json b/test/parser/samples/attribute-dynamic-boolean/output.json similarity index 100% rename from test/parser/attribute-dynamic-boolean/output.json rename to test/parser/samples/attribute-dynamic-boolean/output.json diff --git a/test/parser/attribute-dynamic/input.html b/test/parser/samples/attribute-dynamic/input.html similarity index 100% rename from test/parser/attribute-dynamic/input.html rename to test/parser/samples/attribute-dynamic/input.html diff --git a/test/parser/attribute-dynamic/output.json b/test/parser/samples/attribute-dynamic/output.json similarity index 100% rename from test/parser/attribute-dynamic/output.json rename to test/parser/samples/attribute-dynamic/output.json diff --git a/test/parser/attribute-escaped/input.html b/test/parser/samples/attribute-escaped/input.html similarity index 100% rename from test/parser/attribute-escaped/input.html rename to test/parser/samples/attribute-escaped/input.html diff --git a/test/parser/attribute-escaped/output.json b/test/parser/samples/attribute-escaped/output.json similarity index 100% rename from test/parser/attribute-escaped/output.json rename to test/parser/samples/attribute-escaped/output.json diff --git a/test/parser/attribute-multiple/input.html b/test/parser/samples/attribute-multiple/input.html similarity index 100% rename from test/parser/attribute-multiple/input.html rename to test/parser/samples/attribute-multiple/input.html diff --git a/test/parser/attribute-multiple/output.json b/test/parser/samples/attribute-multiple/output.json similarity index 100% rename from test/parser/attribute-multiple/output.json rename to test/parser/samples/attribute-multiple/output.json diff --git a/test/parser/attribute-static-boolean/input.html b/test/parser/samples/attribute-static-boolean/input.html similarity index 100% rename from test/parser/attribute-static-boolean/input.html rename to test/parser/samples/attribute-static-boolean/input.html diff --git a/test/parser/attribute-static-boolean/output.json b/test/parser/samples/attribute-static-boolean/output.json similarity index 100% rename from test/parser/attribute-static-boolean/output.json rename to test/parser/samples/attribute-static-boolean/output.json diff --git a/test/parser/attribute-static/input.html b/test/parser/samples/attribute-static/input.html similarity index 100% rename from test/parser/attribute-static/input.html rename to test/parser/samples/attribute-static/input.html diff --git a/test/parser/attribute-static/output.json b/test/parser/samples/attribute-static/output.json similarity index 100% rename from test/parser/attribute-static/output.json rename to test/parser/samples/attribute-static/output.json diff --git a/test/parser/attribute-unique-error/error.json b/test/parser/samples/attribute-unique-error/error.json similarity index 100% rename from test/parser/attribute-unique-error/error.json rename to test/parser/samples/attribute-unique-error/error.json diff --git a/test/parser/attribute-unique-error/input.html b/test/parser/samples/attribute-unique-error/input.html similarity index 100% rename from test/parser/attribute-unique-error/input.html rename to test/parser/samples/attribute-unique-error/input.html diff --git a/test/parser/attribute-unquoted/input.html b/test/parser/samples/attribute-unquoted/input.html similarity index 100% rename from test/parser/attribute-unquoted/input.html rename to test/parser/samples/attribute-unquoted/input.html diff --git a/test/parser/attribute-unquoted/output.json b/test/parser/samples/attribute-unquoted/output.json similarity index 100% rename from test/parser/attribute-unquoted/output.json rename to test/parser/samples/attribute-unquoted/output.json diff --git a/test/parser/binding-shorthand/input.html b/test/parser/samples/binding-shorthand/input.html similarity index 100% rename from test/parser/binding-shorthand/input.html rename to test/parser/samples/binding-shorthand/input.html diff --git a/test/parser/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json similarity index 100% rename from test/parser/binding-shorthand/output.json rename to test/parser/samples/binding-shorthand/output.json diff --git a/test/parser/binding/input.html b/test/parser/samples/binding/input.html similarity index 100% rename from test/parser/binding/input.html rename to test/parser/samples/binding/input.html diff --git a/test/parser/binding/output.json b/test/parser/samples/binding/output.json similarity index 100% rename from test/parser/binding/output.json rename to test/parser/samples/binding/output.json diff --git a/test/parser/comment/input.html b/test/parser/samples/comment/input.html similarity index 100% rename from test/parser/comment/input.html rename to test/parser/samples/comment/input.html diff --git a/test/parser/comment/output.json b/test/parser/samples/comment/output.json similarity index 100% rename from test/parser/comment/output.json rename to test/parser/samples/comment/output.json diff --git a/test/parser/convert-entities-in-element/input.html b/test/parser/samples/convert-entities-in-element/input.html similarity index 100% rename from test/parser/convert-entities-in-element/input.html rename to test/parser/samples/convert-entities-in-element/input.html diff --git a/test/parser/convert-entities-in-element/output.json b/test/parser/samples/convert-entities-in-element/output.json similarity index 100% rename from test/parser/convert-entities-in-element/output.json rename to test/parser/samples/convert-entities-in-element/output.json diff --git a/test/parser/convert-entities/input.html b/test/parser/samples/convert-entities/input.html similarity index 100% rename from test/parser/convert-entities/input.html rename to test/parser/samples/convert-entities/input.html diff --git a/test/parser/convert-entities/output.json b/test/parser/samples/convert-entities/output.json similarity index 100% rename from test/parser/convert-entities/output.json rename to test/parser/samples/convert-entities/output.json diff --git a/test/parser/css/input.html b/test/parser/samples/css/input.html similarity index 100% rename from test/parser/css/input.html rename to test/parser/samples/css/input.html diff --git a/test/parser/css/output.json b/test/parser/samples/css/output.json similarity index 100% rename from test/parser/css/output.json rename to test/parser/samples/css/output.json diff --git a/test/parser/each-block-else/input.html b/test/parser/samples/each-block-else/input.html similarity index 100% rename from test/parser/each-block-else/input.html rename to test/parser/samples/each-block-else/input.html diff --git a/test/parser/each-block-else/output.json b/test/parser/samples/each-block-else/output.json similarity index 100% rename from test/parser/each-block-else/output.json rename to test/parser/samples/each-block-else/output.json diff --git a/test/parser/each-block-indexed/input.html b/test/parser/samples/each-block-indexed/input.html similarity index 100% rename from test/parser/each-block-indexed/input.html rename to test/parser/samples/each-block-indexed/input.html diff --git a/test/parser/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json similarity index 100% rename from test/parser/each-block-indexed/output.json rename to test/parser/samples/each-block-indexed/output.json diff --git a/test/parser/each-block-keyed/input.html b/test/parser/samples/each-block-keyed/input.html similarity index 100% rename from test/parser/each-block-keyed/input.html rename to test/parser/samples/each-block-keyed/input.html diff --git a/test/parser/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json similarity index 100% rename from test/parser/each-block-keyed/output.json rename to test/parser/samples/each-block-keyed/output.json diff --git a/test/parser/each-block/input.html b/test/parser/samples/each-block/input.html similarity index 100% rename from test/parser/each-block/input.html rename to test/parser/samples/each-block/input.html diff --git a/test/parser/each-block/output.json b/test/parser/samples/each-block/output.json similarity index 100% rename from test/parser/each-block/output.json rename to test/parser/samples/each-block/output.json diff --git a/test/parser/element-with-mustache/input.html b/test/parser/samples/element-with-mustache/input.html similarity index 100% rename from test/parser/element-with-mustache/input.html rename to test/parser/samples/element-with-mustache/input.html diff --git a/test/parser/element-with-mustache/output.json b/test/parser/samples/element-with-mustache/output.json similarity index 100% rename from test/parser/element-with-mustache/output.json rename to test/parser/samples/element-with-mustache/output.json diff --git a/test/parser/element-with-text/input.html b/test/parser/samples/element-with-text/input.html similarity index 100% rename from test/parser/element-with-text/input.html rename to test/parser/samples/element-with-text/input.html diff --git a/test/parser/element-with-text/output.json b/test/parser/samples/element-with-text/output.json similarity index 100% rename from test/parser/element-with-text/output.json rename to test/parser/samples/element-with-text/output.json diff --git a/test/parser/elements/input.html b/test/parser/samples/elements/input.html similarity index 100% rename from test/parser/elements/input.html rename to test/parser/samples/elements/input.html diff --git a/test/parser/elements/output.json b/test/parser/samples/elements/output.json similarity index 100% rename from test/parser/elements/output.json rename to test/parser/samples/elements/output.json diff --git a/test/parser/error-css/error.json b/test/parser/samples/error-css/error.json similarity index 100% rename from test/parser/error-css/error.json rename to test/parser/samples/error-css/error.json diff --git a/test/parser/error-css/input.html b/test/parser/samples/error-css/input.html similarity index 100% rename from test/parser/error-css/input.html rename to test/parser/samples/error-css/input.html diff --git a/test/parser/error-event-handler/error.json b/test/parser/samples/error-event-handler/error.json similarity index 100% rename from test/parser/error-event-handler/error.json rename to test/parser/samples/error-event-handler/error.json diff --git a/test/parser/error-event-handler/input.html b/test/parser/samples/error-event-handler/input.html similarity index 100% rename from test/parser/error-event-handler/input.html rename to test/parser/samples/error-event-handler/input.html diff --git a/test/parser/error-illegal-expression/error.json b/test/parser/samples/error-illegal-expression/error.json similarity index 100% rename from test/parser/error-illegal-expression/error.json rename to test/parser/samples/error-illegal-expression/error.json diff --git a/test/parser/error-illegal-expression/input.html b/test/parser/samples/error-illegal-expression/input.html similarity index 100% rename from test/parser/error-illegal-expression/input.html rename to test/parser/samples/error-illegal-expression/input.html diff --git a/test/parser/error-multiple-styles/error.json b/test/parser/samples/error-multiple-styles/error.json similarity index 100% rename from test/parser/error-multiple-styles/error.json rename to test/parser/samples/error-multiple-styles/error.json diff --git a/test/parser/error-multiple-styles/input.html b/test/parser/samples/error-multiple-styles/input.html similarity index 100% rename from test/parser/error-multiple-styles/input.html rename to test/parser/samples/error-multiple-styles/input.html diff --git a/test/parser/error-self-reference/error.json b/test/parser/samples/error-self-reference/error.json similarity index 100% rename from test/parser/error-self-reference/error.json rename to test/parser/samples/error-self-reference/error.json diff --git a/test/parser/error-self-reference/input.html b/test/parser/samples/error-self-reference/input.html similarity index 100% rename from test/parser/error-self-reference/input.html rename to test/parser/samples/error-self-reference/input.html diff --git a/test/parser/error-unexpected-end-of-input-b/error.json b/test/parser/samples/error-unexpected-end-of-input-b/error.json similarity index 100% rename from test/parser/error-unexpected-end-of-input-b/error.json rename to test/parser/samples/error-unexpected-end-of-input-b/error.json diff --git a/test/parser/error-unexpected-end-of-input-b/input.html b/test/parser/samples/error-unexpected-end-of-input-b/input.html similarity index 100% rename from test/parser/error-unexpected-end-of-input-b/input.html rename to test/parser/samples/error-unexpected-end-of-input-b/input.html diff --git a/test/parser/error-unexpected-end-of-input-c/error.json b/test/parser/samples/error-unexpected-end-of-input-c/error.json similarity index 100% rename from test/parser/error-unexpected-end-of-input-c/error.json rename to test/parser/samples/error-unexpected-end-of-input-c/error.json diff --git a/test/parser/error-unexpected-end-of-input-c/input.html b/test/parser/samples/error-unexpected-end-of-input-c/input.html similarity index 100% rename from test/parser/error-unexpected-end-of-input-c/input.html rename to test/parser/samples/error-unexpected-end-of-input-c/input.html diff --git a/test/parser/error-unexpected-end-of-input-d/error.json b/test/parser/samples/error-unexpected-end-of-input-d/error.json similarity index 100% rename from test/parser/error-unexpected-end-of-input-d/error.json rename to test/parser/samples/error-unexpected-end-of-input-d/error.json diff --git a/test/parser/error-unexpected-end-of-input-d/input.html b/test/parser/samples/error-unexpected-end-of-input-d/input.html similarity index 100% rename from test/parser/error-unexpected-end-of-input-d/input.html rename to test/parser/samples/error-unexpected-end-of-input-d/input.html diff --git a/test/parser/error-unexpected-end-of-input/error.json b/test/parser/samples/error-unexpected-end-of-input/error.json similarity index 100% rename from test/parser/error-unexpected-end-of-input/error.json rename to test/parser/samples/error-unexpected-end-of-input/error.json diff --git a/test/parser/error-unexpected-end-of-input/input.html b/test/parser/samples/error-unexpected-end-of-input/input.html similarity index 100% rename from test/parser/error-unexpected-end-of-input/input.html rename to test/parser/samples/error-unexpected-end-of-input/input.html diff --git a/test/parser/error-unmatched-closing-tag/error.json b/test/parser/samples/error-unmatched-closing-tag/error.json similarity index 100% rename from test/parser/error-unmatched-closing-tag/error.json rename to test/parser/samples/error-unmatched-closing-tag/error.json diff --git a/test/parser/error-unmatched-closing-tag/input.html b/test/parser/samples/error-unmatched-closing-tag/input.html similarity index 100% rename from test/parser/error-unmatched-closing-tag/input.html rename to test/parser/samples/error-unmatched-closing-tag/input.html diff --git a/test/parser/error-void-closing/error.json b/test/parser/samples/error-void-closing/error.json similarity index 100% rename from test/parser/error-void-closing/error.json rename to test/parser/samples/error-void-closing/error.json diff --git a/test/parser/error-void-closing/input.html b/test/parser/samples/error-void-closing/input.html similarity index 100% rename from test/parser/error-void-closing/input.html rename to test/parser/samples/error-void-closing/input.html diff --git a/test/parser/event-handler/input.html b/test/parser/samples/event-handler/input.html similarity index 100% rename from test/parser/event-handler/input.html rename to test/parser/samples/event-handler/input.html diff --git a/test/parser/event-handler/output.json b/test/parser/samples/event-handler/output.json similarity index 100% rename from test/parser/event-handler/output.json rename to test/parser/samples/event-handler/output.json diff --git a/test/parser/if-block-else/input.html b/test/parser/samples/if-block-else/input.html similarity index 100% rename from test/parser/if-block-else/input.html rename to test/parser/samples/if-block-else/input.html diff --git a/test/parser/if-block-else/output.json b/test/parser/samples/if-block-else/output.json similarity index 100% rename from test/parser/if-block-else/output.json rename to test/parser/samples/if-block-else/output.json diff --git a/test/parser/if-block-elseif/input.html b/test/parser/samples/if-block-elseif/input.html similarity index 100% rename from test/parser/if-block-elseif/input.html rename to test/parser/samples/if-block-elseif/input.html diff --git a/test/parser/if-block-elseif/output.json b/test/parser/samples/if-block-elseif/output.json similarity index 100% rename from test/parser/if-block-elseif/output.json rename to test/parser/samples/if-block-elseif/output.json diff --git a/test/parser/if-block/input.html b/test/parser/samples/if-block/input.html similarity index 100% rename from test/parser/if-block/input.html rename to test/parser/samples/if-block/input.html diff --git a/test/parser/if-block/output.json b/test/parser/samples/if-block/output.json similarity index 100% rename from test/parser/if-block/output.json rename to test/parser/samples/if-block/output.json diff --git a/test/parser/implicitly-closed-li/input.html b/test/parser/samples/implicitly-closed-li/input.html similarity index 100% rename from test/parser/implicitly-closed-li/input.html rename to test/parser/samples/implicitly-closed-li/input.html diff --git a/test/parser/implicitly-closed-li/output.json b/test/parser/samples/implicitly-closed-li/output.json similarity index 100% rename from test/parser/implicitly-closed-li/output.json rename to test/parser/samples/implicitly-closed-li/output.json diff --git a/test/parser/nbsp/input.html b/test/parser/samples/nbsp/input.html similarity index 100% rename from test/parser/nbsp/input.html rename to test/parser/samples/nbsp/input.html diff --git a/test/parser/nbsp/output.json b/test/parser/samples/nbsp/output.json similarity index 100% rename from test/parser/nbsp/output.json rename to test/parser/samples/nbsp/output.json diff --git a/test/parser/raw-mustaches/input.html b/test/parser/samples/raw-mustaches/input.html similarity index 100% rename from test/parser/raw-mustaches/input.html rename to test/parser/samples/raw-mustaches/input.html diff --git a/test/parser/raw-mustaches/output.json b/test/parser/samples/raw-mustaches/output.json similarity index 100% rename from test/parser/raw-mustaches/output.json rename to test/parser/samples/raw-mustaches/output.json diff --git a/test/parser/refs/input.html b/test/parser/samples/refs/input.html similarity index 100% rename from test/parser/refs/input.html rename to test/parser/samples/refs/input.html diff --git a/test/parser/refs/output.json b/test/parser/samples/refs/output.json similarity index 100% rename from test/parser/refs/output.json rename to test/parser/samples/refs/output.json diff --git a/test/parser/script-comment-only/input.html b/test/parser/samples/script-comment-only/input.html similarity index 100% rename from test/parser/script-comment-only/input.html rename to test/parser/samples/script-comment-only/input.html diff --git a/test/parser/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json similarity index 100% rename from test/parser/script-comment-only/output.json rename to test/parser/samples/script-comment-only/output.json diff --git a/test/parser/script-comment-trailing-multiline/input.html b/test/parser/samples/script-comment-trailing-multiline/input.html similarity index 100% rename from test/parser/script-comment-trailing-multiline/input.html rename to test/parser/samples/script-comment-trailing-multiline/input.html diff --git a/test/parser/script-comment-trailing-multiline/output.json b/test/parser/samples/script-comment-trailing-multiline/output.json similarity index 100% rename from test/parser/script-comment-trailing-multiline/output.json rename to test/parser/samples/script-comment-trailing-multiline/output.json diff --git a/test/parser/script-comment-trailing/input.html b/test/parser/samples/script-comment-trailing/input.html similarity index 100% rename from test/parser/script-comment-trailing/input.html rename to test/parser/samples/script-comment-trailing/input.html diff --git a/test/parser/script-comment-trailing/output.json b/test/parser/samples/script-comment-trailing/output.json similarity index 100% rename from test/parser/script-comment-trailing/output.json rename to test/parser/samples/script-comment-trailing/output.json diff --git a/test/parser/script/input.html b/test/parser/samples/script/input.html similarity index 100% rename from test/parser/script/input.html rename to test/parser/samples/script/input.html diff --git a/test/parser/script/output.json b/test/parser/samples/script/output.json similarity index 100% rename from test/parser/script/output.json rename to test/parser/samples/script/output.json diff --git a/test/parser/self-closing-element/input.html b/test/parser/samples/self-closing-element/input.html similarity index 100% rename from test/parser/self-closing-element/input.html rename to test/parser/samples/self-closing-element/input.html diff --git a/test/parser/self-closing-element/output.json b/test/parser/samples/self-closing-element/output.json similarity index 100% rename from test/parser/self-closing-element/output.json rename to test/parser/samples/self-closing-element/output.json diff --git a/test/parser/self-reference/input.html b/test/parser/samples/self-reference/input.html similarity index 100% rename from test/parser/self-reference/input.html rename to test/parser/samples/self-reference/input.html diff --git a/test/parser/self-reference/output.json b/test/parser/samples/self-reference/output.json similarity index 100% rename from test/parser/self-reference/output.json rename to test/parser/samples/self-reference/output.json diff --git a/test/parser/space-between-mustaches/input.html b/test/parser/samples/space-between-mustaches/input.html similarity index 100% rename from test/parser/space-between-mustaches/input.html rename to test/parser/samples/space-between-mustaches/input.html diff --git a/test/parser/space-between-mustaches/output.json b/test/parser/samples/space-between-mustaches/output.json similarity index 100% rename from test/parser/space-between-mustaches/output.json rename to test/parser/samples/space-between-mustaches/output.json diff --git a/test/parser/whitespace-leading-trailing/input.html b/test/parser/samples/whitespace-leading-trailing/input.html similarity index 100% rename from test/parser/whitespace-leading-trailing/input.html rename to test/parser/samples/whitespace-leading-trailing/input.html diff --git a/test/parser/whitespace-leading-trailing/output.json b/test/parser/samples/whitespace-leading-trailing/output.json similarity index 100% rename from test/parser/whitespace-leading-trailing/output.json rename to test/parser/samples/whitespace-leading-trailing/output.json diff --git a/test/parser/yield/input.html b/test/parser/samples/yield/input.html similarity index 100% rename from test/parser/yield/input.html rename to test/parser/samples/yield/input.html diff --git a/test/parser/yield/output.json b/test/parser/samples/yield/output.json similarity index 100% rename from test/parser/yield/output.json rename to test/parser/samples/yield/output.json diff --git a/test/ssr.js b/test/server-side-rendering/index.js similarity index 64% rename from test/ssr.js rename to test/server-side-rendering/index.js index fa2873c81026..042fc4d333a3 100644 --- a/test/ssr.js +++ b/test/server-side-rendering/index.js @@ -1,7 +1,7 @@ import assert from 'assert'; import * as fs from 'fs'; -import { addLineNumbers, exists, loadConfig, setupHtmlEqual, svelte, tryToLoadJson } from './helpers.js'; +import { addLineNumbers, exists, loadConfig, setupHtmlEqual, svelte, tryToLoadJson } from '../helpers.js'; function tryToReadFile ( file ) { try { @@ -15,33 +15,33 @@ function tryToReadFile ( file ) { describe( 'ssr', () => { before( () => { require( process.env.COVERAGE ? - '../src/server-side-rendering/register.js' : - '../ssr/register' ); + '../../src/server-side-rendering/register.js' : + '../../ssr/register' ); return setupHtmlEqual(); }); - fs.readdirSync( 'test/server-side-rendering' ).forEach( dir => { + fs.readdirSync( 'test/server-side-rendering/samples' ).forEach( dir => { if ( dir[0] === '.' ) return; - const solo = exists( `test/server-side-rendering/${dir}/solo` ); + const solo = exists( `test/server-side-rendering/samples/${dir}/solo` ); if ( solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); } ( solo ? it.only : it )( dir, () => { - const component = require( `./server-side-rendering/${dir}/main.html` ); + const component = require( `./samples/${dir}/main.html` ); - const expectedHtml = tryToReadFile( `test/server-side-rendering/${dir}/_expected.html` ); - const expectedCss = tryToReadFile( `test/server-side-rendering/${dir}/_expected.css` ) || ''; + const expectedHtml = tryToReadFile( `test/server-side-rendering/samples/${dir}/_expected.html` ); + const expectedCss = tryToReadFile( `test/server-side-rendering/samples/${dir}/_expected.css` ) || ''; - const data = tryToLoadJson( `test/server-side-rendering/${dir}/data.json` ); + const data = tryToLoadJson( `test/server-side-rendering/samples/${dir}/data.json` ); const html = component.render( data ); const { css } = component.renderCss(); - fs.writeFileSync( `test/server-side-rendering/${dir}/_actual.html`, html ); - if ( css ) fs.writeFileSync( `test/server-side-rendering/${dir}/_actual.css`, css ); + fs.writeFileSync( `test/server-side-rendering/samples/${dir}/_actual.html`, html ); + if ( css ) fs.writeFileSync( `test/server-side-rendering/samples/${dir}/_actual.css`, css ); assert.htmlEqual( html, expectedHtml ); assert.equal( css.replace( /^\s+/gm, '' ), expectedCss.replace( /^\s+/gm, '' ) ); @@ -49,10 +49,10 @@ describe( 'ssr', () => { }); // duplicate client-side tests, as far as possible - fs.readdirSync( 'test/generator' ).forEach( dir => { + fs.readdirSync( 'test/generator/samples' ).forEach( dir => { if ( dir[0] === '.' ) return; - const config = loadConfig( `./generator/${dir}/_config.js` ); + const config = loadConfig( `./generator/samples/${dir}/_config.js` ); if ( config.solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); @@ -64,7 +64,7 @@ describe( 'ssr', () => { let compiled; try { - const source = fs.readFileSync( `test/generator/${dir}/main.html`, 'utf-8' ); + const source = fs.readFileSync( `test/generator/samples/${dir}/main.html`, 'utf-8' ); compiled = svelte.compile( source, { generate: 'ssr' }); } catch ( err ) { if ( config.compileError ) { @@ -75,7 +75,7 @@ describe( 'ssr', () => { } } - const component = require( `./generator/${dir}/main.html` ); + const component = require( `../generator/samples/${dir}/main.html` ); let html; try { diff --git a/test/server-side-rendering/attribute-boolean/_actual.html b/test/server-side-rendering/samples/attribute-boolean/_actual.html similarity index 100% rename from test/server-side-rendering/attribute-boolean/_actual.html rename to test/server-side-rendering/samples/attribute-boolean/_actual.html diff --git a/test/server-side-rendering/attribute-boolean/_expected.html b/test/server-side-rendering/samples/attribute-boolean/_expected.html similarity index 100% rename from test/server-side-rendering/attribute-boolean/_expected.html rename to test/server-side-rendering/samples/attribute-boolean/_expected.html diff --git a/test/server-side-rendering/attribute-boolean/main.html b/test/server-side-rendering/samples/attribute-boolean/main.html similarity index 100% rename from test/server-side-rendering/attribute-boolean/main.html rename to test/server-side-rendering/samples/attribute-boolean/main.html diff --git a/test/server-side-rendering/attribute-dynamic/_actual.html b/test/server-side-rendering/samples/attribute-dynamic/_actual.html similarity index 100% rename from test/server-side-rendering/attribute-dynamic/_actual.html rename to test/server-side-rendering/samples/attribute-dynamic/_actual.html diff --git a/test/server-side-rendering/attribute-dynamic/_expected.html b/test/server-side-rendering/samples/attribute-dynamic/_expected.html similarity index 100% rename from test/server-side-rendering/attribute-dynamic/_expected.html rename to test/server-side-rendering/samples/attribute-dynamic/_expected.html diff --git a/test/server-side-rendering/attribute-dynamic/data.json b/test/server-side-rendering/samples/attribute-dynamic/data.json similarity index 100% rename from test/server-side-rendering/attribute-dynamic/data.json rename to test/server-side-rendering/samples/attribute-dynamic/data.json diff --git a/test/server-side-rendering/attribute-dynamic/main.html b/test/server-side-rendering/samples/attribute-dynamic/main.html similarity index 100% rename from test/server-side-rendering/attribute-dynamic/main.html rename to test/server-side-rendering/samples/attribute-dynamic/main.html diff --git a/test/server-side-rendering/attribute-static/_actual.html b/test/server-side-rendering/samples/attribute-static/_actual.html similarity index 100% rename from test/server-side-rendering/attribute-static/_actual.html rename to test/server-side-rendering/samples/attribute-static/_actual.html diff --git a/test/server-side-rendering/attribute-static/_expected.html b/test/server-side-rendering/samples/attribute-static/_expected.html similarity index 100% rename from test/server-side-rendering/attribute-static/_expected.html rename to test/server-side-rendering/samples/attribute-static/_expected.html diff --git a/test/server-side-rendering/attribute-static/main.html b/test/server-side-rendering/samples/attribute-static/main.html similarity index 100% rename from test/server-side-rendering/attribute-static/main.html rename to test/server-side-rendering/samples/attribute-static/main.html diff --git a/test/server-side-rendering/comment/_actual.html b/test/server-side-rendering/samples/comment/_actual.html similarity index 100% rename from test/server-side-rendering/comment/_actual.html rename to test/server-side-rendering/samples/comment/_actual.html diff --git a/test/server-side-rendering/comment/_expected.html b/test/server-side-rendering/samples/comment/_expected.html similarity index 100% rename from test/server-side-rendering/comment/_expected.html rename to test/server-side-rendering/samples/comment/_expected.html diff --git a/test/server-side-rendering/comment/main.html b/test/server-side-rendering/samples/comment/main.html similarity index 100% rename from test/server-side-rendering/comment/main.html rename to test/server-side-rendering/samples/comment/main.html diff --git a/test/server-side-rendering/component-binding-renamed/Foo.html b/test/server-side-rendering/samples/component-binding-renamed/Foo.html similarity index 100% rename from test/server-side-rendering/component-binding-renamed/Foo.html rename to test/server-side-rendering/samples/component-binding-renamed/Foo.html diff --git a/test/server-side-rendering/component-binding-renamed/_actual.html b/test/server-side-rendering/samples/component-binding-renamed/_actual.html similarity index 100% rename from test/server-side-rendering/component-binding-renamed/_actual.html rename to test/server-side-rendering/samples/component-binding-renamed/_actual.html diff --git a/test/server-side-rendering/component-binding-renamed/_expected.html b/test/server-side-rendering/samples/component-binding-renamed/_expected.html similarity index 100% rename from test/server-side-rendering/component-binding-renamed/_expected.html rename to test/server-side-rendering/samples/component-binding-renamed/_expected.html diff --git a/test/server-side-rendering/component-binding-renamed/main.html b/test/server-side-rendering/samples/component-binding-renamed/main.html similarity index 100% rename from test/server-side-rendering/component-binding-renamed/main.html rename to test/server-side-rendering/samples/component-binding-renamed/main.html diff --git a/test/server-side-rendering/component-binding/Foo.html b/test/server-side-rendering/samples/component-binding/Foo.html similarity index 100% rename from test/server-side-rendering/component-binding/Foo.html rename to test/server-side-rendering/samples/component-binding/Foo.html diff --git a/test/server-side-rendering/component-binding/_actual.html b/test/server-side-rendering/samples/component-binding/_actual.html similarity index 100% rename from test/server-side-rendering/component-binding/_actual.html rename to test/server-side-rendering/samples/component-binding/_actual.html diff --git a/test/server-side-rendering/component-binding/_expected.html b/test/server-side-rendering/samples/component-binding/_expected.html similarity index 100% rename from test/server-side-rendering/component-binding/_expected.html rename to test/server-side-rendering/samples/component-binding/_expected.html diff --git a/test/server-side-rendering/component-binding/main.html b/test/server-side-rendering/samples/component-binding/main.html similarity index 100% rename from test/server-side-rendering/component-binding/main.html rename to test/server-side-rendering/samples/component-binding/main.html diff --git a/test/server-side-rendering/component-data-dynamic/Widget.html b/test/server-side-rendering/samples/component-data-dynamic/Widget.html similarity index 100% rename from test/server-side-rendering/component-data-dynamic/Widget.html rename to test/server-side-rendering/samples/component-data-dynamic/Widget.html diff --git a/test/server-side-rendering/component-data-dynamic/_actual.html b/test/server-side-rendering/samples/component-data-dynamic/_actual.html similarity index 100% rename from test/server-side-rendering/component-data-dynamic/_actual.html rename to test/server-side-rendering/samples/component-data-dynamic/_actual.html diff --git a/test/server-side-rendering/component-data-dynamic/_expected.html b/test/server-side-rendering/samples/component-data-dynamic/_expected.html similarity index 100% rename from test/server-side-rendering/component-data-dynamic/_expected.html rename to test/server-side-rendering/samples/component-data-dynamic/_expected.html diff --git a/test/server-side-rendering/component-data-dynamic/data.json b/test/server-side-rendering/samples/component-data-dynamic/data.json similarity index 100% rename from test/server-side-rendering/component-data-dynamic/data.json rename to test/server-side-rendering/samples/component-data-dynamic/data.json diff --git a/test/server-side-rendering/component-data-dynamic/main.html b/test/server-side-rendering/samples/component-data-dynamic/main.html similarity index 100% rename from test/server-side-rendering/component-data-dynamic/main.html rename to test/server-side-rendering/samples/component-data-dynamic/main.html diff --git a/test/server-side-rendering/component-data-empty/Widget.html b/test/server-side-rendering/samples/component-data-empty/Widget.html similarity index 100% rename from test/server-side-rendering/component-data-empty/Widget.html rename to test/server-side-rendering/samples/component-data-empty/Widget.html diff --git a/test/server-side-rendering/component-data-empty/_actual.html b/test/server-side-rendering/samples/component-data-empty/_actual.html similarity index 100% rename from test/server-side-rendering/component-data-empty/_actual.html rename to test/server-side-rendering/samples/component-data-empty/_actual.html diff --git a/test/server-side-rendering/component-data-empty/_expected.html b/test/server-side-rendering/samples/component-data-empty/_expected.html similarity index 100% rename from test/server-side-rendering/component-data-empty/_expected.html rename to test/server-side-rendering/samples/component-data-empty/_expected.html diff --git a/test/server-side-rendering/component-data-empty/main.html b/test/server-side-rendering/samples/component-data-empty/main.html similarity index 100% rename from test/server-side-rendering/component-data-empty/main.html rename to test/server-side-rendering/samples/component-data-empty/main.html diff --git a/test/server-side-rendering/component-data-static/Widget.html b/test/server-side-rendering/samples/component-data-static/Widget.html similarity index 100% rename from test/server-side-rendering/component-data-static/Widget.html rename to test/server-side-rendering/samples/component-data-static/Widget.html diff --git a/test/server-side-rendering/component-data-static/_actual.html b/test/server-side-rendering/samples/component-data-static/_actual.html similarity index 100% rename from test/server-side-rendering/component-data-static/_actual.html rename to test/server-side-rendering/samples/component-data-static/_actual.html diff --git a/test/server-side-rendering/component-data-static/_expected.html b/test/server-side-rendering/samples/component-data-static/_expected.html similarity index 100% rename from test/server-side-rendering/component-data-static/_expected.html rename to test/server-side-rendering/samples/component-data-static/_expected.html diff --git a/test/server-side-rendering/component-data-static/main.html b/test/server-side-rendering/samples/component-data-static/main.html similarity index 100% rename from test/server-side-rendering/component-data-static/main.html rename to test/server-side-rendering/samples/component-data-static/main.html diff --git a/test/server-side-rendering/component-refs-and-attributes/Widget.html b/test/server-side-rendering/samples/component-refs-and-attributes/Widget.html similarity index 100% rename from test/server-side-rendering/component-refs-and-attributes/Widget.html rename to test/server-side-rendering/samples/component-refs-and-attributes/Widget.html diff --git a/test/server-side-rendering/component-refs-and-attributes/_actual.html b/test/server-side-rendering/samples/component-refs-and-attributes/_actual.html similarity index 100% rename from test/server-side-rendering/component-refs-and-attributes/_actual.html rename to test/server-side-rendering/samples/component-refs-and-attributes/_actual.html diff --git a/test/server-side-rendering/component-refs-and-attributes/_expected.html b/test/server-side-rendering/samples/component-refs-and-attributes/_expected.html similarity index 100% rename from test/server-side-rendering/component-refs-and-attributes/_expected.html rename to test/server-side-rendering/samples/component-refs-and-attributes/_expected.html diff --git a/test/server-side-rendering/component-refs-and-attributes/main.html b/test/server-side-rendering/samples/component-refs-and-attributes/main.html similarity index 100% rename from test/server-side-rendering/component-refs-and-attributes/main.html rename to test/server-side-rendering/samples/component-refs-and-attributes/main.html diff --git a/test/server-side-rendering/component-refs/Widget.html b/test/server-side-rendering/samples/component-refs/Widget.html similarity index 100% rename from test/server-side-rendering/component-refs/Widget.html rename to test/server-side-rendering/samples/component-refs/Widget.html diff --git a/test/server-side-rendering/component-refs/_actual.html b/test/server-side-rendering/samples/component-refs/_actual.html similarity index 100% rename from test/server-side-rendering/component-refs/_actual.html rename to test/server-side-rendering/samples/component-refs/_actual.html diff --git a/test/server-side-rendering/component-refs/_expected.html b/test/server-side-rendering/samples/component-refs/_expected.html similarity index 100% rename from test/server-side-rendering/component-refs/_expected.html rename to test/server-side-rendering/samples/component-refs/_expected.html diff --git a/test/server-side-rendering/component-refs/main.html b/test/server-side-rendering/samples/component-refs/main.html similarity index 100% rename from test/server-side-rendering/component-refs/main.html rename to test/server-side-rendering/samples/component-refs/main.html diff --git a/test/server-side-rendering/component-yield/Widget.html b/test/server-side-rendering/samples/component-yield/Widget.html similarity index 100% rename from test/server-side-rendering/component-yield/Widget.html rename to test/server-side-rendering/samples/component-yield/Widget.html diff --git a/test/server-side-rendering/component-yield/_actual.html b/test/server-side-rendering/samples/component-yield/_actual.html similarity index 100% rename from test/server-side-rendering/component-yield/_actual.html rename to test/server-side-rendering/samples/component-yield/_actual.html diff --git a/test/server-side-rendering/component-yield/_expected.html b/test/server-side-rendering/samples/component-yield/_expected.html similarity index 100% rename from test/server-side-rendering/component-yield/_expected.html rename to test/server-side-rendering/samples/component-yield/_expected.html diff --git a/test/server-side-rendering/component-yield/main.html b/test/server-side-rendering/samples/component-yield/main.html similarity index 100% rename from test/server-side-rendering/component-yield/main.html rename to test/server-side-rendering/samples/component-yield/main.html diff --git a/test/server-side-rendering/component/Widget.html b/test/server-side-rendering/samples/component/Widget.html similarity index 100% rename from test/server-side-rendering/component/Widget.html rename to test/server-side-rendering/samples/component/Widget.html diff --git a/test/server-side-rendering/component/_actual.html b/test/server-side-rendering/samples/component/_actual.html similarity index 100% rename from test/server-side-rendering/component/_actual.html rename to test/server-side-rendering/samples/component/_actual.html diff --git a/test/server-side-rendering/component/_expected.html b/test/server-side-rendering/samples/component/_expected.html similarity index 100% rename from test/server-side-rendering/component/_expected.html rename to test/server-side-rendering/samples/component/_expected.html diff --git a/test/server-side-rendering/component/main.html b/test/server-side-rendering/samples/component/main.html similarity index 100% rename from test/server-side-rendering/component/main.html rename to test/server-side-rendering/samples/component/main.html diff --git a/test/server-side-rendering/computed/_actual.html b/test/server-side-rendering/samples/computed/_actual.html similarity index 100% rename from test/server-side-rendering/computed/_actual.html rename to test/server-side-rendering/samples/computed/_actual.html diff --git a/test/server-side-rendering/computed/_expected.html b/test/server-side-rendering/samples/computed/_expected.html similarity index 100% rename from test/server-side-rendering/computed/_expected.html rename to test/server-side-rendering/samples/computed/_expected.html diff --git a/test/server-side-rendering/computed/data.json b/test/server-side-rendering/samples/computed/data.json similarity index 100% rename from test/server-side-rendering/computed/data.json rename to test/server-side-rendering/samples/computed/data.json diff --git a/test/server-side-rendering/computed/main.html b/test/server-side-rendering/samples/computed/main.html similarity index 100% rename from test/server-side-rendering/computed/main.html rename to test/server-side-rendering/samples/computed/main.html diff --git a/test/server-side-rendering/default-data-override/_actual.html b/test/server-side-rendering/samples/default-data-override/_actual.html similarity index 100% rename from test/server-side-rendering/default-data-override/_actual.html rename to test/server-side-rendering/samples/default-data-override/_actual.html diff --git a/test/server-side-rendering/default-data-override/_expected.html b/test/server-side-rendering/samples/default-data-override/_expected.html similarity index 100% rename from test/server-side-rendering/default-data-override/_expected.html rename to test/server-side-rendering/samples/default-data-override/_expected.html diff --git a/test/server-side-rendering/default-data-override/data.json b/test/server-side-rendering/samples/default-data-override/data.json similarity index 100% rename from test/server-side-rendering/default-data-override/data.json rename to test/server-side-rendering/samples/default-data-override/data.json diff --git a/test/server-side-rendering/default-data-override/main.html b/test/server-side-rendering/samples/default-data-override/main.html similarity index 100% rename from test/server-side-rendering/default-data-override/main.html rename to test/server-side-rendering/samples/default-data-override/main.html diff --git a/test/server-side-rendering/default-data/_actual.html b/test/server-side-rendering/samples/default-data/_actual.html similarity index 100% rename from test/server-side-rendering/default-data/_actual.html rename to test/server-side-rendering/samples/default-data/_actual.html diff --git a/test/server-side-rendering/default-data/_expected.html b/test/server-side-rendering/samples/default-data/_expected.html similarity index 100% rename from test/server-side-rendering/default-data/_expected.html rename to test/server-side-rendering/samples/default-data/_expected.html diff --git a/test/server-side-rendering/default-data/main.html b/test/server-side-rendering/samples/default-data/main.html similarity index 100% rename from test/server-side-rendering/default-data/main.html rename to test/server-side-rendering/samples/default-data/main.html diff --git a/test/server-side-rendering/directives/_actual.html b/test/server-side-rendering/samples/directives/_actual.html similarity index 100% rename from test/server-side-rendering/directives/_actual.html rename to test/server-side-rendering/samples/directives/_actual.html diff --git a/test/server-side-rendering/directives/_expected.html b/test/server-side-rendering/samples/directives/_expected.html similarity index 100% rename from test/server-side-rendering/directives/_expected.html rename to test/server-side-rendering/samples/directives/_expected.html diff --git a/test/server-side-rendering/directives/main.html b/test/server-side-rendering/samples/directives/main.html similarity index 100% rename from test/server-side-rendering/directives/main.html rename to test/server-side-rendering/samples/directives/main.html diff --git a/test/server-side-rendering/dynamic-text-escaped/_actual.html b/test/server-side-rendering/samples/dynamic-text-escaped/_actual.html similarity index 100% rename from test/server-side-rendering/dynamic-text-escaped/_actual.html rename to test/server-side-rendering/samples/dynamic-text-escaped/_actual.html diff --git a/test/server-side-rendering/dynamic-text-escaped/_expected.html b/test/server-side-rendering/samples/dynamic-text-escaped/_expected.html similarity index 100% rename from test/server-side-rendering/dynamic-text-escaped/_expected.html rename to test/server-side-rendering/samples/dynamic-text-escaped/_expected.html diff --git a/test/server-side-rendering/dynamic-text-escaped/data.json b/test/server-side-rendering/samples/dynamic-text-escaped/data.json similarity index 100% rename from test/server-side-rendering/dynamic-text-escaped/data.json rename to test/server-side-rendering/samples/dynamic-text-escaped/data.json diff --git a/test/server-side-rendering/dynamic-text-escaped/main.html b/test/server-side-rendering/samples/dynamic-text-escaped/main.html similarity index 100% rename from test/server-side-rendering/dynamic-text-escaped/main.html rename to test/server-side-rendering/samples/dynamic-text-escaped/main.html diff --git a/test/server-side-rendering/dynamic-text/_actual.html b/test/server-side-rendering/samples/dynamic-text/_actual.html similarity index 100% rename from test/server-side-rendering/dynamic-text/_actual.html rename to test/server-side-rendering/samples/dynamic-text/_actual.html diff --git a/test/server-side-rendering/dynamic-text/_expected.html b/test/server-side-rendering/samples/dynamic-text/_expected.html similarity index 100% rename from test/server-side-rendering/dynamic-text/_expected.html rename to test/server-side-rendering/samples/dynamic-text/_expected.html diff --git a/test/server-side-rendering/dynamic-text/data.json b/test/server-side-rendering/samples/dynamic-text/data.json similarity index 100% rename from test/server-side-rendering/dynamic-text/data.json rename to test/server-side-rendering/samples/dynamic-text/data.json diff --git a/test/server-side-rendering/dynamic-text/main.html b/test/server-side-rendering/samples/dynamic-text/main.html similarity index 100% rename from test/server-side-rendering/dynamic-text/main.html rename to test/server-side-rendering/samples/dynamic-text/main.html diff --git a/test/server-side-rendering/each-block/_actual.html b/test/server-side-rendering/samples/each-block/_actual.html similarity index 100% rename from test/server-side-rendering/each-block/_actual.html rename to test/server-side-rendering/samples/each-block/_actual.html diff --git a/test/server-side-rendering/each-block/_expected.html b/test/server-side-rendering/samples/each-block/_expected.html similarity index 100% rename from test/server-side-rendering/each-block/_expected.html rename to test/server-side-rendering/samples/each-block/_expected.html diff --git a/test/server-side-rendering/each-block/data.json b/test/server-side-rendering/samples/each-block/data.json similarity index 100% rename from test/server-side-rendering/each-block/data.json rename to test/server-side-rendering/samples/each-block/data.json diff --git a/test/server-side-rendering/each-block/main.html b/test/server-side-rendering/samples/each-block/main.html similarity index 100% rename from test/server-side-rendering/each-block/main.html rename to test/server-side-rendering/samples/each-block/main.html diff --git a/test/server-side-rendering/empty-elements-closed/_actual.html b/test/server-side-rendering/samples/empty-elements-closed/_actual.html similarity index 100% rename from test/server-side-rendering/empty-elements-closed/_actual.html rename to test/server-side-rendering/samples/empty-elements-closed/_actual.html diff --git a/test/server-side-rendering/empty-elements-closed/_expected.html b/test/server-side-rendering/samples/empty-elements-closed/_expected.html similarity index 100% rename from test/server-side-rendering/empty-elements-closed/_expected.html rename to test/server-side-rendering/samples/empty-elements-closed/_expected.html diff --git a/test/server-side-rendering/empty-elements-closed/main.html b/test/server-side-rendering/samples/empty-elements-closed/main.html similarity index 100% rename from test/server-side-rendering/empty-elements-closed/main.html rename to test/server-side-rendering/samples/empty-elements-closed/main.html diff --git a/test/server-side-rendering/entities/_actual.html b/test/server-side-rendering/samples/entities/_actual.html similarity index 100% rename from test/server-side-rendering/entities/_actual.html rename to test/server-side-rendering/samples/entities/_actual.html diff --git a/test/server-side-rendering/entities/_expected.html b/test/server-side-rendering/samples/entities/_expected.html similarity index 100% rename from test/server-side-rendering/entities/_expected.html rename to test/server-side-rendering/samples/entities/_expected.html diff --git a/test/server-side-rendering/entities/data.json b/test/server-side-rendering/samples/entities/data.json similarity index 100% rename from test/server-side-rendering/entities/data.json rename to test/server-side-rendering/samples/entities/data.json diff --git a/test/server-side-rendering/entities/main.html b/test/server-side-rendering/samples/entities/main.html similarity index 100% rename from test/server-side-rendering/entities/main.html rename to test/server-side-rendering/samples/entities/main.html diff --git a/test/server-side-rendering/helpers/_actual.html b/test/server-side-rendering/samples/helpers/_actual.html similarity index 100% rename from test/server-side-rendering/helpers/_actual.html rename to test/server-side-rendering/samples/helpers/_actual.html diff --git a/test/server-side-rendering/helpers/_expected.html b/test/server-side-rendering/samples/helpers/_expected.html similarity index 100% rename from test/server-side-rendering/helpers/_expected.html rename to test/server-side-rendering/samples/helpers/_expected.html diff --git a/test/server-side-rendering/helpers/main.html b/test/server-side-rendering/samples/helpers/main.html similarity index 100% rename from test/server-side-rendering/helpers/main.html rename to test/server-side-rendering/samples/helpers/main.html diff --git a/test/server-side-rendering/if-block-false/_actual.html b/test/server-side-rendering/samples/if-block-false/_actual.html similarity index 100% rename from test/server-side-rendering/if-block-false/_actual.html rename to test/server-side-rendering/samples/if-block-false/_actual.html diff --git a/test/server-side-rendering/if-block-false/_expected.html b/test/server-side-rendering/samples/if-block-false/_expected.html similarity index 100% rename from test/server-side-rendering/if-block-false/_expected.html rename to test/server-side-rendering/samples/if-block-false/_expected.html diff --git a/test/server-side-rendering/if-block-false/data.json b/test/server-side-rendering/samples/if-block-false/data.json similarity index 100% rename from test/server-side-rendering/if-block-false/data.json rename to test/server-side-rendering/samples/if-block-false/data.json diff --git a/test/server-side-rendering/if-block-false/main.html b/test/server-side-rendering/samples/if-block-false/main.html similarity index 100% rename from test/server-side-rendering/if-block-false/main.html rename to test/server-side-rendering/samples/if-block-false/main.html diff --git a/test/server-side-rendering/if-block-true/_actual.html b/test/server-side-rendering/samples/if-block-true/_actual.html similarity index 100% rename from test/server-side-rendering/if-block-true/_actual.html rename to test/server-side-rendering/samples/if-block-true/_actual.html diff --git a/test/server-side-rendering/if-block-true/_expected.html b/test/server-side-rendering/samples/if-block-true/_expected.html similarity index 100% rename from test/server-side-rendering/if-block-true/_expected.html rename to test/server-side-rendering/samples/if-block-true/_expected.html diff --git a/test/server-side-rendering/if-block-true/data.json b/test/server-side-rendering/samples/if-block-true/data.json similarity index 100% rename from test/server-side-rendering/if-block-true/data.json rename to test/server-side-rendering/samples/if-block-true/data.json diff --git a/test/server-side-rendering/if-block-true/main.html b/test/server-side-rendering/samples/if-block-true/main.html similarity index 100% rename from test/server-side-rendering/if-block-true/main.html rename to test/server-side-rendering/samples/if-block-true/main.html diff --git a/test/server-side-rendering/import-non-component/_actual.html b/test/server-side-rendering/samples/import-non-component/_actual.html similarity index 100% rename from test/server-side-rendering/import-non-component/_actual.html rename to test/server-side-rendering/samples/import-non-component/_actual.html diff --git a/test/server-side-rendering/import-non-component/_expected.html b/test/server-side-rendering/samples/import-non-component/_expected.html similarity index 100% rename from test/server-side-rendering/import-non-component/_expected.html rename to test/server-side-rendering/samples/import-non-component/_expected.html diff --git a/test/server-side-rendering/import-non-component/answer.js b/test/server-side-rendering/samples/import-non-component/answer.js similarity index 100% rename from test/server-side-rendering/import-non-component/answer.js rename to test/server-side-rendering/samples/import-non-component/answer.js diff --git a/test/server-side-rendering/import-non-component/main.html b/test/server-side-rendering/samples/import-non-component/main.html similarity index 100% rename from test/server-side-rendering/import-non-component/main.html rename to test/server-side-rendering/samples/import-non-component/main.html diff --git a/test/server-side-rendering/import-non-component/problems.js b/test/server-side-rendering/samples/import-non-component/problems.js similarity index 100% rename from test/server-side-rendering/import-non-component/problems.js rename to test/server-side-rendering/samples/import-non-component/problems.js diff --git a/test/server-side-rendering/raw-mustaches/_actual.html b/test/server-side-rendering/samples/raw-mustaches/_actual.html similarity index 100% rename from test/server-side-rendering/raw-mustaches/_actual.html rename to test/server-side-rendering/samples/raw-mustaches/_actual.html diff --git a/test/server-side-rendering/raw-mustaches/_expected.html b/test/server-side-rendering/samples/raw-mustaches/_expected.html similarity index 100% rename from test/server-side-rendering/raw-mustaches/_expected.html rename to test/server-side-rendering/samples/raw-mustaches/_expected.html diff --git a/test/server-side-rendering/raw-mustaches/data.json b/test/server-side-rendering/samples/raw-mustaches/data.json similarity index 100% rename from test/server-side-rendering/raw-mustaches/data.json rename to test/server-side-rendering/samples/raw-mustaches/data.json diff --git a/test/server-side-rendering/raw-mustaches/main.html b/test/server-side-rendering/samples/raw-mustaches/main.html similarity index 100% rename from test/server-side-rendering/raw-mustaches/main.html rename to test/server-side-rendering/samples/raw-mustaches/main.html diff --git a/test/server-side-rendering/static-div/_actual.html b/test/server-side-rendering/samples/static-div/_actual.html similarity index 100% rename from test/server-side-rendering/static-div/_actual.html rename to test/server-side-rendering/samples/static-div/_actual.html diff --git a/test/server-side-rendering/static-div/_expected.html b/test/server-side-rendering/samples/static-div/_expected.html similarity index 100% rename from test/server-side-rendering/static-div/_expected.html rename to test/server-side-rendering/samples/static-div/_expected.html diff --git a/test/server-side-rendering/static-div/main.html b/test/server-side-rendering/samples/static-div/main.html similarity index 100% rename from test/server-side-rendering/static-div/main.html rename to test/server-side-rendering/samples/static-div/main.html diff --git a/test/server-side-rendering/static-text/_actual.html b/test/server-side-rendering/samples/static-text/_actual.html similarity index 100% rename from test/server-side-rendering/static-text/_actual.html rename to test/server-side-rendering/samples/static-text/_actual.html diff --git a/test/server-side-rendering/static-text/_expected.html b/test/server-side-rendering/samples/static-text/_expected.html similarity index 100% rename from test/server-side-rendering/static-text/_expected.html rename to test/server-side-rendering/samples/static-text/_expected.html diff --git a/test/server-side-rendering/static-text/main.html b/test/server-side-rendering/samples/static-text/main.html similarity index 100% rename from test/server-side-rendering/static-text/main.html rename to test/server-side-rendering/samples/static-text/main.html diff --git a/test/server-side-rendering/styles-nested/One.html b/test/server-side-rendering/samples/styles-nested/One.html similarity index 100% rename from test/server-side-rendering/styles-nested/One.html rename to test/server-side-rendering/samples/styles-nested/One.html diff --git a/test/server-side-rendering/styles-nested/Two.html b/test/server-side-rendering/samples/styles-nested/Two.html similarity index 100% rename from test/server-side-rendering/styles-nested/Two.html rename to test/server-side-rendering/samples/styles-nested/Two.html diff --git a/test/server-side-rendering/styles-nested/_actual.css b/test/server-side-rendering/samples/styles-nested/_actual.css similarity index 100% rename from test/server-side-rendering/styles-nested/_actual.css rename to test/server-side-rendering/samples/styles-nested/_actual.css diff --git a/test/server-side-rendering/styles-nested/_actual.html b/test/server-side-rendering/samples/styles-nested/_actual.html similarity index 100% rename from test/server-side-rendering/styles-nested/_actual.html rename to test/server-side-rendering/samples/styles-nested/_actual.html diff --git a/test/server-side-rendering/styles-nested/_expected.css b/test/server-side-rendering/samples/styles-nested/_expected.css similarity index 100% rename from test/server-side-rendering/styles-nested/_expected.css rename to test/server-side-rendering/samples/styles-nested/_expected.css diff --git a/test/server-side-rendering/styles-nested/_expected.html b/test/server-side-rendering/samples/styles-nested/_expected.html similarity index 100% rename from test/server-side-rendering/styles-nested/_expected.html rename to test/server-side-rendering/samples/styles-nested/_expected.html diff --git a/test/server-side-rendering/styles-nested/main.html b/test/server-side-rendering/samples/styles-nested/main.html similarity index 100% rename from test/server-side-rendering/styles-nested/main.html rename to test/server-side-rendering/samples/styles-nested/main.html diff --git a/test/server-side-rendering/styles/_actual.css b/test/server-side-rendering/samples/styles/_actual.css similarity index 100% rename from test/server-side-rendering/styles/_actual.css rename to test/server-side-rendering/samples/styles/_actual.css diff --git a/test/server-side-rendering/styles/_actual.html b/test/server-side-rendering/samples/styles/_actual.html similarity index 100% rename from test/server-side-rendering/styles/_actual.html rename to test/server-side-rendering/samples/styles/_actual.html diff --git a/test/server-side-rendering/styles/_expected.css b/test/server-side-rendering/samples/styles/_expected.css similarity index 100% rename from test/server-side-rendering/styles/_expected.css rename to test/server-side-rendering/samples/styles/_expected.css diff --git a/test/server-side-rendering/styles/_expected.html b/test/server-side-rendering/samples/styles/_expected.html similarity index 100% rename from test/server-side-rendering/styles/_expected.html rename to test/server-side-rendering/samples/styles/_expected.html diff --git a/test/server-side-rendering/styles/main.html b/test/server-side-rendering/samples/styles/main.html similarity index 100% rename from test/server-side-rendering/styles/main.html rename to test/server-side-rendering/samples/styles/main.html diff --git a/test/server-side-rendering/triple/_actual.html b/test/server-side-rendering/samples/triple/_actual.html similarity index 100% rename from test/server-side-rendering/triple/_actual.html rename to test/server-side-rendering/samples/triple/_actual.html diff --git a/test/server-side-rendering/triple/_expected.html b/test/server-side-rendering/samples/triple/_expected.html similarity index 100% rename from test/server-side-rendering/triple/_expected.html rename to test/server-side-rendering/samples/triple/_expected.html diff --git a/test/server-side-rendering/triple/main.html b/test/server-side-rendering/samples/triple/main.html similarity index 100% rename from test/server-side-rendering/triple/main.html rename to test/server-side-rendering/samples/triple/main.html diff --git a/test/setup.js b/test/setup.js new file mode 100644 index 000000000000..c51e5d75e649 --- /dev/null +++ b/test/setup.js @@ -0,0 +1,9 @@ +const nodeVersionMatch = /^v(\d)/.exec( process.version ); +const legacy = +nodeVersionMatch[1] < 6; +const babelrc = require( '../package.json' ).babel; + +if ( legacy ) { + require( 'babel-register' )( babelrc ); +} else { + require( 'reify' ); +} \ No newline at end of file diff --git a/test/sourcemaps.js b/test/sourcemaps/index.js similarity index 71% rename from test/sourcemaps.js rename to test/sourcemaps/index.js index 80d5edb315ef..986630c14d3f 100644 --- a/test/sourcemaps.js +++ b/test/sourcemaps/index.js @@ -1,23 +1,23 @@ import * as fs from 'fs'; import * as path from 'path'; import assert from 'assert'; -import { svelte, exists } from './helpers.js'; +import { svelte, exists } from '../helpers.js'; import { SourceMapConsumer } from 'source-map'; import { getLocator } from 'locate-character'; describe( 'sourcemaps', () => { - fs.readdirSync( 'test/sourcemaps' ).forEach( dir => { + fs.readdirSync( 'test/sourcemaps/samples' ).forEach( dir => { if ( dir[0] === '.' ) return; - const solo = exists( `test/sourcemaps/${dir}/solo` ); + const solo = exists( `test/sourcemaps/samples/${dir}/solo` ); if ( solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); } ( solo ? it.only : it )( dir, () => { - const filename = path.resolve( `test/sourcemaps/${dir}/input.html` ); - const outputFilename = path.resolve( `test/sourcemaps/${dir}/output.js` ); + const filename = path.resolve( `test/sourcemaps/samples/${dir}/input.html` ); + const outputFilename = path.resolve( `test/sourcemaps/samples/${dir}/output.js` ); const input = fs.readFileSync( filename, 'utf-8' ).replace( /\s+$/, '' ); const { code, map } = svelte.compile( input, { @@ -30,7 +30,7 @@ describe( 'sourcemaps', () => { assert.deepEqual( map.sources, [ 'input.html' ]); - const { test } = require( `./sourcemaps/${dir}/test.js` ); + const { test } = require( `./samples/${dir}/test.js` ); const smc = new SourceMapConsumer( map ); diff --git a/test/sourcemaps/basic/input.html b/test/sourcemaps/samples/basic/input.html similarity index 100% rename from test/sourcemaps/basic/input.html rename to test/sourcemaps/samples/basic/input.html diff --git a/test/sourcemaps/samples/basic/output.js b/test/sourcemaps/samples/basic/output.js new file mode 100644 index 000000000000..6f8fe3ad76e8 --- /dev/null +++ b/test/sourcemaps/samples/basic/output.js @@ -0,0 +1,159 @@ +function renderMainFragment ( root, component ) { + var last_text = root.foo.bar.baz + var text = createText( last_text ); + + return { + mount: function ( target, anchor ) { + insertNode( text, target, anchor ); + }, + + update: function ( changed, root ) { + var __tmp; + + if ( ( __tmp = root.foo.bar.baz ) !== last_text ) { + text.data = last_text = __tmp; + } + }, + + teardown: function ( detach ) { + if ( detach ) { + detachNode( text ); + } + } + }; +} + +function SvelteComponent ( options ) { + options = options || {}; + this._state = options.data || {}; + + this._observers = { + pre: Object.create( null ), + post: Object.create( null ) + }; + + this._handlers = Object.create( null ); + + this._root = options._root; + this._yield = options._yield; + + this._torndown = false; + + this._fragment = renderMainFragment( this._state, this ); + if ( options.target ) this._fragment.mount( options.target, null ); +} + +SvelteComponent.prototype.get = function get(key) { + return key ? this._state[key] : this._state; + }; + +SvelteComponent.prototype.fire = function fire(eventName, data) { + var handlers = eventName in this._handlers && this._handlers[eventName].slice(); + if (!handlers) return; + + for (var i = 0; i < handlers.length; i += 1) { + handlers[i].call(this, data); + } + }; + +SvelteComponent.prototype.observe = function observe(key, callback, options) { + var group = options && options.defer ? this._observers.pre : this._observers.post; + + (group[key] || (group[key] = [])).push(callback); + + if (!options || options.init !== false) { + callback.__calling = true; + callback.call(this, this._state[key]); + callback.__calling = false; + } + + return { + cancel: function () { + var index = group[key].indexOf(callback); + if (~index) group[key].splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.on = function on(eventName, handler) { + var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); + handlers.push(handler); + + return { + cancel: function () { + var index = handlers.indexOf(handler); + if (~index) handlers.splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.set = function set(newState) { + this._set(newState); + (this._root || this)._flush(); + }; + +SvelteComponent.prototype._flush = function _flush() { + if (!this._renderHooks) return; + + while (this._renderHooks.length) { + var hook = this._renderHooks.pop(); + hook.fn.call(hook.context); + } + }; + +SvelteComponent.prototype._set = function _set ( newState ) { + var oldState = this._state; + this._state = Object.assign( {}, oldState, newState ); + + dispatchObservers( this, this._observers.pre, newState, oldState ); + if ( this._fragment ) this._fragment.update( newState, this._state ); + dispatchObservers( this, this._observers.post, newState, oldState ); +}; + +SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = function destroy ( detach ) { + this.fire( 'teardown' ); + + this._fragment.teardown( detach !== false ); + this._fragment = null; + + this._state = {}; + this._torndown = true; +}; + +function createText(data) { + return document.createTextNode(data); + } + +function insertNode(node, target, anchor) { + target.insertBefore(node, anchor); + } + +function detachNode(node) { + node.parentNode.removeChild(node); + } + +function dispatchObservers(component, group, newState, oldState) { + for (var key in group) { + if (!(key in newState)) continue; + + var newValue = newState[key]; + var oldValue = oldState[key]; + + if (newValue === oldValue && typeof newValue !== 'object') continue; + + var callbacks = group[key]; + if (!callbacks) continue; + + for (var i = 0; i < callbacks.length; i += 1) { + var callback = callbacks[i]; + if (callback.__calling) continue; + + callback.__calling = true; + callback.call(component, newValue, oldValue); + callback.__calling = false; + } + } + } + +export default SvelteComponent; +//# sourceMappingURL=output.js.map \ No newline at end of file diff --git a/test/sourcemaps/samples/basic/output.js.map b/test/sourcemaps/samples/basic/output.js.map new file mode 100644 index 000000000000..62ae043b0b33 --- /dev/null +++ b/test/sourcemaps/samples/basic/output.js.map @@ -0,0 +1,12 @@ +{ + "version": 3, + "file": "output.js", + "sources": [ + "input.html" + ], + "sourcesContent": [ + "{{foo.bar.baz}}" + ], + "names": [], + "mappings": ";sBAAE,GAAG,CAAC,GAAG,CAAC,GAAG;;;;;;;;;;;uBAAX,GAAG,CAAC,GAAG,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" +} \ No newline at end of file diff --git a/test/sourcemaps/basic/test.js b/test/sourcemaps/samples/basic/test.js similarity index 100% rename from test/sourcemaps/basic/test.js rename to test/sourcemaps/samples/basic/test.js diff --git a/test/sourcemaps/script/input.html b/test/sourcemaps/samples/script/input.html similarity index 100% rename from test/sourcemaps/script/input.html rename to test/sourcemaps/samples/script/input.html diff --git a/test/sourcemaps/samples/script/output.js b/test/sourcemaps/samples/script/output.js new file mode 100644 index 000000000000..e45976603787 --- /dev/null +++ b/test/sourcemaps/samples/script/output.js @@ -0,0 +1,168 @@ +var template = (function () { + return { + oncreate () { + console.log( 42 ); + } + } +}()); + +function renderMainFragment ( root, component ) { + var div = createElement( 'div' ); + + return { + mount: function ( target, anchor ) { + insertNode( div, target, anchor ); + }, + + update: noop, + + teardown: function ( detach ) { + if ( detach ) { + detachNode( div ); + } + } + }; +} + +function SvelteComponent ( options ) { + options = options || {}; + this._state = options.data || {}; + + this._observers = { + pre: Object.create( null ), + post: Object.create( null ) + }; + + this._handlers = Object.create( null ); + + this._root = options._root; + this._yield = options._yield; + + this._torndown = false; + + this._fragment = renderMainFragment( this._state, this ); + if ( options.target ) this._fragment.mount( options.target, null ); + + if ( options._root ) { + options._root._renderHooks.push({ fn: template.oncreate, context: this }); + } else { + template.oncreate.call( this ); + } +} + +SvelteComponent.prototype.get = function get(key) { + return key ? this._state[key] : this._state; + }; + +SvelteComponent.prototype.fire = function fire(eventName, data) { + var handlers = eventName in this._handlers && this._handlers[eventName].slice(); + if (!handlers) return; + + for (var i = 0; i < handlers.length; i += 1) { + handlers[i].call(this, data); + } + }; + +SvelteComponent.prototype.observe = function observe(key, callback, options) { + var group = options && options.defer ? this._observers.pre : this._observers.post; + + (group[key] || (group[key] = [])).push(callback); + + if (!options || options.init !== false) { + callback.__calling = true; + callback.call(this, this._state[key]); + callback.__calling = false; + } + + return { + cancel: function () { + var index = group[key].indexOf(callback); + if (~index) group[key].splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.on = function on(eventName, handler) { + var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); + handlers.push(handler); + + return { + cancel: function () { + var index = handlers.indexOf(handler); + if (~index) handlers.splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.set = function set(newState) { + this._set(newState); + (this._root || this)._flush(); + }; + +SvelteComponent.prototype._flush = function _flush() { + if (!this._renderHooks) return; + + while (this._renderHooks.length) { + var hook = this._renderHooks.pop(); + hook.fn.call(hook.context); + } + }; + +SvelteComponent.prototype._set = function _set ( newState ) { + var oldState = this._state; + this._state = Object.assign( {}, oldState, newState ); + + dispatchObservers( this, this._observers.pre, newState, oldState ); + if ( this._fragment ) this._fragment.update( newState, this._state ); + dispatchObservers( this, this._observers.post, newState, oldState ); +}; + +SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = function destroy ( detach ) { + this.fire( 'teardown' ); + + this._fragment.teardown( detach !== false ); + this._fragment = null; + + this._state = {}; + this._torndown = true; +}; + +function createElement(name) { + return document.createElement(name); + } + +function detachNode(node) { + node.parentNode.removeChild(node); + } + +function insertNode(node, target, anchor) { + target.insertBefore(node, anchor); + } + +function noop() {} + +function dispatchObservers(component, group, newState, oldState) { + for (var key in group) { + if (!(key in newState)) continue; + + var newValue = newState[key]; + var oldValue = oldState[key]; + + if (newValue === oldValue && typeof newValue !== 'object') continue; + + var callbacks = group[key]; + if (!callbacks) continue; + + for (var i = 0; i < callbacks.length; i += 1) { + var callback = callbacks[i]; + if (callback.__calling) continue; + + callback.__calling = true; + callback.call(component, newValue, oldValue); + callback.__calling = false; + } + } + } + +export default SvelteComponent; +//# sourceMappingURL=output.js.map \ No newline at end of file diff --git a/test/sourcemaps/samples/script/output.js.map b/test/sourcemaps/samples/script/output.js.map new file mode 100644 index 000000000000..28d223637ab9 --- /dev/null +++ b/test/sourcemaps/samples/script/output.js.map @@ -0,0 +1,12 @@ +{ + "version": 3, + "file": "output.js", + "sources": [ + "input.html" + ], + "sourcesContent": [ + "
\n\n" + ], + "names": [], + "mappings": "6BAEQ;CACP,OAAe;EACd,QAAQ,CAAC,GAAG;GACX,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;GAClB;EACD;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" +} \ No newline at end of file diff --git a/test/sourcemaps/script/test.js b/test/sourcemaps/samples/script/test.js similarity index 100% rename from test/sourcemaps/script/test.js rename to test/sourcemaps/samples/script/test.js diff --git a/test/sourcemaps/static-no-script/input.html b/test/sourcemaps/samples/static-no-script/input.html similarity index 100% rename from test/sourcemaps/static-no-script/input.html rename to test/sourcemaps/samples/static-no-script/input.html diff --git a/test/sourcemaps/samples/static-no-script/output.js b/test/sourcemaps/samples/static-no-script/output.js new file mode 100644 index 000000000000..2f8fa77c422f --- /dev/null +++ b/test/sourcemaps/samples/static-no-script/output.js @@ -0,0 +1,164 @@ +function renderMainFragment ( root, component ) { + var p = createElement( 'p' ); + + appendNode( createText( "no moving parts" ), p ); + + return { + mount: function ( target, anchor ) { + insertNode( p, target, anchor ); + }, + + update: noop, + + teardown: function ( detach ) { + if ( detach ) { + detachNode( p ); + } + } + }; +} + +function SvelteComponent ( options ) { + options = options || {}; + this._state = options.data || {}; + + this._observers = { + pre: Object.create( null ), + post: Object.create( null ) + }; + + this._handlers = Object.create( null ); + + this._root = options._root; + this._yield = options._yield; + + this._torndown = false; + + this._fragment = renderMainFragment( this._state, this ); + if ( options.target ) this._fragment.mount( options.target, null ); +} + +SvelteComponent.prototype.get = function get(key) { + return key ? this._state[key] : this._state; + }; + +SvelteComponent.prototype.fire = function fire(eventName, data) { + var handlers = eventName in this._handlers && this._handlers[eventName].slice(); + if (!handlers) return; + + for (var i = 0; i < handlers.length; i += 1) { + handlers[i].call(this, data); + } + }; + +SvelteComponent.prototype.observe = function observe(key, callback, options) { + var group = options && options.defer ? this._observers.pre : this._observers.post; + + (group[key] || (group[key] = [])).push(callback); + + if (!options || options.init !== false) { + callback.__calling = true; + callback.call(this, this._state[key]); + callback.__calling = false; + } + + return { + cancel: function () { + var index = group[key].indexOf(callback); + if (~index) group[key].splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.on = function on(eventName, handler) { + var handlers = this._handlers[eventName] || (this._handlers[eventName] = []); + handlers.push(handler); + + return { + cancel: function () { + var index = handlers.indexOf(handler); + if (~index) handlers.splice(index, 1); + } + }; + }; + +SvelteComponent.prototype.set = function set(newState) { + this._set(newState); + (this._root || this)._flush(); + }; + +SvelteComponent.prototype._flush = function _flush() { + if (!this._renderHooks) return; + + while (this._renderHooks.length) { + var hook = this._renderHooks.pop(); + hook.fn.call(hook.context); + } + }; + +SvelteComponent.prototype._set = function _set ( newState ) { + var oldState = this._state; + this._state = Object.assign( {}, oldState, newState ); + + dispatchObservers( this, this._observers.pre, newState, oldState ); + if ( this._fragment ) this._fragment.update( newState, this._state ); + dispatchObservers( this, this._observers.post, newState, oldState ); +}; + +SvelteComponent.prototype.teardown = SvelteComponent.prototype.destroy = function destroy ( detach ) { + this.fire( 'teardown' ); + + this._fragment.teardown( detach !== false ); + this._fragment = null; + + this._state = {}; + this._torndown = true; +}; + +function createElement(name) { + return document.createElement(name); + } + +function detachNode(node) { + node.parentNode.removeChild(node); + } + +function insertNode(node, target, anchor) { + target.insertBefore(node, anchor); + } + +function createText(data) { + return document.createTextNode(data); + } + +function appendNode(node, target) { + target.appendChild(node); + } + +function noop() {} + +function dispatchObservers(component, group, newState, oldState) { + for (var key in group) { + if (!(key in newState)) continue; + + var newValue = newState[key]; + var oldValue = oldState[key]; + + if (newValue === oldValue && typeof newValue !== 'object') continue; + + var callbacks = group[key]; + if (!callbacks) continue; + + for (var i = 0; i < callbacks.length; i += 1) { + var callback = callbacks[i]; + if (callback.__calling) continue; + + callback.__calling = true; + callback.call(component, newValue, oldValue); + callback.__calling = false; + } + } + } + +export default SvelteComponent; +//# sourceMappingURL=output.js.map \ No newline at end of file diff --git a/test/sourcemaps/samples/static-no-script/output.js.map b/test/sourcemaps/samples/static-no-script/output.js.map new file mode 100644 index 000000000000..0db89b390933 --- /dev/null +++ b/test/sourcemaps/samples/static-no-script/output.js.map @@ -0,0 +1,12 @@ +{ + "version": 3, + "file": "output.js", + "sources": [ + "input.html" + ], + "sourcesContent": [ + "

no moving parts

" + ], + "names": [], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" +} \ No newline at end of file diff --git a/test/sourcemaps/static-no-script/test.js b/test/sourcemaps/samples/static-no-script/test.js similarity index 100% rename from test/sourcemaps/static-no-script/test.js rename to test/sourcemaps/samples/static-no-script/test.js diff --git a/test/test.js b/test/test.js new file mode 100644 index 000000000000..36cbe00280fd --- /dev/null +++ b/test/test.js @@ -0,0 +1,11 @@ +const glob = require( 'glob' ); + +require( './setup' ); + +glob.sync( '**/__test__.js', { cwd: 'src' }).forEach( function ( file ) { + require( '../src/' + file ); +}); + +glob.sync( '*/index.js', { cwd: 'test' }).forEach( function ( file ) { + require( './' + file ); +}); \ No newline at end of file diff --git a/test/validate.js b/test/validator/index.js similarity index 71% rename from test/validate.js rename to test/validator/index.js index 1545d51701bf..bfff108937e8 100644 --- a/test/validate.js +++ b/test/validator/index.js @@ -1,19 +1,19 @@ import * as fs from 'fs'; import assert from 'assert'; -import { svelte, exists, tryToLoadJson } from './helpers.js'; +import { svelte, exists, tryToLoadJson } from '../helpers.js'; describe( 'validate', () => { - fs.readdirSync( 'test/validator' ).forEach( dir => { + fs.readdirSync( 'test/validator/samples' ).forEach( dir => { if ( dir[0] === '.' ) return; - const solo = exists( `test/validator/${dir}/solo` ); + const solo = exists( `test/validator/samples/${dir}/solo` ); if ( solo && process.env.CI ) { throw new Error( 'Forgot to remove `solo: true` from test' ); } ( solo ? it.only : it )( dir, () => { - const filename = `test/validator/${dir}/input.html`; + const filename = `test/validator/samples/${dir}/input.html`; const input = fs.readFileSync( filename, 'utf-8' ).replace( /\s+$/, '' ); try { @@ -40,9 +40,9 @@ describe( 'validate', () => { } }); - const expectedErrors = tryToLoadJson( `test/validator/${dir}/errors.json` ) || []; - const expectedWarnings = tryToLoadJson( `test/validator/${dir}/warnings.json` ) || []; - const expectedNames = tryToLoadJson( `test/validator/${dir}/names.json` ); + const expectedErrors = tryToLoadJson( `test/validator/samples/${dir}/errors.json` ) || []; + const expectedWarnings = tryToLoadJson( `test/validator/samples/${dir}/warnings.json` ) || []; + const expectedNames = tryToLoadJson( `test/validator/samples/${dir}/names.json` ); assert.deepEqual( errors, expectedErrors ); assert.deepEqual( warnings, expectedWarnings ); @@ -53,7 +53,7 @@ describe( 'validate', () => { if ( err.name !== 'ParseError' ) throw err; try { - const expected = require( `./validator/${dir}/errors.json` )[0]; + const expected = require( `./samples/${dir}/errors.json` )[0]; assert.equal( err.message, expected.message ); assert.deepEqual( err.loc, expected.loc ); diff --git a/test/validator/export-default-duplicated/errors.json b/test/validator/samples/export-default-duplicated/errors.json similarity index 100% rename from test/validator/export-default-duplicated/errors.json rename to test/validator/samples/export-default-duplicated/errors.json diff --git a/test/validator/export-default-duplicated/input.html b/test/validator/samples/export-default-duplicated/input.html similarity index 100% rename from test/validator/export-default-duplicated/input.html rename to test/validator/samples/export-default-duplicated/input.html diff --git a/test/validator/export-default-must-be-object/errors.json b/test/validator/samples/export-default-must-be-object/errors.json similarity index 100% rename from test/validator/export-default-must-be-object/errors.json rename to test/validator/samples/export-default-must-be-object/errors.json diff --git a/test/validator/export-default-must-be-object/input.html b/test/validator/samples/export-default-must-be-object/input.html similarity index 100% rename from test/validator/export-default-must-be-object/input.html rename to test/validator/samples/export-default-must-be-object/input.html diff --git a/test/validator/method-arrow-no-this/errors.json b/test/validator/samples/method-arrow-no-this/errors.json similarity index 100% rename from test/validator/method-arrow-no-this/errors.json rename to test/validator/samples/method-arrow-no-this/errors.json diff --git a/test/validator/method-arrow-no-this/input.html b/test/validator/samples/method-arrow-no-this/input.html similarity index 100% rename from test/validator/method-arrow-no-this/input.html rename to test/validator/samples/method-arrow-no-this/input.html diff --git a/test/validator/method-arrow-this/errors.json b/test/validator/samples/method-arrow-this/errors.json similarity index 100% rename from test/validator/method-arrow-this/errors.json rename to test/validator/samples/method-arrow-this/errors.json diff --git a/test/validator/method-arrow-this/input.html b/test/validator/samples/method-arrow-this/input.html similarity index 100% rename from test/validator/method-arrow-this/input.html rename to test/validator/samples/method-arrow-this/input.html diff --git a/test/validator/named-export/errors.json b/test/validator/samples/named-export/errors.json similarity index 100% rename from test/validator/named-export/errors.json rename to test/validator/samples/named-export/errors.json diff --git a/test/validator/named-export/input.html b/test/validator/samples/named-export/input.html similarity index 100% rename from test/validator/named-export/input.html rename to test/validator/samples/named-export/input.html diff --git a/test/validator/names/input.html b/test/validator/samples/names/input.html similarity index 100% rename from test/validator/names/input.html rename to test/validator/samples/names/input.html diff --git a/test/validator/names/names.json b/test/validator/samples/names/names.json similarity index 100% rename from test/validator/names/names.json rename to test/validator/samples/names/names.json diff --git a/test/validator/oncreate-arrow-no-this/errors.json b/test/validator/samples/oncreate-arrow-no-this/errors.json similarity index 100% rename from test/validator/oncreate-arrow-no-this/errors.json rename to test/validator/samples/oncreate-arrow-no-this/errors.json diff --git a/test/validator/oncreate-arrow-no-this/input.html b/test/validator/samples/oncreate-arrow-no-this/input.html similarity index 100% rename from test/validator/oncreate-arrow-no-this/input.html rename to test/validator/samples/oncreate-arrow-no-this/input.html diff --git a/test/validator/oncreate-arrow-this/errors.json b/test/validator/samples/oncreate-arrow-this/errors.json similarity index 100% rename from test/validator/oncreate-arrow-this/errors.json rename to test/validator/samples/oncreate-arrow-this/errors.json diff --git a/test/validator/oncreate-arrow-this/input.html b/test/validator/samples/oncreate-arrow-this/input.html similarity index 100% rename from test/validator/oncreate-arrow-this/input.html rename to test/validator/samples/oncreate-arrow-this/input.html diff --git a/test/validator/ondestroy-arrow-no-this/errors.json b/test/validator/samples/ondestroy-arrow-no-this/errors.json similarity index 100% rename from test/validator/ondestroy-arrow-no-this/errors.json rename to test/validator/samples/ondestroy-arrow-no-this/errors.json diff --git a/test/validator/ondestroy-arrow-no-this/input.html b/test/validator/samples/ondestroy-arrow-no-this/input.html similarity index 100% rename from test/validator/ondestroy-arrow-no-this/input.html rename to test/validator/samples/ondestroy-arrow-no-this/input.html diff --git a/test/validator/ondestroy-arrow-this/errors.json b/test/validator/samples/ondestroy-arrow-this/errors.json similarity index 100% rename from test/validator/ondestroy-arrow-this/errors.json rename to test/validator/samples/ondestroy-arrow-this/errors.json diff --git a/test/validator/ondestroy-arrow-this/input.html b/test/validator/samples/ondestroy-arrow-this/input.html similarity index 100% rename from test/validator/ondestroy-arrow-this/input.html rename to test/validator/samples/ondestroy-arrow-this/input.html diff --git a/test/validator/properties-components-should-be-capitalised/input.html b/test/validator/samples/properties-components-should-be-capitalised/input.html similarity index 100% rename from test/validator/properties-components-should-be-capitalised/input.html rename to test/validator/samples/properties-components-should-be-capitalised/input.html diff --git a/test/validator/properties-components-should-be-capitalised/warnings.json b/test/validator/samples/properties-components-should-be-capitalised/warnings.json similarity index 100% rename from test/validator/properties-components-should-be-capitalised/warnings.json rename to test/validator/samples/properties-components-should-be-capitalised/warnings.json diff --git a/test/validator/properties-computed-must-be-an-object/errors.json b/test/validator/samples/properties-computed-must-be-an-object/errors.json similarity index 100% rename from test/validator/properties-computed-must-be-an-object/errors.json rename to test/validator/samples/properties-computed-must-be-an-object/errors.json diff --git a/test/validator/properties-computed-must-be-an-object/input.html b/test/validator/samples/properties-computed-must-be-an-object/input.html similarity index 100% rename from test/validator/properties-computed-must-be-an-object/input.html rename to test/validator/samples/properties-computed-must-be-an-object/input.html diff --git a/test/validator/properties-computed-must-be-functions/errors.json b/test/validator/samples/properties-computed-must-be-functions/errors.json similarity index 100% rename from test/validator/properties-computed-must-be-functions/errors.json rename to test/validator/samples/properties-computed-must-be-functions/errors.json diff --git a/test/validator/properties-computed-must-be-functions/input.html b/test/validator/samples/properties-computed-must-be-functions/input.html similarity index 100% rename from test/validator/properties-computed-must-be-functions/input.html rename to test/validator/samples/properties-computed-must-be-functions/input.html diff --git a/test/validator/properties-computed-no-destructuring/errors.json b/test/validator/samples/properties-computed-no-destructuring/errors.json similarity index 100% rename from test/validator/properties-computed-no-destructuring/errors.json rename to test/validator/samples/properties-computed-no-destructuring/errors.json diff --git a/test/validator/properties-computed-no-destructuring/input.html b/test/validator/samples/properties-computed-no-destructuring/input.html similarity index 100% rename from test/validator/properties-computed-no-destructuring/input.html rename to test/validator/samples/properties-computed-no-destructuring/input.html diff --git a/test/validator/properties-computed-values-needs-arguments/errors.json b/test/validator/samples/properties-computed-values-needs-arguments/errors.json similarity index 100% rename from test/validator/properties-computed-values-needs-arguments/errors.json rename to test/validator/samples/properties-computed-values-needs-arguments/errors.json diff --git a/test/validator/properties-computed-values-needs-arguments/input.html b/test/validator/samples/properties-computed-values-needs-arguments/input.html similarity index 100% rename from test/validator/properties-computed-values-needs-arguments/input.html rename to test/validator/samples/properties-computed-values-needs-arguments/input.html diff --git a/test/validator/properties-data-must-be-function/errors.json b/test/validator/samples/properties-data-must-be-function/errors.json similarity index 100% rename from test/validator/properties-data-must-be-function/errors.json rename to test/validator/samples/properties-data-must-be-function/errors.json diff --git a/test/validator/properties-data-must-be-function/input.html b/test/validator/samples/properties-data-must-be-function/input.html similarity index 100% rename from test/validator/properties-data-must-be-function/input.html rename to test/validator/samples/properties-data-must-be-function/input.html diff --git a/test/validator/properties-duplicated/errors.json b/test/validator/samples/properties-duplicated/errors.json similarity index 100% rename from test/validator/properties-duplicated/errors.json rename to test/validator/samples/properties-duplicated/errors.json diff --git a/test/validator/properties-duplicated/input.html b/test/validator/samples/properties-duplicated/input.html similarity index 100% rename from test/validator/properties-duplicated/input.html rename to test/validator/samples/properties-duplicated/input.html diff --git a/test/validator/properties-unexpected-b/errors.json b/test/validator/samples/properties-unexpected-b/errors.json similarity index 100% rename from test/validator/properties-unexpected-b/errors.json rename to test/validator/samples/properties-unexpected-b/errors.json diff --git a/test/validator/properties-unexpected-b/input.html b/test/validator/samples/properties-unexpected-b/input.html similarity index 100% rename from test/validator/properties-unexpected-b/input.html rename to test/validator/samples/properties-unexpected-b/input.html diff --git a/test/validator/properties-unexpected/errors.json b/test/validator/samples/properties-unexpected/errors.json similarity index 100% rename from test/validator/properties-unexpected/errors.json rename to test/validator/samples/properties-unexpected/errors.json diff --git a/test/validator/properties-unexpected/input.html b/test/validator/samples/properties-unexpected/input.html similarity index 100% rename from test/validator/properties-unexpected/input.html rename to test/validator/samples/properties-unexpected/input.html diff --git a/test/validator/svg-child-component-declared-namespace/input.html b/test/validator/samples/svg-child-component-declared-namespace/input.html similarity index 100% rename from test/validator/svg-child-component-declared-namespace/input.html rename to test/validator/samples/svg-child-component-declared-namespace/input.html diff --git a/test/validator/svg-child-component-declared-namespace/warnings.json b/test/validator/samples/svg-child-component-declared-namespace/warnings.json similarity index 100% rename from test/validator/svg-child-component-declared-namespace/warnings.json rename to test/validator/samples/svg-child-component-declared-namespace/warnings.json diff --git a/test/validator/svg-child-component-undeclared-namespace/input.html b/test/validator/samples/svg-child-component-undeclared-namespace/input.html similarity index 100% rename from test/validator/svg-child-component-undeclared-namespace/input.html rename to test/validator/samples/svg-child-component-undeclared-namespace/input.html diff --git a/test/validator/svg-child-component-undeclared-namespace/warnings.json b/test/validator/samples/svg-child-component-undeclared-namespace/warnings.json similarity index 100% rename from test/validator/svg-child-component-undeclared-namespace/warnings.json rename to test/validator/samples/svg-child-component-undeclared-namespace/warnings.json