Skip to content

Commit fcb1a3c

Browse files
committed
failing test for first bug in #290
1 parent b31ecc5 commit fcb1a3c

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<button on:click='fire("foo")'>click me</button>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default {
2+
data: {
3+
items: [ 'a', 'b', 'c' ]
4+
},
5+
6+
html: `
7+
<div><button>click me</button><button>click me</button><button>click me</button></div>
8+
`,
9+
10+
test ( assert, component, target, window ) {
11+
const buttons = target.querySelectorAll( 'button' );
12+
13+
const clicks = [];
14+
15+
component.on( 'foo', item => {
16+
clicks.push( item );
17+
});
18+
19+
const event = new window.MouseEvent( 'click' );
20+
21+
buttons[0].dispatchEvent( event );
22+
buttons[2].dispatchEvent( event );
23+
24+
assert.deepEqual( clicks, [ 'a', 'c' ]);
25+
component.teardown();
26+
}
27+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div>
2+
{{#each items as item}}
3+
<Widget on:foo='foo(item)'/>
4+
{{/each}}
5+
</div>
6+
7+
<script>
8+
import Widget from './Widget.html';
9+
10+
export default {
11+
components: { Widget },
12+
13+
methods: {
14+
foo ( item ) {
15+
this.fire( 'foo', item );
16+
}
17+
}
18+
};
19+
</script>

0 commit comments

Comments
 (0)