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.
69 lines
1.3 KiB
69 lines
1.3 KiB
4 years ago
|
export default {
|
||
|
html: `
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
`,
|
||
|
async test({ assert, component, target, window }) {
|
||
|
const [button1, button2, button3] = target.querySelectorAll('button');
|
||
|
const event = new window.MouseEvent('click');
|
||
|
|
||
|
await button1.dispatchEvent(event);
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
`);
|
||
|
|
||
|
await button2.dispatchEvent(event);
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 0 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
`);
|
||
|
|
||
|
await button3.dispatchEvent(event);
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
hello world 1 hello
|
||
|
<button>Increment</button>
|
||
|
</div>
|
||
|
`);
|
||
|
}
|
||
|
};
|