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

26 lines
451 B

export default {
html: '<button>click me</button>',
test({ assert, component, target }) {
const button = target.querySelector('button');
const messages = [];
const log = console.log;
console.log = msg => {
messages.push(msg);
};
try {
button.dispatchEvent(new window.MouseEvent('click'));
assert.deepEqual(messages, [
'clicked'
]);
} catch (err) {
console.log = log;
throw err;
}
console.log = log;
}
};