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/component-binding-reactive-.../_config.js

39 lines
871 B

export default {
html: `
<button>main 0</button>
<button>button 0</button>
`,
async test({ assert, target, window }) {
const event = new window.MouseEvent('click');
const buttons = target.querySelectorAll('button');
await buttons[0].dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<button>main 1</button>
<button>button 1</button>
`);
await buttons[1].dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<button>main 2</button>
<button>button 2</button>
`);
// reactive update, reset to 2
await buttons[0].dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<button>main 2</button>
<button>button 2</button>
`);
// bound to main, reset to 2
await buttons[1].dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<button>main 2</button>
<button>button 2</button>
`);
}
};