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

25 lines
489 B

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