update validation tests

pull/1348/head
Rich Harris 7 years ago
parent 2d5b47b8a4
commit 39ad124c99

@ -25,7 +25,7 @@ function getName(filename) {
return base[0].toUpperCase() + base.slice(1);
}
describe.only("runtime", () => {
describe("runtime", () => {
before(() => {
svelte = loadSvelte(false);
svelte$ = loadSvelte(true);

@ -1,5 +1,5 @@
<html lang="en"></html>
<html lang="en-US"></html>
<html lang={{language}}></html>
<html lang={language}></html>
<html></html>

@ -10,6 +10,6 @@
"line": 5,
"column": 13
},
"pos": 84
"pos": 82
}
]

@ -1 +1 @@
<iframe src='{{src}}'></iframe>
<iframe src='{src}'></iframe>

@ -8,7 +8,7 @@
},
"end": {
"line": 1,
"column": 31
"column": 29
},
"pos": 0
}

@ -1,4 +1,4 @@
<div tabindex='-1'/>
<div tabindex='0'/>
<div tabindex='1'/>
<div tabindex='{{foo}}'/>
<div tabindex='{foo}'/>

@ -1,10 +1,10 @@
{{#await promise}}
{#await promise}
<p>Loading</p>
{{then data}}
<Component :data />
{{catch err}}
<p>Error: {{err}}</p>
{{/await}}
{:then data}
<Component {data} />
{:catch err}
<p>Error: {err}</p>
{/await}
<script>
import Component from './Component.html';

@ -7,7 +7,7 @@
},
"end": {
"line": 1,
"column": 44
"column": 42
},
"pos": 24
}]

@ -1 +1 @@
<input bind:value='foo' type='{{inputType}}'>
<input bind:value='foo' type='{inputType}'>

@ -7,7 +7,7 @@
},
"end": {
"line": 1,
"column": 28
"column": 29
},
"pos": 19
}]

@ -1,4 +1,4 @@
<select bind:value :multiple>
<select bind:value {multiple}>
<option>1</option>
<option>2</option>
<option>3</option>

@ -7,7 +7,7 @@
},
"end": {
"line": 2,
"column": 23
"column": 21
},
"pos": 18
}]

@ -1,3 +1,3 @@
<Nested>
<button slot='{{foo}}'>click me</button>
<button slot='{foo}'>click me</button>
</Nested>

@ -7,7 +7,7 @@
},
"end": {
"line": 1,
"column": 20
"column": 18
},
"pos": 6
}]

@ -1 +1 @@
<slot name='{{foo}}'></slot>
<slot name='{foo}'></slot>

@ -9,5 +9,5 @@
"line": 2,
"column": 1
},
"pos": 27
"pos": 25
}]

@ -1,3 +1,3 @@
{{#each things as thing}}
{#each things as thing}
<slot name='foo'></slot>
{{/each}}
{/each}

@ -9,5 +9,5 @@
"line": 3,
"column": 17
},
"pos": 43
"pos": 41
}]

@ -1,7 +1,7 @@
<Nested>
{{#each things as thing}}
<div slot='foo'>{{thing}}</div>
{{/each}}
{#each things as thing}
<div slot='foo'>{thing}</div>
{/each}
</Nested>
<script>

@ -9,5 +9,5 @@
"line": 3,
"column": 17
},
"pos": 31
"pos": 29
}]

@ -1,7 +1,7 @@
<Nested>
{{#if thing}}
<div slot='foo'>{{thing}}</div>
{{/if}}
{#if thing}
<div slot='foo'>{thing}</div>
{/if}
</Nested>
<script>

@ -1,7 +1,7 @@
[{
"code": "impure-computed",
"message": "Computed properties should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?",
"pos": 83,
"pos": 81,
"loc": {
"line": 7,
"column": 4

@ -1,4 +1,4 @@
<button>{{foo}}</button>
<button>{foo}</button>
<script>
export default {

@ -1,7 +1,7 @@
[{
"code": "impure-computed",
"message": "Cannot use this.get(...) — values must be passed into the function as arguments",
"pos": 73,
"pos": 71,
"loc": {
"line": 7,
"column": 11

@ -1,4 +1,4 @@
{{foo}}
{foo}
<script>
export default {

@ -3,11 +3,11 @@
"message": "'case' is a reserved word in JavaScript and cannot be used here",
"loc": {
"line": 1,
"column": 18
"column": 17
},
"end": {
"line": 1,
"column": 18
"column": 17
},
"pos": 18
"pos": 17
}]

@ -1,3 +1,3 @@
{{#each cases as [case]}}
{{case.title}}
{{/each}}
{#each cases as [case]}
{case.title}
{/each}

@ -3,11 +3,11 @@
"message": "'case' is a reserved word in JavaScript and cannot be used here",
"loc": {
"line": 1,
"column": 17
"column": 16
},
"end": {
"line": 1,
"column": 17
"column": 16
},
"pos": 17
"pos": 16
}]

@ -1,3 +1,3 @@
{{#each cases as case}}
{{case.title}}
{{/each}}
{#each cases as case}
{case.title}
{/each}

@ -1,10 +1,10 @@
{{#each things as thing}}
{#each things as thing}
<span>this only exists...</span>
<span>...to increase test coverage</span>
{{/each}}
{/each}
{{#each things as thing}}{{soDoesThis}}{{/each}}
{#each things as thing}{soDoesThis}{/each}
{{#each things as thing}}
{#each things as thing}
andThis
{{/each}}
{/each}

@ -1,5 +1,5 @@
{{#each things as thing}}
{#each things as thing}
{{/each}}
{/each}
{{#each things as thing}}{{/each}}
{#each things as thing}{/each}

@ -8,7 +8,7 @@
},
"end": {
"line": 3,
"column": 9
"column": 7
},
"pos": 0
},
@ -21,8 +21,8 @@
},
"end": {
"line": 5,
"column": 34
"column": 30
},
"pos": 38
"pos": 34
}
]

@ -1,5 +1,5 @@
{{#each things as thing}}
{#each things as thing}
{{/each}}
{/each}
{{#each things as thing}}{{/each}}
{#each things as thing}{/each}

@ -1,6 +1,6 @@
{{#each things as thing}}
{{thing}}
{{/each}}
{#each things as thing}
{thing}
{/each}
<script>
export default {

@ -3,11 +3,11 @@
"message": "Context clashes with a helper. Rename one or the other to eliminate any ambiguity",
"loc": {
"line": 1,
"column": 18
"column": 17
},
"end": {
"line": 1,
"column": 23
"column": 22
},
"pos": 18
"pos": 17
}]

@ -1,4 +1,4 @@
{{foo()}}
{foo()}
<script>
export default {

@ -1,7 +1,7 @@
[{
"code": "impure-helper",
"message": "Helpers should be pure functions, with at least one argument",
"pos": 54,
"pos": 52,
"loc": {
"line": 6,
"column": 3

@ -1,7 +1,7 @@
[{
"code": "impure-helper",
"message": "Cannot use this.get(...) — values must be passed into the helper function as arguments",
"pos": 74,
"pos": 72,
"loc": {
"line": 7,
"column": 11

@ -1,4 +1,4 @@
{{foo()}}
{foo()}
<script>
export default {

@ -1,4 +1,4 @@
{{sum(1, 2, 3)}}
{sum(1, 2, 3)}
<script>
export default {

@ -1,6 +1,6 @@
[{
"code": "invalid-callee",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, store.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?",
"pos": 18,
"loc": {
"line": 1,

@ -1,6 +1,6 @@
[{
"code": "invalid-callee",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar)",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, store.*, set, fire, destroy or bar)",
"pos": 18,
"loc": {
"line": 1,

@ -8,7 +8,7 @@
},
"end": {
"line": 9,
"column": 18
"column": 6
},
"pos": 87
}]

@ -6,7 +6,7 @@
};
},
computed: {
new: a => a * 2
new: ({ a }) => a * 2
}
};
</script>

@ -7,7 +7,7 @@
},
"end": {
"line": 9,
"column": 28
"column": 16
},
"pos": 87
}]

@ -6,7 +6,7 @@
};
},
computed: {
"with-hyphen": a => a * 2
"with-hyphen": ({ a }) => a * 2
}
};
</script>

@ -1,13 +0,0 @@
[{
"code": "invalid-computed-arguments",
"message": "Computed properties cannot use destructuring in function parameters",
"loc": {
"line": 6,
"column": 8
},
"end": {
"line": 6,
"column": 16
},
"pos": 62
}]

@ -1,9 +0,0 @@
<div></div>
<script>
export default {
computed: {
foo ({ a, b }) {}
}
};
</script>

@ -1 +0,0 @@
<button on:click='store.foo()'>foo</button>

@ -1,13 +0,0 @@
[{
"code": "options-missing-store",
"message": "compile with `store: true` in order to call store methods",
"loc": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 29
},
"pos": 18
}]

@ -1,4 +1,4 @@
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
<rect x='{x}' y='{y}' width='{width}' height='{height}'/>
<script>
export default {

@ -1,29 +1 @@
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
{{#each foo as bar}}
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
{{else}}
{{#each foo as bar}}
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
{{/each}}
{{/each}}
{{#if foo}}
{{elseif bar}}
{{#each foo as bar}}
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
{{/each}}
{{else}}
{{#each foo as bar}}
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
{{/each}}
{{/if}}
<rect x='{x}' y='{y}' width='{width}' height='{height}'/>

@ -7,59 +7,7 @@
},
"end": {
"line": 1,
"column": 65
"column": 57
},
"pos": 0
},
{
"code": "missing-namespace",
"message": "<rect> is an SVG element did you forget to add { namespace: 'svg' } ?",
"loc": {
"column": 1,
"line": 5
},
"end": {
"line": 5,
"column": 66
},
"pos": 90
},
{
"code": "missing-namespace",
"message": "<rect> is an SVG element did you forget to add { namespace: 'svg' } ?",
"loc": {
"column": 2,
"line": 10
},
"end": {
"line": 10,
"column": 67
},
"pos": 191
},
{
"code": "missing-namespace",
"message": "<rect> is an SVG element did you forget to add { namespace: 'svg' } ?",
"loc": {
"column": 2,
"line": 20
},
"end": {
"line": 20,
"column": 67
},
"pos": 333
},
{
"code": "missing-namespace",
"message": "<rect> is an SVG element did you forget to add { namespace: 'svg' } ?",
"loc": {
"column": 2,
"line": 26
},
"end": {
"line": 26,
"column": 67
},
"pos": 445
}]

@ -7,7 +7,7 @@
},
"end": {
"line": 1,
"column": 25
"column": 23
},
"pos": 10
}]

@ -1,3 +1,3 @@
<textarea value='{{foo}}'>
<textarea value='{foo}'>
some illegal text
</textarea>

@ -1,13 +0,0 @@
[{
"code": "illegal-attribute",
"message": "<title> cannot have attributes",
"loc": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 25
},
"pos": 22
}]

@ -9,5 +9,5 @@
"line": 2,
"column": 25
},
"pos": 16
"pos": 22
}]

@ -1,3 +0,0 @@
<svelte:head>
<title data-invalid=true>a static title</title>
</svelte:head>

@ -1,3 +1,3 @@
<:Head>
<svelte:head>
<title data-invalid=true>a static title</title>
</:Head>
</svelte:head>

@ -9,5 +9,5 @@
"line": 2,
"column": 35
},
"pos": 19
"pos": 25
}]

@ -1,3 +1,3 @@
<:Head>
<svelte:head>
<title>an <strong>invalid</strong> title</title>
</:Head>
</svelte:head>

@ -3,11 +3,11 @@
"message": "'innerwidth' is not a valid binding on <:Window> (did you mean 'innerWidth'?)",
"loc": {
"line": 1,
"column": 9
"column": 15
},
"end": {
"line": 1,
"column": 28
"column": 34
},
"pos": 9
"pos": 15
}]

@ -1 +1 @@
<:Window bind:innerwidth='w'/>
<svelte:window bind:innerwidth='w'/>

@ -3,11 +3,11 @@
"message": "Bindings on <:Window/> must be to top-level properties, e.g. 'baz' rather than 'foo.bar.baz'",
"loc": {
"line": 1,
"column": 26
"column": 32
},
"end": {
"line": 1,
"column": 37
"column": 43
},
"pos": 26
"pos": 32
}]

@ -1 +1 @@
<:Window bind:innerWidth='foo.bar.baz'/>
<svelte:window bind:innerWidth='foo.bar.baz'/>

@ -3,11 +3,11 @@
"message": "'width' is not a valid binding on <:Window> (did you mean 'innerWidth'?)",
"loc": {
"line": 1,
"column": 9
"column": 15
},
"end": {
"line": 1,
"column": 23
"column": 29
},
"pos": 9
"pos": 15
}]

@ -1 +1 @@
<:Window bind:width='w'/>
<svelte:window bind:width='w'/>

@ -3,11 +3,11 @@
"message": "'potato' is not a valid binding on <:Window> — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY or online",
"loc": {
"line": 1,
"column": 9
"column": 15
},
"end": {
"line": 1,
"column": 26
"column": 32
},
"pos": 9
"pos": 15
}]

@ -1 +1 @@
<:Window bind:potato='foo'/>
<svelte:window bind:potato='foo'/>

@ -1 +1 @@
<:Window bind:online/>
<svelte:window bind:online/>

@ -1 +1 @@
<:Window on:resize='resize()'/>
<svelte:window on:resize='resize()'/>

@ -1,13 +1,13 @@
[{
"code": "invalid-callee",
"message": "'resize' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire or destroy)",
"message": "'resize' is an invalid callee (should be one of this.*, event.*, options.*, console.*, store.*, set, fire or destroy)",
"loc": {
"line": 1,
"column": 20
"column": 26
},
"end": {
"line": 1,
"column": 28
"column": 34
},
"pos": 20
"pos": 26
}]

Loading…
Cancel
Save