Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 #1348

Merged
merged 42 commits into from
Apr 19, 2018
Merged

v2 #1348

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
470eacf
remove obsolete methods
Rich-Harris Apr 15, 2018
34d2fbf
remove ES5 constraint
Rich-Harris Apr 15, 2018
7b40fed
remove unused store methods
Rich-Harris Apr 15, 2018
9070969
remove references to obsolete methods
Rich-Harris Apr 15, 2018
9bc8b74
update store tests
Rich-Harris Apr 15, 2018
daa2635
update snapshot tests
Rich-Harris Apr 15, 2018
2f86bd3
update tests to account for removal of observe
Rich-Harris Apr 15, 2018
df4e367
update snapshot tests
Rich-Harris Apr 15, 2018
a3add04
remove code, map and cssMap from svelte.compile output
Rich-Harris Apr 15, 2018
80e0dce
remove validate and Stylesheet from public API
Rich-Harris Apr 15, 2018
4fe8d95
dont typecast numeric attributes
Rich-Harris Apr 16, 2018
21168bf
remove v1 parser tests
Rich-Harris Apr 16, 2018
286caba
oops
Rich-Harris Apr 16, 2018
ab79cc6
remove v1 snapshot tests
Rich-Harris Apr 16, 2018
ce11460
remove deprecated renderCss method
Rich-Harris Apr 16, 2018
4b3da75
remove v1 runtime tests
Rich-Harris Apr 16, 2018
1143b0a
remove v1 tests
Rich-Harris Apr 16, 2018
2d5b47b
remove store option
Rich-Harris Apr 16, 2018
39ad124
update validation tests
Rich-Harris Apr 16, 2018
8eb4adc
small fix
Rich-Harris Apr 16, 2018
a275960
SSR tests
Rich-Harris Apr 16, 2018
39d0b86
update hydration tests
Rich-Harris Apr 16, 2018
40e6b4f
update css tests
Rich-Harris Apr 16, 2018
87a8e37
remove cascade option
Rich-Harris Apr 16, 2018
cae4dd9
fix some more tests
Rich-Harris Apr 16, 2018
73e83e5
tidy up
Rich-Harris Apr 16, 2018
dadf21c
skip test, fix post-v2
Rich-Harris Apr 16, 2018
d2a5b36
remove redundant test
Rich-Harris Apr 16, 2018
a32c2ba
Merge branch 'master' into v2
Rich-Harris Apr 17, 2018
7e733d8
enforce uppercase component names
Rich-Harris Apr 17, 2018
b9fcc16
update test
Rich-Harris Apr 17, 2018
07bad96
tidy up
Rich-Harris Apr 17, 2018
5a457bf
rename loc to start, include character info in locations
Rich-Harris Apr 17, 2018
69c41a0
use new Function instead of eval, to prevent Rollup complaining
Rich-Harris Apr 17, 2018
a2d3d05
merge master -> v2
Rich-Harris Apr 18, 2018
da6fa85
update README
Rich-Harris Apr 18, 2018
1e9b32a
fixes
Rich-Harris Apr 18, 2018
f2b6ec4
fix <svelte:window> to use new APIs
Conduitry Apr 18, 2018
06517ce
remove erroneous warnings
Rich-Harris Apr 18, 2018
fb9d7cd
remove obsolete hash stuff
Rich-Harris Apr 18, 2018
6ff02b2
remove legacy prop stuff, now that we emit ES2015
Rich-Harris Apr 18, 2018
aaab685
support $method(...) calls, and warn on store.method(...)
Rich-Harris Apr 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 8 additions & 12 deletions test/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ let compileOptions = null;
let compile = null;

function getName(filename) {
const base = path.basename(filename).replace('-v2', '').replace(".html", "");
const base = path.basename(filename).replace(".html", "");
return base[0].toUpperCase() + base.slice(1);
}

describe("runtime", () => {
describe.only("runtime", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D: D:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh

before(() => {
svelte = loadSvelte(false);
svelte$ = loadSvelte(true);
Expand All @@ -46,7 +46,7 @@ describe("runtime", () => {

const failed = new Set();

function runTest(dir, shared, hydrate, v2) {
function runTest(dir, shared, hydrate) {
if (dir[0] === ".") return;

const config = loadConfig(`./runtime/samples/${dir}/_config.js`);
Expand All @@ -55,7 +55,7 @@ describe("runtime", () => {
throw new Error("Forgot to remove `solo: true` from test");
}

(config.skip ? it.skip : config.solo ? it.only : it)(`${dir} (${shared ? 'shared' : 'inline'} helpers${hydrate ? ', hydration' : ''}${v2 ? ', v2' : ''})`, () => {
(config.skip ? it.skip : config.solo ? it.only : it)(`${dir} (${shared ? 'shared' : 'inline'} helpers${hydrate ? ', hydration' : ''})`, () => {
if (failed.has(dir)) {
// this makes debugging easier, by only printing compiled output once
throw new Error('skipping test, already failed');
Expand All @@ -72,7 +72,7 @@ describe("runtime", () => {
compileOptions.dev = config.dev;
compileOptions.store = !!config.store;
compileOptions.immutable = config.immutable;
compileOptions.parser = v2 ? 'v2' : 'v1';
compileOptions.parser = 'v2'; // TODO remove

Object.keys(require.cache)
.filter(x => x.endsWith(".html"))
Expand Down Expand Up @@ -112,7 +112,7 @@ describe("runtime", () => {
};

try {
SvelteComponent = require(`./samples/${dir}/main${v2 ? '-v2' : ''}.html`);
SvelteComponent = require(`./samples/${dir}/main.html`);
} catch (err) {
showOutput(cwd, { shared, format: 'cjs', hydratable: hydrate, store: !!compileOptions.store }, compile); // eslint-disable-line no-console
throw err;
Expand Down Expand Up @@ -172,12 +172,12 @@ describe("runtime", () => {
config.error(assert, err);
} else {
failed.add(dir);
showOutput(cwd, { shared, format: 'cjs', hydratable: hydrate, store: !!compileOptions.store, v2 }, compile); // eslint-disable-line no-console
showOutput(cwd, { shared, format: 'cjs', hydratable: hydrate, store: !!compileOptions.store, v2: true }, compile); // eslint-disable-line no-console
throw err;
}
})
.then(() => {
if (config.show) showOutput(cwd, { shared, format: 'cjs', hydratable: hydrate, store: !!compileOptions.store, v2 }, compile);
if (config.show) showOutput(cwd, { shared, format: 'cjs', hydratable: hydrate, store: !!compileOptions.store, v2: true }, compile);
});
});
}
Expand All @@ -187,10 +187,6 @@ describe("runtime", () => {
runTest(dir, shared, false);
runTest(dir, shared, true);
runTest(dir, null, false);

if (fs.existsSync(`test/runtime/samples/${dir}/main-v2.html`)) {
runTest(dir, shared, false, true);
}
});

it("fails if options.target is missing in dev mode", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/action-this/main.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button use:foo>{{x}}</button>
<button use:foo>{x}</button>

<script>
export default {
Expand Down
52 changes: 0 additions & 52 deletions test/runtime/samples/action-update/main-v2.html

This file was deleted.

4 changes: 2 additions & 2 deletions test/runtime/samples/action-update/main.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<button use:tooltip="tooltip">action</button>
<:Window on:keydown="checkForCtrl(event)" on:keyup="checkForCtrl(event)"/>
<svelte:window on:keydown="checkForCtrl(event)" on:keyup="checkForCtrl(event)"/>

<script>
export default {
Expand Down Expand Up @@ -36,7 +36,7 @@

node.addEventListener('mouseenter', onMouseEnter);
node.addEventListener('mouseleave', onMouseLeave);

return {
update(text) {
if (tooltip) tooltip.textContent = text;
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-boolean-false/main.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<textarea readonly="{{false}}"></textarea>
<textarea readonly="{false}"></textarea>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<input type='checkbox' indeterminate='{{indeterminate}}'>
<input type='checkbox' indeterminate='{indeterminate}'>
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-boolean-true/main.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<textarea readonly="{{true}}"></textarea>
<textarea readonly="{true}"></textarea>
6 changes: 3 additions & 3 deletions test/runtime/samples/attribute-dynamic-multiple/main.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#each items as item, i}}
<div class='{{item.foo ? "foo" : ""}} {{item.bar ? "bar" : ""}}'>{{i + 1}}</div>
{{/each}}
{#each items as item, i}
<div class='{item.foo ? "foo" : ""} {item.bar ? "bar" : ""}'>{i + 1}</div>
{/each}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span title='{{"\"foo\""}}'>foo</span>
<span title='{"\"foo\""}'>foo</span>
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-dynamic-reserved/main.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class='{{class}}'></div>{{123}}
<div class='{class}'></div>{123}
9 changes: 0 additions & 9 deletions test/runtime/samples/attribute-dynamic-shorthand/main-v2.html

This file was deleted.

2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-dynamic-shorthand/main.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div :id/>
<div {id}/>

<script>
export default {
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-dynamic-type/main.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<input type='{{inputType}}' value='{{inputValue}}'>
<input type='{inputType}' value='{inputValue}'>
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-dynamic/main.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style='color: {{color}};'>{{color}}</div>
<div style='color: {color};'>{color}</div>

<script>
export default {
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/attribute-namespaced/main.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<svg>
<use xlink:href="#{{foo}}"/>
<use xlink:href="#{foo}"/>
</svg>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p data-value="{{value}}"></p>
<p data-value="{value}"></p>
4 changes: 2 additions & 2 deletions test/runtime/samples/attribute-prefer-expression/main.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<input type='radio' bind:group='foo' value='{{false}}'>
<input type='radio' bind:group='foo' value='{{true}}'>
<input type='radio' bind:group='foo' value='{false}'>
<input type='radio' bind:group='foo' value='{true}'>
4 changes: 2 additions & 2 deletions test/runtime/samples/autofocus/main.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#if visible}}
{#if visible}
<input ref:input autofocus>
{{/if}}
{/if}
4 changes: 2 additions & 2 deletions test/runtime/samples/await-component-oncreate/Foo.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p>{{value}}</p>
<p>{{called}}</p>
<p>{value}</p>
<p>{called}</p>

<script>
export default {
Expand Down
6 changes: 3 additions & 3 deletions test/runtime/samples/await-component-oncreate/main.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#await promise then value}}
<Foo :value />
{{/await}}
{#await promise then value}
<Foo {value} />
{/await}

<script>
import Foo from './Foo.html';
Expand Down
14 changes: 7 additions & 7 deletions test/runtime/samples/await-set-simultaneous/main.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#if promise}}
{{#await promise}}
{#if promise}
{#await promise}
<p>wait for it...</p>
{{then _}}
<p>the answer is {{answer}}!</p>
{{catch error}}
{:then _}
<p>the answer is {answer}!</p>
{:catch error}
<p>well that's odd</p>
{{/await}}
{{/if}}
{/await}
{/if}
12 changes: 6 additions & 6 deletions test/runtime/samples/await-then-catch-anchor/main.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div>
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
</div>
10 changes: 5 additions & 5 deletions test/runtime/samples/await-then-catch-event/main.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
{:then theValue}
<button ref:button on:click='set({ clicked: theValue })'>click me</button>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
18 changes: 9 additions & 9 deletions test/runtime/samples/await-then-catch-if/main.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{#if show}}
{{#await thePromise}}
{#if show}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{{else}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
{:else}
<p>Else</p>
{{/if}}
{/if}
12 changes: 6 additions & 6 deletions test/runtime/samples/await-then-catch-in-slot/main.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Foo>
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
</Foo>

<script>
Expand Down
24 changes: 12 additions & 12 deletions test/runtime/samples/await-then-catch-multiple/main.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}

{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
12 changes: 6 additions & 6 deletions test/runtime/samples/await-then-catch-non-promise/main.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
12 changes: 6 additions & 6 deletions test/runtime/samples/await-then-catch/main.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}
Loading