mirror of https://github.com/sveltejs/svelte
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.
22 lines
363 B
22 lines
363 B
2 years ago
|
let clicked = false;
|
||
|
function handler() {
|
||
|
clicked = true;
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
handler
|
||
|
},
|
||
|
html: '<button>Foo</button>',
|
||
|
|
||
|
test({ assert, target }) {
|
||
|
assert.equal(clicked, false);
|
||
|
|
||
|
const button = target.querySelector('button');
|
||
|
const click = new window.MouseEvent('click');
|
||
|
button.dispatchEvent(click);
|
||
|
|
||
|
assert.equal(clicked, true);
|
||
|
}
|
||
|
};
|