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/dynamic-component-events/_config.js

25 lines
485 B

export default {
props: {
x: true
},
html: `
<button>select foo</button>
`,
test({ assert, component, target, window }) {
const click = new window.MouseEvent('click');
target.querySelector('button').dispatchEvent(click);
assert.equal(component.selected, 'foo');
component.x = false;
assert.htmlEqual(target.innerHTML, `
<button>select bar</button>
`);
target.querySelector('button').dispatchEvent(click);
assert.equal(component.selected, 'bar');
}
};