You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/select-change-handler/_config.js

23 lines
515 B

export default {
8 years ago
data: {
options: [ { id: 'a' }, { id: 'b' }, { id: 'c' } ],
selected: 'b'
},
8 years ago
test ( assert, component, target, window ) {
const select = target.querySelector( 'select' );
assert.equal( select.value, 'b' );
8 years ago
const event = new window.Event( 'change' );
8 years ago
select.value = 'c';
select.dispatchEvent( event );
8 years ago
assert.equal( select.value, 'c' );
assert.equal( component.get( 'lastChangedTo' ), 'c' );
assert.equal( component.get( 'selected' ), 'c' );
8 years ago
component.destroy();
}
};