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

30 lines
787 B

export default {
html: `
<button>action</button>
`,
async test({ assert, component, target, window }) {
const button = target.querySelector('button');
const enter = new window.MouseEvent('mouseenter');
const leave = new window.MouseEvent('mouseleave');
const ctrlPress = new window.KeyboardEvent('keydown', { ctrlKey: true });
await button.dispatchEvent(enter);
assert.htmlEqual(target.innerHTML, `
<button>action</button>
<div class="tooltip">Perform an Action</div>
`);
await window.dispatchEvent(ctrlPress);
assert.htmlEqual(target.innerHTML, `
<button>action</button>
<div class="tooltip">Perform an augmented Action</div>
`);
await button.dispatchEvent(leave);
assert.htmlEqual(target.innerHTML, `
<button>action</button>
`);
}
};