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

31 lines
535 B

export default {
props: {
items: ['a', 'b', 'c']
},
html: `
<div>
<button>click me</button>
<button>click me</button>
<button>click me</button>
</div>
`,
test({ assert, component, target, window }) {
const buttons = target.querySelectorAll('button');
const clicks = [];
component.$on('foo', event => {
clicks.push(event.detail);
});
const event = new window.MouseEvent('click');
buttons[0].dispatchEvent(event);
buttons[2].dispatchEvent(event);
assert.deepEqual(clicks, ['a', 'c']);
}
};