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/dynamic-element-event-handler2/_config.js

24 lines
410 B

let clicked = false;
function handler() {
clicked = true;
}
export default {
props: {
tag: 'div',
handler
},
html: '<div>Foo</div>',
test({ assert, component, target }) {
assert.equal(clicked, false);
component.tag = 'button';
const button = target.querySelector('button');
const click = new window.MouseEvent('click');
button.dispatchEvent(click);
assert.equal(clicked, true);
}
};