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

23 lines
376 B

export default {
html: `<input>`,
test({ assert, component, target, window }) {
const input = target.querySelector('input');
const event = new window.KeyboardEvent('keydown', {
key: 'Enter'
});
let blurred = false;
input.focus();
input.addEventListener('blur', () => {
blurred = true;
});
input.dispatchEvent(event);
assert.ok(blurred);
},
};