failing test for bound event handler on <select> elements

pull/521/head
Tobias Davis 8 years ago committed by Conduitry
parent fbfd011ff4
commit 33fb0df51a

@ -0,0 +1,22 @@
export default {
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' );
const event = new window.Event( 'update' );
select.value = 'c';
select.dispatchEvent( event );
assert.equal( select.value, 'c' );
assert.equal( component.get( 'lastChangedTo' ), 'c' );
assert.equal( component.get( 'selected' ), 'c' );
component.destroy();
}
};

@ -0,0 +1,15 @@
<select bind:value="selected" on:change="updateLastChangedTo(selected)">
{{#each options as option}}
<option value="{{option.id}}">{{option.id}}</option>
{{/each}}
</select>
<script>
export default {
methods: {
updateLastChangedTo(result) {
this.set({ lastChangedTo: result })
}
}
}
</script>
Loading…
Cancel
Save