diff --git a/test/parser/index.js b/test/parser/index.js index 06383b975f..ee49ee8509 100644 --- a/test/parser/index.js +++ b/test/parser/index.js @@ -2,7 +2,7 @@ import assert from 'assert'; import fs from 'fs'; import { svelte, tryToLoadJson } from '../helpers.js'; -describe('parse', () => { +describe.only('parse', () => { fs.readdirSync('test/parser/samples').forEach(dir => { if (dir[0] === '.') return; @@ -18,48 +18,35 @@ describe('parse', () => { (solo ? it.only : it)(dir, () => { const options = tryToLoadJson(`test/parser/samples/${dir}/options.json`) || {}; - function test(options, input, expectedOutput, expectedError, outputFile) { + options.parser = 'v2'; // TODO remove + + const input = fs.readFileSync(`test/parser/samples/${dir}/input.html`, 'utf-8').replace(/\s+$/, ''); + const expectedOutput = tryToLoadJson(`test/parser/samples/${dir}/output.json`); + const expectedError = tryToLoadJson(`test/parser/samples/${dir}/error.json`); + + try { + const actual = svelte.parse(input, options); + + fs.writeFileSync(`test/parser/samples/${dir}/_actual.json`, JSON.stringify(actual, null, '\t')); + + assert.deepEqual(actual.html, expectedOutput.html); + assert.deepEqual(actual.css, expectedOutput.css); + assert.deepEqual(actual.js, expectedOutput.js); + } catch (err) { + if (err.name !== 'ParseError') throw err; + if (!expectedError) throw err; + try { - const actual = svelte.parse(input, options); - - fs.writeFileSync(outputFile, JSON.stringify(actual, null, '\t')); - - assert.deepEqual(actual.html, expectedOutput.html); - assert.deepEqual(actual.css, expectedOutput.css); - assert.deepEqual(actual.js, expectedOutput.js); - } catch (err) { - if (err.name !== 'ParseError') throw err; - if (!expectedError) throw err; - - try { - assert.equal(err.code, expectedError.code); - assert.equal(err.message, expectedError.message); - assert.deepEqual(err.loc, expectedError.loc); - assert.equal(err.pos, expectedError.pos); - assert.equal(err.toString().split('\n')[0], `${expectedError.message} (${expectedError.loc.line}:${expectedError.loc.column})`); - } catch (err2) { - const e = err2.code === 'MODULE_NOT_FOUND' ? err : err2; - throw e; - } + assert.equal(err.code, expectedError.code); + assert.equal(err.message, expectedError.message); + assert.deepEqual(err.loc, expectedError.loc); + assert.equal(err.pos, expectedError.pos); + assert.equal(err.toString().split('\n')[0], `${expectedError.message} (${expectedError.loc.line}:${expectedError.loc.column})`); + } catch (err2) { + const e = err2.code === 'MODULE_NOT_FOUND' ? err : err2; + throw e; } } - - // TODO remove v1 tests - test( - options, - fs.readFileSync(`test/parser/samples/${dir}/input.html`, 'utf-8').replace(/\s+$/, ''), - tryToLoadJson(`test/parser/samples/${dir}/output.json`), - tryToLoadJson(`test/parser/samples/${dir}/error.json`), - `test/parser/samples/${dir}/_actual.json` - ); - - test( - Object.assign({ parser: 'v2' }, options), - fs.readFileSync(`test/parser/samples/${dir}/input-v2.html`, 'utf-8').replace(/\s+$/, ''), - tryToLoadJson(`test/parser/samples/${dir}/output-v2.json`), - tryToLoadJson(`test/parser/samples/${dir}/error-v2.json`), - `test/parser/samples/${dir}/_actual-v2.json` - ); }); }); diff --git a/test/parser/samples/action-with-call/input-v2.html b/test/parser/samples/action-with-call/input-v2.html deleted file mode 100644 index 246bf02c59..0000000000 --- a/test/parser/samples/action-with-call/input-v2.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/parser/samples/action-with-call/output-v2.json b/test/parser/samples/action-with-call/output-v2.json deleted file mode 100644 index f5cc6824f3..0000000000 --- a/test/parser/samples/action-with-call/output-v2.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "hash": 1937205193, - "html": { - "start": 0, - "end": 38, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 38, - "type": "Element", - "name": "input", - "attributes": [ - { - "start": 7, - "end": 37, - "type": "Action", - "name": "tooltip", - "expression": { - "type": "CallExpression", - "start": 20, - "end": 36, - "callee": { - "type": "Identifier", - "start": 20, - "end": 21, - "name": "t" - }, - "arguments": [ - { - "type": "Literal", - "start": 22, - "end": 35, - "value": "tooltip msg", - "raw": "'tooltip msg'" - } - ] - } - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/action-with-identifier/input-v2.html b/test/parser/samples/action-with-identifier/input-v2.html deleted file mode 100644 index 14a65e83ed..0000000000 --- a/test/parser/samples/action-with-identifier/input-v2.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/parser/samples/action-with-identifier/output-v2.json b/test/parser/samples/action-with-identifier/output-v2.json deleted file mode 100644 index 6c39ed94bc..0000000000 --- a/test/parser/samples/action-with-identifier/output-v2.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "hash": 1937205193, - "html": { - "start": 0, - "end": 29, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 29, - "type": "Element", - "name": "input", - "attributes": [ - { - "start": 7, - "end": 28, - "type": "Action", - "name": "tooltip", - "expression": { - "type": "Identifier", - "start": 20, - "end": 27, - "name": "message" - } - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/action-with-literal/input-v2.html b/test/parser/samples/action-with-literal/input-v2.html deleted file mode 100644 index 60e16eacfc..0000000000 --- a/test/parser/samples/action-with-literal/input-v2.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/parser/samples/action-with-literal/output-v2.json b/test/parser/samples/action-with-literal/output-v2.json deleted file mode 100644 index 0da0318887..0000000000 --- a/test/parser/samples/action-with-literal/output-v2.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "hash": 1937205193, - "html": { - "start": 0, - "end": 35, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 35, - "type": "Element", - "name": "input", - "attributes": [ - { - "start": 7, - "end": 34, - "type": "Action", - "name": "tooltip", - "expression": { - "type": "Literal", - "start": 20, - "end": 33, - "value": "tooltip msg", - "raw": "'tooltip msg'" - } - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/action/input-v2.html b/test/parser/samples/action/input-v2.html deleted file mode 100644 index 64409c2a65..0000000000 --- a/test/parser/samples/action/input-v2.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/parser/samples/action/output-v2.json b/test/parser/samples/action/output-v2.json deleted file mode 100644 index 597ae297a5..0000000000 --- a/test/parser/samples/action/output-v2.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "hash": 1937205193, - "html": { - "start": 0, - "end": 21, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 21, - "type": "Element", - "name": "input", - "attributes": [ - { - "start": 7, - "end": 20, - "type": "Action", - "name": "autofocus", - "expression": null - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-boolean/input-v2.html b/test/parser/samples/attribute-dynamic-boolean/input-v2.html deleted file mode 100644 index ba531f2f81..0000000000 --- a/test/parser/samples/attribute-dynamic-boolean/input-v2.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/parser/samples/attribute-dynamic-boolean/input.html b/test/parser/samples/attribute-dynamic-boolean/input.html index 59683fecb1..ba531f2f81 100644 --- a/test/parser/samples/attribute-dynamic-boolean/input.html +++ b/test/parser/samples/attribute-dynamic-boolean/input.html @@ -1 +1 @@ - + diff --git a/test/parser/samples/attribute-dynamic-boolean/output-v2.json b/test/parser/samples/attribute-dynamic-boolean/output-v2.json deleted file mode 100644 index 4d08df34a0..0000000000 --- a/test/parser/samples/attribute-dynamic-boolean/output-v2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "hash": "7xolfv", - "html": { - "start": 0, - "end": 41, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 41, - "type": "Element", - "name": "textarea", - "attributes": [ - { - "start": 10, - "end": 29, - "type": "Attribute", - "name": "readonly", - "value": [ - { - "start": 19, - "end": 29, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 20, - "end": 28, - "name": "readonly" - } - } - ] - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-boolean/output.json b/test/parser/samples/attribute-dynamic-boolean/output.json index af1635a55d..4d08df34a0 100644 --- a/test/parser/samples/attribute-dynamic-boolean/output.json +++ b/test/parser/samples/attribute-dynamic-boolean/output.json @@ -1,30 +1,30 @@ { - "hash": 3179574701, + "hash": "7xolfv", "html": { "start": 0, - "end": 45, + "end": 41, "type": "Fragment", "children": [ { "start": 0, - "end": 45, + "end": 41, "type": "Element", "name": "textarea", "attributes": [ { "start": 10, - "end": 33, + "end": 29, "type": "Attribute", "name": "readonly", "value": [ { - "start": 20, - "end": 32, + "start": 19, + "end": 29, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 22, - "end": 30, + "start": 20, + "end": 28, "name": "readonly" } } diff --git a/test/parser/samples/attribute-dynamic-reserved/input-v2.html b/test/parser/samples/attribute-dynamic-reserved/input-v2.html deleted file mode 100644 index d973a9dea0..0000000000 --- a/test/parser/samples/attribute-dynamic-reserved/input-v2.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-reserved/input.html b/test/parser/samples/attribute-dynamic-reserved/input.html index 6b149d165f..d973a9dea0 100644 --- a/test/parser/samples/attribute-dynamic-reserved/input.html +++ b/test/parser/samples/attribute-dynamic-reserved/input.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-reserved/output-v2.json b/test/parser/samples/attribute-dynamic-reserved/output-v2.json deleted file mode 100644 index 4b6506b0cd..0000000000 --- a/test/parser/samples/attribute-dynamic-reserved/output-v2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "hash": "l0cddf", - "html": { - "start": 0, - "end": 25, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 25, - "type": "Element", - "name": "div", - "attributes": [ - { - "start": 5, - "end": 18, - "type": "Attribute", - "name": "class", - "value": [ - { - "start": 11, - "end": 18, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 12, - "end": 17, - "name": "class" - } - } - ] - } - ], - "children": [] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-reserved/output.json b/test/parser/samples/attribute-dynamic-reserved/output.json index aef0e5cb63..4b6506b0cd 100644 --- a/test/parser/samples/attribute-dynamic-reserved/output.json +++ b/test/parser/samples/attribute-dynamic-reserved/output.json @@ -1,30 +1,30 @@ { - "hash": 2788845841, + "hash": "l0cddf", "html": { "start": 0, - "end": 29, + "end": 25, "type": "Fragment", "children": [ { "start": 0, - "end": 29, + "end": 25, "type": "Element", "name": "div", "attributes": [ { "start": 5, - "end": 22, + "end": 18, "type": "Attribute", "name": "class", "value": [ { - "start": 12, - "end": 21, + "start": 11, + "end": 18, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 14, - "end": 19, + "start": 12, + "end": 17, "name": "class" } } diff --git a/test/parser/samples/attribute-dynamic/input-v2.html b/test/parser/samples/attribute-dynamic/input-v2.html deleted file mode 100644 index 9171ae22a7..0000000000 --- a/test/parser/samples/attribute-dynamic/input-v2.html +++ /dev/null @@ -1 +0,0 @@ -loading...
-{:then theValue} -the value is {theValue}
-{:catch theError} -oh no! {theError.message}
-{/await} \ No newline at end of file diff --git a/test/parser/samples/await-then-catch/input.html b/test/parser/samples/await-then-catch/input.html index 36489b9043..79f5162ace 100644 --- a/test/parser/samples/await-then-catch/input.html +++ b/test/parser/samples/await-then-catch/input.html @@ -1,7 +1,7 @@ -{{#await thePromise}} +{#await thePromise}loading...
-{{then theValue}} -the value is {{theValue}}
-{{catch theError}} -oh no! {{theError.message}}
-{{/await}} \ No newline at end of file +{:then theValue} +the value is {theValue}
+{:catch theError} +oh no! {theError.message}
+{/await} \ No newline at end of file diff --git a/test/parser/samples/await-then-catch/output-v2.json b/test/parser/samples/await-then-catch/output-v2.json deleted file mode 100644 index 22ad4242e3..0000000000 --- a/test/parser/samples/await-then-catch/output-v2.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "hash": "1b28gs9", - "html": { - "start": 0, - "end": 148, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 148, - "type": "AwaitBlock", - "expression": { - "type": "Identifier", - "start": 8, - "end": 18, - "name": "thePromise" - }, - "value": "theValue", - "error": "theError", - "pending": { - "start": 19, - "end": 39, - "type": "PendingBlock", - "children": [ - { - "start": 19, - "end": 21, - "type": "Text", - "data": "\n\t" - }, - { - "start": 21, - "end": 38, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 24, - "end": 34, - "type": "Text", - "data": "loading..." - } - ] - }, - { - "start": 38, - "end": 39, - "type": "Text", - "data": "\n" - } - ] - }, - "then": { - "start": 39, - "end": 88, - "type": "ThenBlock", - "children": [ - { - "start": 55, - "end": 57, - "type": "Text", - "data": "\n\t" - }, - { - "start": 57, - "end": 87, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 60, - "end": 73, - "type": "Text", - "data": "the value is " - }, - { - "start": 73, - "end": 83, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 74, - "end": 82, - "name": "theValue" - } - } - ] - }, - { - "start": 87, - "end": 88, - "type": "Text", - "data": "\n" - } - ] - }, - "catch": { - "start": 88, - "end": 140, - "type": "CatchBlock", - "children": [ - { - "start": 105, - "end": 107, - "type": "Text", - "data": "\n\t" - }, - { - "start": 107, - "end": 139, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 110, - "end": 117, - "type": "Text", - "data": "oh no! " - }, - { - "start": 117, - "end": 135, - "type": "MustacheTag", - "expression": { - "type": "MemberExpression", - "start": 118, - "end": 134, - "object": { - "type": "Identifier", - "start": 118, - "end": 126, - "name": "theError" - }, - "property": { - "type": "Identifier", - "start": 127, - "end": 134, - "name": "message" - }, - "computed": false - } - } - ] - }, - { - "start": 139, - "end": 140, - "type": "Text", - "data": "\n" - } - ] - } - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json index 4f149e6a0c..22ad4242e3 100644 --- a/test/parser/samples/await-then-catch/output.json +++ b/test/parser/samples/await-then-catch/output.json @@ -1,143 +1,143 @@ { - "hash": 1040536517, + "hash": "1b28gs9", "html": { "start": 0, - "end": 158, + "end": 148, "type": "Fragment", "children": [ { "start": 0, - "end": 158, + "end": 148, "type": "AwaitBlock", "expression": { "type": "Identifier", - "start": 9, - "end": 19, + "start": 8, + "end": 18, "name": "thePromise" }, "value": "theValue", "error": "theError", "pending": { - "start": 21, - "end": 41, + "start": 19, + "end": 39, "type": "PendingBlock", "children": [ { - "start": 21, - "end": 23, + "start": 19, + "end": 21, "type": "Text", "data": "\n\t" }, { - "start": 23, - "end": 40, + "start": 21, + "end": 38, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 26, - "end": 36, + "start": 24, + "end": 34, "type": "Text", "data": "loading..." } ] }, { - "start": 40, - "end": 41, + "start": 38, + "end": 39, "type": "Text", "data": "\n" } ] }, "then": { - "start": 41, - "end": 93, + "start": 39, + "end": 88, "type": "ThenBlock", "children": [ { - "start": 58, - "end": 60, + "start": 55, + "end": 57, "type": "Text", "data": "\n\t" }, { - "start": 60, - "end": 92, + "start": 57, + "end": 87, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 63, - "end": 76, + "start": 60, + "end": 73, "type": "Text", "data": "the value is " }, { - "start": 76, - "end": 88, + "start": 73, + "end": 83, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 78, - "end": 86, + "start": 74, + "end": 82, "name": "theValue" } } ] }, { - "start": 92, - "end": 93, + "start": 87, + "end": 88, "type": "Text", "data": "\n" } ] }, "catch": { - "start": 93, - "end": 148, + "start": 88, + "end": 140, "type": "CatchBlock", "children": [ { - "start": 111, - "end": 113, + "start": 105, + "end": 107, "type": "Text", "data": "\n\t" }, { - "start": 113, - "end": 147, + "start": 107, + "end": 139, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 116, - "end": 123, + "start": 110, + "end": 117, "type": "Text", "data": "oh no! " }, { - "start": 123, - "end": 143, + "start": 117, + "end": 135, "type": "MustacheTag", "expression": { "type": "MemberExpression", - "start": 125, - "end": 141, + "start": 118, + "end": 134, "object": { "type": "Identifier", - "start": 125, - "end": 133, + "start": 118, + "end": 126, "name": "theError" }, "property": { "type": "Identifier", - "start": 134, - "end": 141, + "start": 127, + "end": 134, "name": "message" }, "computed": false @@ -146,8 +146,8 @@ ] }, { - "start": 147, - "end": 148, + "start": 139, + "end": 140, "type": "Text", "data": "\n" } diff --git a/test/parser/samples/binding-shorthand/input-v2.html b/test/parser/samples/binding-shorthand/input-v2.html deleted file mode 100644 index 7f8116bdde..0000000000 --- a/test/parser/samples/binding-shorthand/input-v2.html +++ /dev/null @@ -1 +0,0 @@ -Hello & World
\ No newline at end of file diff --git a/test/parser/samples/convert-entities-in-element/input.html b/test/parser/samples/convert-entities-in-element/input.html index bc5c086536..f05dc391ad 100644 --- a/test/parser/samples/convert-entities-in-element/input.html +++ b/test/parser/samples/convert-entities-in-element/input.html @@ -1 +1 @@ -Hello & World
+Hello & World
\ No newline at end of file diff --git a/test/parser/samples/convert-entities-in-element/output-v2.json b/test/parser/samples/convert-entities-in-element/output-v2.json deleted file mode 100644 index cb3e50ec3b..0000000000 --- a/test/parser/samples/convert-entities-in-element/output-v2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "hash": 2365862121, - "html": { - "start": 0, - "end": 24, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 24, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 3, - "end": 20, - "type": "Text", - "data": "Hello & World" - } - ] - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/convert-entities/input-v2.html b/test/parser/samples/convert-entities/input-v2.html deleted file mode 100644 index 161463ec58..0000000000 --- a/test/parser/samples/convert-entities/input-v2.html +++ /dev/null @@ -1 +0,0 @@ -Hello & World \ No newline at end of file diff --git a/test/parser/samples/convert-entities/input.html b/test/parser/samples/convert-entities/input.html index e25e3214f2..161463ec58 100644 --- a/test/parser/samples/convert-entities/input.html +++ b/test/parser/samples/convert-entities/input.html @@ -1 +1 @@ -Hello & World +Hello & World \ No newline at end of file diff --git a/test/parser/samples/convert-entities/output-v2.json b/test/parser/samples/convert-entities/output-v2.json deleted file mode 100644 index 479bae3064..0000000000 --- a/test/parser/samples/convert-entities/output-v2.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "hash": 156753432, - "html": { - "start": 0, - "end": 17, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 17, - "type": "Text", - "data": "Hello & World" - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/css-ref-selector/input-v2.html b/test/parser/samples/css-ref-selector/input-v2.html deleted file mode 100644 index 696075f93f..0000000000 --- a/test/parser/samples/css-ref-selector/input-v2.html +++ /dev/null @@ -1,7 +0,0 @@ - - - \ No newline at end of file diff --git a/test/parser/samples/css-ref-selector/input.html b/test/parser/samples/css-ref-selector/input.html index 07ab3790f7..696075f93f 100644 --- a/test/parser/samples/css-ref-selector/input.html +++ b/test/parser/samples/css-ref-selector/input.html @@ -4,4 +4,4 @@ ref:foo { color: red; } - + \ No newline at end of file diff --git a/test/parser/samples/css-ref-selector/output-v2.json b/test/parser/samples/css-ref-selector/output-v2.json deleted file mode 100644 index 2ddafc4aae..0000000000 --- a/test/parser/samples/css-ref-selector/output-v2.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "hash": 1104014177, - "html": { - "start": 0, - "end": 14, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 14, - "type": "Element", - "name": "div", - "attributes": [ - { - "start": 5, - "end": 12, - "type": "Ref", - "name": "foo" - } - ], - "children": [] - }, - { - "start": 14, - "end": 16, - "type": "Text", - "data": "\n\n" - } - ] - }, - "css": { - "start": 16, - "end": 60, - "attributes": [], - "children": [ - { - "type": "Rule", - "selector": { - "type": "SelectorList", - "children": [ - { - "type": "Selector", - "children": [ - { - "type": "RefSelector", - "start": 25, - "end": 32, - "name": "foo" - } - ], - "start": 25, - "end": 32 - } - ], - "start": 25, - "end": 32 - }, - "block": { - "type": "Block", - "children": [ - { - "type": "Declaration", - "important": false, - "property": "color", - "value": { - "type": "Value", - "children": [ - { - "type": "Identifier", - "name": "red", - "start": 44, - "end": 47 - } - ], - "start": 43, - "end": 47 - }, - "start": 37, - "end": 47 - } - ], - "start": 33, - "end": 51 - }, - "start": 25, - "end": 51 - } - ], - "content": { - "start": 23, - "end": 52, - "styles": "\n\tref:foo {\n\t\tcolor: red;\n\t}\n" - } - }, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/css/input-v2.html b/test/parser/samples/css/input-v2.html deleted file mode 100644 index a573bcf778..0000000000 --- a/test/parser/samples/css/input-v2.html +++ /dev/null @@ -1,7 +0,0 @@ -{key}: {value}
-{/each} diff --git a/test/parser/samples/each-block-destructured/input.html b/test/parser/samples/each-block-destructured/input.html index 7209f5503d..4ddf33ef85 100644 --- a/test/parser/samples/each-block-destructured/input.html +++ b/test/parser/samples/each-block-destructured/input.html @@ -1,3 +1,3 @@ -{{#each animals as [key, value]}} -{{key}}: {{value}}
-{{/each}} +{#each animals as [key, value]} +{key}: {value}
+{/each} diff --git a/test/parser/samples/each-block-destructured/output-v2.json b/test/parser/samples/each-block-destructured/output-v2.json deleted file mode 100644 index 38d5ddc770..0000000000 --- a/test/parser/samples/each-block-destructured/output-v2.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "hash": "gtdm5e", - "html": { - "start": 0, - "end": 62, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 62, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "name": "animals" - }, - "children": [ - { - "start": 33, - "end": 54, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 36, - "end": 41, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 37, - "end": 40, - "name": "key" - } - }, - { - "start": 41, - "end": 43, - "type": "Text", - "data": ": " - }, - { - "start": 43, - "end": 50, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 44, - "end": 49, - "name": "value" - } - } - ] - } - ], - "destructuredContexts": [ - "key", - "value" - ], - "context": "key_value" - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json index 897fec88b8..38d5ddc770 100644 --- a/test/parser/samples/each-block-destructured/output.json +++ b/test/parser/samples/each-block-destructured/output.json @@ -1,53 +1,53 @@ { - "hash": 2621498076, + "hash": "gtdm5e", "html": { "start": 0, - "end": 70, + "end": 62, "type": "Fragment", "children": [ { "start": 0, - "end": 70, + "end": 62, "type": "EachBlock", "expression": { "type": "Identifier", - "start": 8, - "end": 15, + "start": 7, + "end": 14, "name": "animals" }, "children": [ { - "start": 35, - "end": 60, + "start": 33, + "end": 54, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 38, - "end": 45, + "start": 36, + "end": 41, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 40, - "end": 43, + "start": 37, + "end": 40, "name": "key" } }, { - "start": 45, - "end": 47, + "start": 41, + "end": 43, "type": "Text", "data": ": " }, { - "start": 47, - "end": 56, + "start": 43, + "end": 50, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 49, - "end": 54, + "start": 44, + "end": 49, "name": "value" } } diff --git a/test/parser/samples/each-block-else/input-v2.html b/test/parser/samples/each-block-else/input-v2.html deleted file mode 100644 index dc96d8b946..0000000000 --- a/test/parser/samples/each-block-else/input-v2.html +++ /dev/null @@ -1,5 +0,0 @@ -{#each animals as animal} -{animal}
-{:else} -no animals
-{/each} diff --git a/test/parser/samples/each-block-else/input.html b/test/parser/samples/each-block-else/input.html index 59925e8db7..dc96d8b946 100644 --- a/test/parser/samples/each-block-else/input.html +++ b/test/parser/samples/each-block-else/input.html @@ -1,5 +1,5 @@ -{{#each animals as animal}} -{{animal}}
-{{else}} +{#each animals as animal} +{animal}
+{:else}no animals
-{{/each}} +{/each} diff --git a/test/parser/samples/each-block-else/output-v2.json b/test/parser/samples/each-block-else/output-v2.json deleted file mode 100644 index 9f8c5da79b..0000000000 --- a/test/parser/samples/each-block-else/output-v2.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "hash": "ljl07n", - "html": { - "start": 0, - "end": 77, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 77, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "name": "animals" - }, - "children": [ - { - "start": 27, - "end": 42, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 30, - "end": 38, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 31, - "end": 37, - "name": "animal" - } - } - ] - } - ], - "context": "animal", - "else": { - "start": 50, - "end": 70, - "type": "ElseBlock", - "children": [ - { - "start": 52, - "end": 69, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 55, - "end": 65, - "type": "Text", - "data": "no animals" - } - ] - } - ] - } - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json index 0dadad5f65..9f8c5da79b 100644 --- a/test/parser/samples/each-block-else/output.json +++ b/test/parser/samples/each-block-else/output.json @@ -1,36 +1,36 @@ { - "hash": 3238289871, + "hash": "ljl07n", "html": { "start": 0, - "end": 84, + "end": 77, "type": "Fragment", "children": [ { "start": 0, - "end": 84, + "end": 77, "type": "EachBlock", "expression": { "type": "Identifier", - "start": 8, - "end": 15, + "start": 7, + "end": 14, "name": "animals" }, "children": [ { - "start": 29, - "end": 46, + "start": 27, + "end": 42, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 32, - "end": 42, + "start": 30, + "end": 38, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 34, - "end": 40, + "start": 31, + "end": 37, "name": "animal" } } @@ -39,20 +39,20 @@ ], "context": "animal", "else": { - "start": 55, - "end": 75, + "start": 50, + "end": 70, "type": "ElseBlock", "children": [ { - "start": 57, - "end": 74, + "start": 52, + "end": 69, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 60, - "end": 70, + "start": 55, + "end": 65, "type": "Text", "data": "no animals" } diff --git a/test/parser/samples/each-block-indexed/input-v2.html b/test/parser/samples/each-block-indexed/input-v2.html deleted file mode 100644 index d5602ec82c..0000000000 --- a/test/parser/samples/each-block-indexed/input-v2.html +++ /dev/null @@ -1,3 +0,0 @@ -{#each animals as animal, i} -{i}: {animal}
-{/each} diff --git a/test/parser/samples/each-block-indexed/input.html b/test/parser/samples/each-block-indexed/input.html index 5c1c74da66..d5602ec82c 100644 --- a/test/parser/samples/each-block-indexed/input.html +++ b/test/parser/samples/each-block-indexed/input.html @@ -1,3 +1,3 @@ -{{#each animals as animal, i}} -{{i}}: {{animal}}
-{{/each}} +{#each animals as animal, i} +{i}: {animal}
+{/each} diff --git a/test/parser/samples/each-block-indexed/output-v2.json b/test/parser/samples/each-block-indexed/output-v2.json deleted file mode 100644 index 9ffa02aaa8..0000000000 --- a/test/parser/samples/each-block-indexed/output-v2.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "hash": "1143n2g", - "html": { - "start": 0, - "end": 58, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 58, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "name": "animals" - }, - "children": [ - { - "start": 30, - "end": 50, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 33, - "end": 36, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 34, - "end": 35, - "name": "i" - } - }, - { - "start": 36, - "end": 38, - "type": "Text", - "data": ": " - }, - { - "start": 38, - "end": 46, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 39, - "end": 45, - "name": "animal" - } - } - ] - } - ], - "context": "animal", - "index": "i" - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json index fc8954d6ad..9ffa02aaa8 100644 --- a/test/parser/samples/each-block-indexed/output.json +++ b/test/parser/samples/each-block-indexed/output.json @@ -1,53 +1,53 @@ { - "hash": 2841674990, + "hash": "1143n2g", "html": { "start": 0, - "end": 66, + "end": 58, "type": "Fragment", "children": [ { "start": 0, - "end": 66, + "end": 58, "type": "EachBlock", "expression": { "type": "Identifier", - "start": 8, - "end": 15, + "start": 7, + "end": 14, "name": "animals" }, "children": [ { - "start": 32, - "end": 56, + "start": 30, + "end": 50, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 35, - "end": 40, + "start": 33, + "end": 36, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 37, - "end": 38, + "start": 34, + "end": 35, "name": "i" } }, { - "start": 40, - "end": 42, + "start": 36, + "end": 38, "type": "Text", "data": ": " }, { - "start": 42, - "end": 52, + "start": 38, + "end": 46, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 44, - "end": 50, + "start": 39, + "end": 45, "name": "animal" } } diff --git a/test/parser/samples/each-block-keyed/input-v2.html b/test/parser/samples/each-block-keyed/input-v2.html deleted file mode 100644 index 46348678d4..0000000000 --- a/test/parser/samples/each-block-keyed/input-v2.html +++ /dev/null @@ -1,3 +0,0 @@ -{#each todos as todo (todo.id)} -{todo}
-{/each} diff --git a/test/parser/samples/each-block-keyed/input.html b/test/parser/samples/each-block-keyed/input.html index 2bc79c9c8b..46348678d4 100644 --- a/test/parser/samples/each-block-keyed/input.html +++ b/test/parser/samples/each-block-keyed/input.html @@ -1,3 +1,3 @@ -{{#each todos as todo @id}} -{{todo}}
-{{/each}} +{#each todos as todo (todo.id)} +{todo}
+{/each} diff --git a/test/parser/samples/each-block-keyed/output-v2.json b/test/parser/samples/each-block-keyed/output-v2.json deleted file mode 100644 index 461992347b..0000000000 --- a/test/parser/samples/each-block-keyed/output-v2.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "hash": "1x6az5m", - "html": { - "start": 0, - "end": 54, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 54, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 12, - "name": "todos" - }, - "children": [ - { - "start": 33, - "end": 46, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 36, - "end": 42, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 37, - "end": 41, - "name": "todo" - } - } - ] - } - ], - "context": "todo", - "key": "id" - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json index 1a16afb82b..461992347b 100644 --- a/test/parser/samples/each-block-keyed/output.json +++ b/test/parser/samples/each-block-keyed/output.json @@ -1,5 +1,5 @@ { - "hash": 2025411181, + "hash": "1x6az5m", "html": { "start": 0, "end": 54, @@ -11,26 +11,26 @@ "type": "EachBlock", "expression": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 7, + "end": 12, "name": "todos" }, "children": [ { - "start": 29, - "end": 44, + "start": 33, + "end": 46, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 32, - "end": 40, + "start": 36, + "end": 42, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 34, - "end": 38, + "start": 37, + "end": 41, "name": "todo" } } diff --git a/test/parser/samples/each-block/input-v2.html b/test/parser/samples/each-block/input-v2.html deleted file mode 100644 index 83a5e88ddd..0000000000 --- a/test/parser/samples/each-block/input-v2.html +++ /dev/null @@ -1,3 +0,0 @@ -{#each animals as animal} -{animal}
-{/each} diff --git a/test/parser/samples/each-block/input.html b/test/parser/samples/each-block/input.html index 23bfc3c465..83a5e88ddd 100644 --- a/test/parser/samples/each-block/input.html +++ b/test/parser/samples/each-block/input.html @@ -1,3 +1,3 @@ -{{#each animals as animal}} -{{animal}}
-{{/each}} +{#each animals as animal} +{animal}
+{/each} diff --git a/test/parser/samples/each-block/output-v2.json b/test/parser/samples/each-block/output-v2.json deleted file mode 100644 index 7df4a20eba..0000000000 --- a/test/parser/samples/each-block/output-v2.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "hash": "mzeq0s", - "html": { - "start": 0, - "end": 50, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 50, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "name": "animals" - }, - "children": [ - { - "start": 27, - "end": 42, - "type": "Element", - "name": "p", - "attributes": [], - "children": [ - { - "start": 30, - "end": 38, - "type": "MustacheTag", - "expression": { - "type": "Identifier", - "start": 31, - "end": 37, - "name": "animal" - } - } - ] - } - ], - "context": "animal" - } - ] - }, - "css": null, - "js": null -} \ No newline at end of file diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json index e549faca39..7df4a20eba 100644 --- a/test/parser/samples/each-block/output.json +++ b/test/parser/samples/each-block/output.json @@ -1,36 +1,36 @@ { - "hash": 220340986, + "hash": "mzeq0s", "html": { "start": 0, - "end": 56, + "end": 50, "type": "Fragment", "children": [ { "start": 0, - "end": 56, + "end": 50, "type": "EachBlock", "expression": { "type": "Identifier", - "start": 8, - "end": 15, + "start": 7, + "end": 14, "name": "animals" }, "children": [ { - "start": 29, - "end": 46, + "start": 27, + "end": 42, "type": "Element", "name": "p", "attributes": [], "children": [ { - "start": 32, - "end": 42, + "start": 30, + "end": 38, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 34, - "end": 40, + "start": 31, + "end": 37, "name": "animal" } } diff --git a/test/parser/samples/element-with-mustache/input-v2.html b/test/parser/samples/element-with-mustache/input-v2.html deleted file mode 100644 index 1e9232da02..0000000000 --- a/test/parser/samples/element-with-mustache/input-v2.html +++ /dev/null @@ -1 +0,0 @@ -