mirror of https://github.com/sveltejs/svelte
31 lines
598 B
31 lines
598 B
export default {
|
|
html: `
|
|
<button>foo</button>
|
|
<button>bar</button>
|
|
<button>baz</button>
|
|
|
|
<p>fromDom: </p>
|
|
<p>fromState: </p>
|
|
`,
|
|
|
|
async test({ assert, component, target, window }) {
|
|
const event = new window.MouseEvent('click');
|
|
|
|
const buttons = target.querySelectorAll('button');
|
|
|
|
await buttons[1].dispatchEvent(event);
|
|
|
|
assert.htmlEqual(target.innerHTML, `
|
|
<button>foo</button>
|
|
<button>bar</button>
|
|
<button>baz</button>
|
|
|
|
<p>fromDom: bar</p>
|
|
<p>fromState: bar</p>
|
|
`);
|
|
|
|
assert.equal(component.fromDom, 'bar');
|
|
assert.equal(component.fromState, 'bar');
|
|
}
|
|
};
|