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/generator/component-events-data/_config.js

25 lines
504 B

8 years ago
export default {
test ( assert, component, target, window ) {
8 years ago
const buttons = target.querySelectorAll( 'button' );
const click = new window.MouseEvent( 'click' );
const selected = [];
component.on( 'select', selection => {
selected.push( selection );
});
buttons[1].dispatchEvent( click );
buttons[2].dispatchEvent( click );
buttons[1].dispatchEvent( click );
buttons[0].dispatchEvent( click );
assert.deepEqual( selected, [
'bar',
'baz',
'bar',
'foo'
]);
}
};