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/empty-component-destroy/_config.js

26 lines
536 B

let log;
export default {
html: `
<button>destroy component</button>
`,
before_test() {
log = console.log;
},
after_test() {
console.log = log;
},
async test({ assert, target, window }) {
const button = target.querySelector('button');
const event = new window.MouseEvent('click');
const messages = [];
console.log = msg => messages.push(msg);
await button.dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<button>destroy component</button>
`);
assert.deepEqual(messages, ['destroy']);
}
};