mirror of https://github.com/sveltejs/svelte
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.
31 lines
597 B
31 lines
597 B
6 years ago
|
export default {
|
||
|
html: `
|
||
|
<button>0: foo</button>
|
||
|
<button>1: bar</button>
|
||
|
<button>2: baz</button>
|
||
|
|
||
|
<p>first: </p>
|
||
|
<p>second: </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>0: foo</button>
|
||
|
<button>1: bar</button>
|
||
|
<button>2: baz</button>
|
||
|
|
||
|
<p>first: 1</p>
|
||
|
<p>second: bar</p>
|
||
|
`);
|
||
|
|
||
|
assert.equal(component.first, '1');
|
||
|
assert.equal(component.second, 'bar');
|
||
|
}
|
||
|
};
|