add unit test

pull/591/head
Conduitry 8 years ago
parent 228417e1dc
commit a3860f277e

@ -0,0 +1,15 @@
export default {
test ( assert, component, target, window ) {
const selects = document.querySelectorAll( 'select' );
const event1 = new window.Event( 'change' );
selects[0].value = 'b';
selects[0].dispatchEvent(event1);
const event2 = new window.Event( 'change' );
selects[1].value = 'b';
selects[1].dispatchEvent(event2);
assert.deepEqual( component.get( 'log' ), [ 1, 2 ] );
}
};

@ -0,0 +1,19 @@
{{#each foo as bar}}
<select on:change='handler(bar)'>
<option>a</option>
<option>b</option>
</select>
{{/each}}
<script>
export default {
data: () => ({ foo: [ 1, 2 ], log: [] }),
methods: {
handler ( bar ) {
let { log } = this.get();
log.push( bar );
this.set( { log } );
}
}
}
</script>
Loading…
Cancel
Save