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

25 lines
504 B

export default {
test ( assert, component, target, window ) {
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'
]);
}
};