From 33fb0df51abf9a3e20da447d845fb01c7b4857b2 Mon Sep 17 00:00:00 2001 From: Tobias Davis Date: Fri, 21 Apr 2017 12:15:47 -0500 Subject: [PATCH 1/4] failing test for bound event handler on + {{#each options as option}} + + {{/each}} + + + \ No newline at end of file From 51cd9e8aba9e6c180527e8b94352be8215328daf Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 21 Apr 2017 14:28:14 -0400 Subject: [PATCH 2/4] fix unit test? --- .../samples/select-change-handler/_config.js | 30 +++++++++---------- .../samples/select-change-handler/main.html | 22 +++++++------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/test/runtime/samples/select-change-handler/_config.js b/test/runtime/samples/select-change-handler/_config.js index 2a9bb61bd119..015c8182b41c 100644 --- a/test/runtime/samples/select-change-handler/_config.js +++ b/test/runtime/samples/select-change-handler/_config.js @@ -1,22 +1,22 @@ export default { - data: { - options: [ { id: 'a' }, { id: 'b' }, { id: 'c' } ], - selected: 'b' - }, + data: { + options: [ { id: 'a' }, { id: 'b' }, { id: 'c' } ], + selected: 'b' + }, - test ( assert, component, target, window ) { - const select = target.querySelector( 'select' ); - assert.equal( select.value, 'b' ); + test ( assert, component, target, window ) { + const select = target.querySelector( 'select' ); + assert.equal( select.value, 'b' ); - const event = new window.Event( 'update' ); + const event = new window.Event( 'change' ); - select.value = 'c'; - select.dispatchEvent( event ); + select.value = 'c'; + select.dispatchEvent( event ); - assert.equal( select.value, 'c' ); - assert.equal( component.get( 'lastChangedTo' ), 'c' ); - assert.equal( component.get( 'selected' ), 'c' ); + assert.equal( select.value, 'c' ); + assert.equal( component.get( 'lastChangedTo' ), 'c' ); + assert.equal( component.get( 'selected' ), 'c' ); - component.destroy(); - } + component.destroy(); + } }; diff --git a/test/runtime/samples/select-change-handler/main.html b/test/runtime/samples/select-change-handler/main.html index 8a62fd263528..48376dfa93fb 100644 --- a/test/runtime/samples/select-change-handler/main.html +++ b/test/runtime/samples/select-change-handler/main.html @@ -1,15 +1,15 @@ \ No newline at end of file + export default { + methods: { + updateLastChangedTo(result) { + this.set({ lastChangedTo: result }); + } + } + }; + From e52c6b84b5e35fe50e80df16826f2e7f17956403 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 21 Apr 2017 16:49:19 -0400 Subject: [PATCH 3/4] visit all attributes of select elements after visiting children --- .../dom/visitors/Element/Element.js | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/generators/dom/visitors/Element/Element.js b/src/generators/dom/visitors/Element/Element.js index c4bf6c6af472..bcbce6004a00 100644 --- a/src/generators/dom/visitors/Element/Element.js +++ b/src/generators/dom/visitors/Element/Element.js @@ -56,20 +56,19 @@ export default function visitElement ( generator, block, state, node ) { block.builders.create.addLine( `${generator.helper( 'setAttribute' )}( ${name}, '${generator.cssId}', '' );` ); } - let selectValueAttribute; - - node.attributes - .sort( ( a, b ) => order[ a.type ] - order[ b.type ] ) - .forEach( attribute => { - // value attributes are an annoying special case — it must be handled + // *after* its children have been updated + visitAttributes(); + } // special case – bound