From fcb1a3c296c4dfaf14c9900be5bcce0410e0a802 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 24 Feb 2017 16:43:07 -0500 Subject: [PATCH] failing test for first bug in #290 --- .../component-events-each/Widget.html | 1 + .../component-events-each/_config.js | 27 +++++++++++++++++++ .../generator/component-events-each/main.html | 19 +++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 test/generator/component-events-each/Widget.html create mode 100644 test/generator/component-events-each/_config.js create mode 100644 test/generator/component-events-each/main.html diff --git a/test/generator/component-events-each/Widget.html b/test/generator/component-events-each/Widget.html new file mode 100644 index 0000000000..ad81b51f15 --- /dev/null +++ b/test/generator/component-events-each/Widget.html @@ -0,0 +1 @@ + diff --git a/test/generator/component-events-each/_config.js b/test/generator/component-events-each/_config.js new file mode 100644 index 0000000000..25635556a0 --- /dev/null +++ b/test/generator/component-events-each/_config.js @@ -0,0 +1,27 @@ +export default { + data: { + items: [ 'a', 'b', 'c' ] + }, + + html: ` +
+ `, + + test ( assert, component, target, window ) { + const buttons = target.querySelectorAll( 'button' ); + + const clicks = []; + + component.on( 'foo', item => { + clicks.push( item ); + }); + + const event = new window.MouseEvent( 'click' ); + + buttons[0].dispatchEvent( event ); + buttons[2].dispatchEvent( event ); + + assert.deepEqual( clicks, [ 'a', 'c' ]); + component.teardown(); + } +}; diff --git a/test/generator/component-events-each/main.html b/test/generator/component-events-each/main.html new file mode 100644 index 0000000000..e429f3f303 --- /dev/null +++ b/test/generator/component-events-each/main.html @@ -0,0 +1,19 @@ +
+ {{#each items as item}} + + {{/each}} +
+ +