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.
51 lines
970 B
51 lines
970 B
6 years ago
|
export default {
|
||
|
html: `
|
||
|
<div>
|
||
|
<input type="checkbox"><p>one</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<input type="checkbox"><p>two</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<input type="checkbox"><p>three</p>
|
||
|
</div>
|
||
|
`,
|
||
|
|
||
|
ssrHtml: `
|
||
|
<div>
|
||
|
<input type="checkbox"><p>one</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<input type="checkbox"><p>two</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<input type="checkbox"><p>three</p>
|
||
|
</div>
|
||
|
`,
|
||
|
|
||
|
async test({ assert, component, target, window }) {
|
||
|
const inputs = [ ...target.querySelectorAll('input') ];
|
||
|
|
||
|
const event = new window.Event('change');
|
||
|
|
||
|
inputs[1].checked = true;
|
||
|
await inputs[1].dispatchEvent(event);
|
||
|
|
||
|
await component.clear();
|
||
|
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div><input type="checkbox"><p>one</p></div>
|
||
|
<div><input type="checkbox"><p>three</p></div>
|
||
|
`);
|
||
|
|
||
|
inputs[1].checked = true;
|
||
|
await inputs[1].dispatchEvent(event);
|
||
|
|
||
|
await component.clear();
|
||
|
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<div><input type="checkbox"><p>one</p></div>
|
||
|
`);
|
||
|
}
|
||
|
};
|