// https://github.com/sveltejs/svelte/issues/7884
export default {
async test({ assert, target, component, window }) {
let inputs = target.querySelectorAll('input');
assert.htmlEqual(
target.innerHTML,
`
{"foo":[],"bar":[]}
foo
bar
`
);
const event = new window.Event('change');
inputs[0].checked = true;
await inputs[0].dispatchEvent(event);
inputs[2].checked = true;
await inputs[2].dispatchEvent(event);
inputs[3].checked = true;
await inputs[3].dispatchEvent(event);
assert.htmlEqual(
target.innerHTML,
`
{"foo":[1,3],"bar":[1]}
foo
bar
`
);
await component.update();
assert.htmlEqual(
target.innerHTML,
`
{"foo":[1,3],"bar":[1],"qux":[]}
qux
`
);
inputs = target.querySelectorAll('input');
inputs[0].checked = true;
await inputs[0].dispatchEvent(event);
assert.htmlEqual(
target.innerHTML,
`
{"foo":[1,3],"bar":[1],"qux":[4]}
qux
`
);
assert.equal(inputs[0].checked, true);
assert.equal(inputs[1].checked, false);
assert.equal(inputs[2].checked, false);
}
};