From a89f80d80e93e5214b8f07bb53366a0964a6fafd Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sat, 7 Sep 2019 15:40:10 -0400 Subject: [PATCH] move tests to runtime section --- src/runtime/transition/index.ts | 2 +- .../expected.js | 72 ------------------- .../declaration-assignment-for/expected.js | 68 ------------------ .../declaration-assignment/expected.js | 65 ----------------- .../declaration-no-assignment/expected.js | 70 ------------------ .../_config.js | 3 + .../main.svelte} | 0 .../_config.js | 3 + .../main.svelte} | 0 .../_config.js | 3 + .../main.svelte} | 0 .../_config.js | 3 + .../main.svelte} | 2 +- 13 files changed, 14 insertions(+), 277 deletions(-) delete mode 100644 test/js/samples/declaration-assignment-emersion/expected.js delete mode 100644 test/js/samples/declaration-assignment-for/expected.js delete mode 100644 test/js/samples/declaration-assignment/expected.js delete mode 100644 test/js/samples/declaration-no-assignment/expected.js create mode 100644 test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js rename test/{js/samples/declaration-no-assignment/input.svelte => runtime/samples/reactive-assignment-in-assignment-rhs/main.svelte} (100%) create mode 100644 test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js rename test/{js/samples/declaration-assignment-emersion/input.svelte => runtime/samples/reactive-assignment-in-complex-declaration/main.svelte} (100%) create mode 100644 test/runtime/samples/reactive-assignment-in-declaration/_config.js rename test/{js/samples/declaration-assignment/input.svelte => runtime/samples/reactive-assignment-in-declaration/main.svelte} (100%) create mode 100644 test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js rename test/{js/samples/declaration-assignment-for/input.svelte => runtime/samples/reactive-assignment-in-for-loop-head/main.svelte} (87%) diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts index 98d2701123..ec19ca1b68 100644 --- a/src/runtime/transition/index.ts +++ b/src/runtime/transition/index.ts @@ -36,7 +36,7 @@ export function blur(node: Element, { delay, duration, easing, - css: (t, u) => `opacity: ${target_opacity - (od * u)}; filter: ${f} blur(${u * amount}px);` + css: (_t, u) => `opacity: ${target_opacity - (od * u)}; filter: ${f} blur(${u * amount}px);` }; } diff --git a/test/js/samples/declaration-assignment-emersion/expected.js b/test/js/samples/declaration-assignment-emersion/expected.js deleted file mode 100644 index f3ad073ec6..0000000000 --- a/test/js/samples/declaration-assignment-emersion/expected.js +++ /dev/null @@ -1,72 +0,0 @@ -/* generated by Svelte vX.Y.Z */ -import { - SvelteComponent, - append, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_data, - space, - text -} from "svelte/internal"; - -function create_fragment(ctx) { - var h1, t0, t1, t2; - - return { - c() { - h1 = element("h1"); - t0 = text(ctx.foo); - t1 = space(); - t2 = text(ctx.eid); - }, - - m(target, anchor) { - insert(target, h1, anchor); - append(h1, t0); - append(h1, t1); - append(h1, t2); - }, - - p(changed, ctx) { - if (changed.foo) { - set_data(t0, ctx.foo); - } - - if (changed.eid) { - set_data(t2, ctx.eid); - } - }, - - i: noop, - o: noop, - - d(detaching) { - if (detaching) { - detach(h1); - } - } - }; -} - -function instance($$self, $$props, $$invalidate) { - let eid = 1; - let foo; - let employees = [ - {id: eid = (foo = 2), name: 'xxx'}, - ]; $$invalidate('foo', foo); $$invalidate('eid', eid); - - return { eid, foo }; -} - -class Component extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance, create_fragment, safe_not_equal, []); - } -} - -export default Component; diff --git a/test/js/samples/declaration-assignment-for/expected.js b/test/js/samples/declaration-assignment-for/expected.js deleted file mode 100644 index 11719d7cb6..0000000000 --- a/test/js/samples/declaration-assignment-for/expected.js +++ /dev/null @@ -1,68 +0,0 @@ -/* generated by Svelte vX.Y.Z */ -import { - SvelteComponent, - append, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_data, - space, - text -} from "svelte/internal"; - -function create_fragment(ctx) { - var h1, t0, t1, t2; - - return { - c() { - h1 = element("h1"); - t0 = text(ctx.foo1); - t1 = space(); - t2 = text(ctx.foo2); - }, - - m(target, anchor) { - insert(target, h1, anchor); - append(h1, t0); - append(h1, t1); - append(h1, t2); - }, - - p(changed, ctx) { - if (changed.foo1) { - set_data(t0, ctx.foo1); - } - }, - - i: noop, - o: noop, - - d(detaching) { - if (detaching) { - detach(h1); - } - } - }; -} - -function instance($$self, $$props, $$invalidate) { - let foo1; - let foo2; - for (let bar = (foo1 = 0); bar < 5; bar += 1) { - $$invalidate('foo1', foo1 = foo2); $$invalidate('foo1', foo1); - } - - return { foo1, foo2 }; -} - -class Component extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance, create_fragment, safe_not_equal, []); - } -} - -export default Component; diff --git a/test/js/samples/declaration-assignment/expected.js b/test/js/samples/declaration-assignment/expected.js deleted file mode 100644 index 61e649bad0..0000000000 --- a/test/js/samples/declaration-assignment/expected.js +++ /dev/null @@ -1,65 +0,0 @@ -/* generated by Svelte vX.Y.Z */ -import { - SvelteComponent, - append, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_data, - space, - text -} from "svelte/internal"; - -function create_fragment(ctx) { - var h1, t0, t1, t2; - - return { - c() { - h1 = element("h1"); - t0 = text(ctx.foo); - t1 = space(); - t2 = text(ctx.bar); - }, - - m(target, anchor) { - insert(target, h1, anchor); - append(h1, t0); - append(h1, t1); - append(h1, t2); - }, - - p(changed, ctx) { - if (changed.foo) { - set_data(t0, ctx.foo); - } - }, - - i: noop, - o: noop, - - d(detaching) { - if (detaching) { - detach(h1); - } - } - }; -} - -function instance($$self, $$props, $$invalidate) { - let foo; - let bar = (foo = 1); $$invalidate('foo', foo); - - return { foo, bar }; -} - -class Component extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance, create_fragment, safe_not_equal, []); - } -} - -export default Component; diff --git a/test/js/samples/declaration-no-assignment/expected.js b/test/js/samples/declaration-no-assignment/expected.js deleted file mode 100644 index f96cf01829..0000000000 --- a/test/js/samples/declaration-no-assignment/expected.js +++ /dev/null @@ -1,70 +0,0 @@ -/* generated by Svelte vX.Y.Z */ -import { - SvelteComponent, - append, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_data, - space, - text -} from "svelte/internal"; - -function create_fragment(ctx) { - var h1, t0, t1, t2; - - return { - c() { - h1 = element("h1"); - t0 = text(ctx.foo); - t1 = space(); - t2 = text(ctx.bar); - }, - - m(target, anchor) { - insert(target, h1, anchor); - append(h1, t0); - append(h1, t1); - append(h1, t2); - }, - - p(changed, ctx) { - if (changed.foo) { - set_data(t0, ctx.foo); - } - - if (changed.bar) { - set_data(t2, ctx.bar); - } - }, - - i: noop, - o: noop, - - d(detaching) { - if (detaching) { - detach(h1); - } - } - }; -} - -function instance($$self, $$props, $$invalidate) { - let foo; - let bar; - $$invalidate('bar', bar = (foo = 1)); $$invalidate('foo', foo); - - return { foo, bar }; -} - -class Component extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance, create_fragment, safe_not_equal, []); - } -} - -export default Component; diff --git a/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js b/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js new file mode 100644 index 0000000000..f0bf2cdc70 --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-assignment-rhs/_config.js @@ -0,0 +1,3 @@ +export default { + html: `

1 1

` +}; \ No newline at end of file diff --git a/test/js/samples/declaration-no-assignment/input.svelte b/test/runtime/samples/reactive-assignment-in-assignment-rhs/main.svelte similarity index 100% rename from test/js/samples/declaration-no-assignment/input.svelte rename to test/runtime/samples/reactive-assignment-in-assignment-rhs/main.svelte diff --git a/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js b/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js new file mode 100644 index 0000000000..d17a81e052 --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-complex-declaration/_config.js @@ -0,0 +1,3 @@ +export default { + html: `

2 2

` +}; \ No newline at end of file diff --git a/test/js/samples/declaration-assignment-emersion/input.svelte b/test/runtime/samples/reactive-assignment-in-complex-declaration/main.svelte similarity index 100% rename from test/js/samples/declaration-assignment-emersion/input.svelte rename to test/runtime/samples/reactive-assignment-in-complex-declaration/main.svelte diff --git a/test/runtime/samples/reactive-assignment-in-declaration/_config.js b/test/runtime/samples/reactive-assignment-in-declaration/_config.js new file mode 100644 index 0000000000..f0bf2cdc70 --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-declaration/_config.js @@ -0,0 +1,3 @@ +export default { + html: `

1 1

` +}; \ No newline at end of file diff --git a/test/js/samples/declaration-assignment/input.svelte b/test/runtime/samples/reactive-assignment-in-declaration/main.svelte similarity index 100% rename from test/js/samples/declaration-assignment/input.svelte rename to test/runtime/samples/reactive-assignment-in-declaration/main.svelte diff --git a/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js b/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js new file mode 100644 index 0000000000..df64f577df --- /dev/null +++ b/test/runtime/samples/reactive-assignment-in-for-loop-head/_config.js @@ -0,0 +1,3 @@ +export default { + html: `

0 0

` +}; \ No newline at end of file diff --git a/test/js/samples/declaration-assignment-for/input.svelte b/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte similarity index 87% rename from test/js/samples/declaration-assignment-for/input.svelte rename to test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte index 273489c966..1c24f364ac 100644 --- a/test/js/samples/declaration-assignment-for/input.svelte +++ b/test/runtime/samples/reactive-assignment-in-for-loop-head/main.svelte @@ -2,7 +2,7 @@ let foo1; let foo2; for (let bar = (foo1 = 0); bar < 5; bar += 1) { - foo1 = foo2; + foo2 = foo1; }