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/hydration/samples/event-handler/_config.js

26 lines
493 B

export default {
props: {
clicked: false
},
snapshot(target) {
const button = target.querySelector('button');
return {
button
};
},
async test(assert, target, snapshot, component, window) {
const button = target.querySelector('button');
assert.equal(button, snapshot.button);
await button.dispatchEvent(new window.MouseEvent('click'));
assert.ok(component.clicked);
assert.htmlEqual(target.innerHTML, `
<button>click me</button>
<p>clicked!</p>
`);
}
};