From 2987260e9887d9f511979eeb654889b8d53482f0 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 1 Jan 2021 19:27:45 -0500 Subject: [PATCH] fix indentation --- .../render_dom/wrappers/Element/Binding.ts | 22 ++++---- .../shared/mark_each_block_bindings.ts | 50 +++++++++---------- .../binding-input-group-each-7/_config.js | 26 +++++----- .../binding-input-group-each-7/main.svelte | 20 ++++---- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts index f8754eca87..7c8a339d00 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts @@ -259,18 +259,18 @@ function get_binding_group(renderer: Renderer, value: Binding, block: Block) { const contexts = []; const contextual_dependencies = new Set(); - const { template_scope } = value.expression; - const add_contextual_dependency = (dep: string) => { + const { template_scope } = value.expression; + const add_contextual_dependency = (dep: string) => { contextual_dependencies.add(dep); - const owner = template_scope.get_owner(dep); - if (owner.type === 'EachBlock') { - for (const dep of owner.expression.contextual_dependencies) { - add_contextual_dependency(dep); - } - } - }; - for (const dep of value.expression.contextual_dependencies) { - add_contextual_dependency(dep); + const owner = template_scope.get_owner(dep); + if (owner.type === 'EachBlock') { + for (const dep of owner.expression.contextual_dependencies) { + add_contextual_dependency(dep); + } + } + }; + for (const dep of value.expression.contextual_dependencies) { + add_contextual_dependency(dep); } for (const dep of contextual_dependencies) { diff --git a/src/compiler/compile/render_dom/wrappers/shared/mark_each_block_bindings.ts b/src/compiler/compile/render_dom/wrappers/shared/mark_each_block_bindings.ts index c1e693acb5..df7185bb69 100644 --- a/src/compiler/compile/render_dom/wrappers/shared/mark_each_block_bindings.ts +++ b/src/compiler/compile/render_dom/wrappers/shared/mark_each_block_bindings.ts @@ -4,31 +4,31 @@ import ElementWrapper from '../Element'; import Binding from '../../../nodes/Binding'; export default function mark_each_block_bindings( - parent: ElementWrapper | InlineComponentWrapper, - binding: Binding + parent: ElementWrapper | InlineComponentWrapper, + binding: Binding ) { - // we need to ensure that the each block creates a context including - // the list and the index, if they're not otherwise referenced - binding.expression.references.forEach(name => { - const each_block = parent.node.scope.get_owner(name); - if (each_block) { - (each_block as EachBlock).has_binding = true; - } - }); + // we need to ensure that the each block creates a context including + // the list and the index, if they're not otherwise referenced + binding.expression.references.forEach(name => { + const each_block = parent.node.scope.get_owner(name); + if (each_block) { + (each_block as EachBlock).has_binding = true; + } + }); - if (binding.name === 'group') { - const add_index_binding = (name: string) => { - const each_block = parent.node.scope.get_owner(name); - if (each_block.type === 'EachBlock') { - each_block.has_index_binding = true; - for (const dep of each_block.expression.contextual_dependencies) { - add_index_binding(dep); - } - } - }; - // for ``, we make sure that all the each blocks creates context with `index` - for (const name of binding.expression.contextual_dependencies) { - add_index_binding(name); - } - } + if (binding.name === 'group') { + const add_index_binding = (name: string) => { + const each_block = parent.node.scope.get_owner(name); + if (each_block.type === 'EachBlock') { + each_block.has_index_binding = true; + for (const dep of each_block.expression.contextual_dependencies) { + add_index_binding(dep); + } + } + }; + // for ``, we make sure that all the each blocks creates context with `index` + for (const name of binding.expression.contextual_dependencies) { + add_index_binding(name); + } + } } diff --git a/test/runtime/samples/binding-input-group-each-7/_config.js b/test/runtime/samples/binding-input-group-each-7/_config.js index a8b8942e8d..3063141983 100644 --- a/test/runtime/samples/binding-input-group-each-7/_config.js +++ b/test/runtime/samples/binding-input-group-each-7/_config.js @@ -1,5 +1,5 @@ export default { - html: ` + html: ` @@ -20,34 +20,34 @@ export default { `, - async test({ assert, component, target, window }) { - const inputs = target.querySelectorAll('input'); + async test({ assert, component, target, window }) { + const inputs = target.querySelectorAll('input'); const checked = new Set(); const checkInbox = async (i) => { checked.add(i); inputs[i].checked = true; - await inputs[i].dispatchEvent(event); + await inputs[i].dispatchEvent(event); }; - for (let i = 0; i < 18; i++) { - assert.equal(inputs[i].checked, checked.has(i)); - } + for (let i = 0; i < 18; i++) { + assert.equal(inputs[i].checked, checked.has(i)); + } - const event = new window.Event('change'); + const event = new window.Event('change'); await checkInbox(2); for (let i = 0; i < 18; i++) { - assert.equal(inputs[i].checked, checked.has(i)); + assert.equal(inputs[i].checked, checked.has(i)); } await checkInbox(12); for (let i = 0; i < 18; i++) { - assert.equal(inputs[i].checked, checked.has(i)); + assert.equal(inputs[i].checked, checked.has(i)); } await checkInbox(8); for (let i = 0; i < 18; i++) { - assert.equal(inputs[i].checked, checked.has(i)); - } - } + assert.equal(inputs[i].checked, checked.has(i)); + } + } }; diff --git a/test/runtime/samples/binding-input-group-each-7/main.svelte b/test/runtime/samples/binding-input-group-each-7/main.svelte index 422cbca07d..6680a49f32 100644 --- a/test/runtime/samples/binding-input-group-each-7/main.svelte +++ b/test/runtime/samples/binding-input-group-each-7/main.svelte @@ -1,15 +1,15 @@ {#each list as { id, data }} - {#each data as item} - - - - {/each} + {#each data as item} + + + + {/each} {/each}