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

27 lines
465 B

let clicked = false;
function handler() {
clicked = true;
}
export default {
get props() {
return { tag: 'div', handler };
},
html: '<div>Foo</div>',
before_test() {
clicked = false;
},
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);
}
};