From 8d0ec6e61e1d91a246ab70c1bf8158fe9c262ebc Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 23 Jun 2017 16:56:14 -0400 Subject: [PATCH 1/2] pass params to get_block (#667) --- src/generators/dom/visitors/IfBlock.ts | 4 +-- .../_config.js | 34 +++++++++++++++++++ .../main.html | 26 ++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js create mode 100644 test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/main.html diff --git a/src/generators/dom/visitors/IfBlock.ts b/src/generators/dom/visitors/IfBlock.ts index 117f9792523a..e7fecebefece 100644 --- a/src/generators/dom/visitors/IfBlock.ts +++ b/src/generators/dom/visitors/IfBlock.ts @@ -395,7 +395,7 @@ function compoundWithOutros( if (dynamic) { block.builders.update.addBlock(deindent` var ${previous_block_index} = ${current_block_index}; - ${current_block_index} = ${get_block}( state ); + ${current_block_index} = ${get_block}( ${params} ); if ( ${current_block_index} === ${previous_block_index} ) { ${if_current_block_index}${if_blocks}[ ${current_block_index} ].update( changed, ${params} ); } else { @@ -405,7 +405,7 @@ function compoundWithOutros( } else { block.builders.update.addBlock(deindent` var ${previous_block_index} = ${current_block_index}; - ${current_block_index} = ${get_block}( state ); + ${current_block_index} = ${get_block}( ${params} ); if ( ${current_block_index} !== ${previous_block_index} ) { ${changeBlock} } diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js new file mode 100644 index 000000000000..f07a897d2089 --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js @@ -0,0 +1,34 @@ +export default { + solo: true, + + data: { + foo: false, + threshold: 5 + }, + + html: ` +
1
+
2
+
3
+
4
+
5
+ `, + + test ( assert, component, target, window, raf ) { + const divs = target.querySelectorAll('div'); + + raf.tick(100); + + component.set({ threshold: 4 }); + + raf.tick( 200 ); + assert.htmlEqual(target.innerHTML, ` +
1
+
2
+
3
+
4
+ `); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/main.html b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/main.html new file mode 100644 index 000000000000..d68c95e8b038 --- /dev/null +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/main.html @@ -0,0 +1,26 @@ +{{#each [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as number}} + {{#if foo}} + {{#if threshold >= number}} +
{{number}}
+ {{/if}} + {{else}} + {{#if threshold >= number}} +
{{number}}
+ {{/if}} + {{/if}} +{{/each}} + + \ No newline at end of file From f24db0bc734b715384b353a6647a8a32941026ec Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 23 Jun 2017 16:58:08 -0400 Subject: [PATCH 2/2] reenable tests --- .../transition-js-if-block-in-each-block-bidi-2/_config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js index f07a897d2089..60115a0351b1 100644 --- a/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js +++ b/test/runtime/samples/transition-js-if-block-in-each-block-bidi-2/_config.js @@ -1,6 +1,4 @@ export default { - solo: true, - data: { foo: false, threshold: 5