From 8e01d06db09214d0de9a22314702002c714496fa Mon Sep 17 00:00:00 2001 From: swyx Date: Sat, 15 Feb 2020 14:30:32 -0500 Subject: [PATCH] refix fixtures --- .../compile/render_dom/wrappers/EachBlock.ts | 7 +- .../debug-foo-bar-baz-things/expected.js | 70 ++++++------------- .../samples/debug-no-dependencies/expected.js | 6 +- 3 files changed, 25 insertions(+), 58 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/EachBlock.ts b/src/compiler/compile/render_dom/wrappers/EachBlock.ts index 05a6b88bf9..255481d496 100644 --- a/src/compiler/compile/render_dom/wrappers/EachBlock.ts +++ b/src/compiler/compile/render_dom/wrappers/EachBlock.ts @@ -377,12 +377,9 @@ export default class EachBlockWrapper extends Wrapper { block.chunks.init.push(b` const ${get_key} = #ctx => ${this.node.key.manipulate(block)}; - ${this.renderer.options.dev && - b`@validate_each_keys(#ctx, ${this.vars.each_block_value}, ${this.vars.get_each_context}, ${get_key});`} + ${this.renderer.options.dev && b`@validate_each_keys(#ctx, ${this.vars.each_block_value}, ${this.vars.get_each_context}, ${get_key});`} for (let #i = 0; #i < ${data_length}; #i += 1) { - let child_ctx = ${this.vars.get_each_context}(#ctx, ${ - this.vars.each_block_value - }, #i); + let child_ctx = ${this.vars.get_each_context}(#ctx, ${this.vars.each_block_value}, #i); let key = ${get_key}(child_ctx); ${lookup}.set(key, ${iterations}[#i] = ${create_each_block}(key, child_ctx)); } diff --git a/test/js/samples/debug-foo-bar-baz-things/expected.js b/test/js/samples/debug-foo-bar-baz-things/expected.js index 8ecbb570c1..0f3f67d6b8 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected.js @@ -55,11 +55,7 @@ function create_each_block(ctx) { insert_dev(target, t1, anchor); }, p: function update(ctx, dirty) { - if ( - dirty & /*things*/ 1 && - t0_value !== (t0_value = /*thing*/ ctx[4].name + "") - ) - set_data_dev(t0, t0_value); + if (dirty & /*things*/ 1 && t0_value !== (t0_value = /*thing*/ ctx[4].name + "")) set_data_dev(t0, t0_value); if (dirty & /*foo, bar, baz, things*/ 15) { const foo = /*foo*/ ctx[1]; @@ -113,9 +109,7 @@ function create_fragment(ctx) { add_location(p, file, 12, 0, 182); }, l: function claim(nodes) { - throw new Error( - "options.hydrate only works if the component was compiled with the `hydratable: true` option" - ); + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { for (let i = 0; i < each_blocks.length; i += 1) { @@ -181,15 +175,14 @@ function instance($$self, $$props, $$invalidate) { const writable_props = ["things", "foo", "bar", "baz"]; Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") - console.warn(` was created with unknown prop '${key}'`); + if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(` was created with unknown prop '${key}'`); }); $$self.$set = $$props => { - if ("things" in $$props) $$invalidate(0, (things = $$props.things)); - if ("foo" in $$props) $$invalidate(1, (foo = $$props.foo)); - if ("bar" in $$props) $$invalidate(2, (bar = $$props.bar)); - if ("baz" in $$props) $$invalidate(3, (baz = $$props.baz)); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); + if ("bar" in $$props) $$invalidate(2, bar = $$props.bar); + if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); }; $$self.$capture_state = () => { @@ -197,10 +190,10 @@ function instance($$self, $$props, $$invalidate) { }; $$self.$inject_state = $$props => { - if ("things" in $$props) $$invalidate(0, (things = $$props.things)); - if ("foo" in $$props) $$invalidate(1, (foo = $$props.foo)); - if ("bar" in $$props) $$invalidate(2, (bar = $$props.bar)); - if ("baz" in $$props) $$invalidate(3, (baz = $$props.baz)); + if ("things" in $$props) $$invalidate(0, things = $$props.things); + if ("foo" in $$props) $$invalidate(1, foo = $$props.foo); + if ("bar" in $$props) $$invalidate(2, bar = $$props.bar); + if ("baz" in $$props) $$invalidate(3, baz = $$props.baz); }; return [things, foo, bar, baz]; @@ -209,12 +202,7 @@ function instance($$self, $$props, $$invalidate) { class Component extends SvelteComponentDev { constructor(options) { super(options); - init(this, options, instance, create_fragment, safe_not_equal, { - things: 0, - foo: 1, - bar: 2, - baz: 3 - }); + init(this, options, instance, create_fragment, safe_not_equal, { things: 0, foo: 1, bar: 2, baz: 3 }); dispatch_dev("SvelteRegisterComponent", { component: this, @@ -244,52 +232,36 @@ class Component extends SvelteComponentDev { } get things() { - throw new Error( - ": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set things(value) { - throw new Error( - ": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get foo() { - throw new Error( - ": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set foo(value) { - throw new Error( - ": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get bar() { - throw new Error( - ": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set bar(value) { - throw new Error( - ": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } get baz() { - throw new Error( - ": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''"); } set baz(value) { - throw new Error( - ": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''" - ); + throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''"); } } -export default Component; +export default Component; \ No newline at end of file diff --git a/test/js/samples/debug-no-dependencies/expected.js b/test/js/samples/debug-no-dependencies/expected.js index d91e3cbb31..6f97e7936f 100644 --- a/test/js/samples/debug-no-dependencies/expected.js +++ b/test/js/samples/debug-no-dependencies/expected.js @@ -81,9 +81,7 @@ function create_fragment(ctx) { each_1_anchor = empty(); }, l: function claim(nodes) { - throw new Error( - "options.hydrate only works if the component was compiled with the `hydratable: true` option" - ); + throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); }, m: function mount(target, anchor) { for (let i = 0; i < each_blocks.length; i += 1) { @@ -149,4 +147,4 @@ class Component extends SvelteComponentDev { } } -export default Component; +export default Component; \ No newline at end of file