export default {
html: `
Checked:
a
b
c
d
a
b
c
d
`,
async test({ assert, component, target, window }) {
const inputs = target.querySelectorAll('input');
const p = target.querySelector('p');
assert.equal(inputs[0].checked, false);
assert.equal(inputs[1].checked, false);
assert.equal(inputs[2].checked, false);
assert.equal(inputs[3].checked, false);
assert.equal(inputs[4].checked, false);
assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, false);
const event = new window.Event('change');
inputs[0].checked = true;
await inputs[0].dispatchEvent(event);
assert.htmlEqual(p.innerHTML, 'Checked: a');
assert.equal(inputs[0].checked, true);
assert.equal(inputs[1].checked, false);
assert.equal(inputs[2].checked, false);
assert.equal(inputs[3].checked, false);
assert.equal(inputs[4].checked, true);
assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, false);
inputs[3].checked = true;
await inputs[3].dispatchEvent(event);
assert.htmlEqual(p.innerHTML, 'Checked: a,d');
assert.equal(inputs[0].checked, true);
assert.equal(inputs[1].checked, false);
assert.equal(inputs[2].checked, false);
assert.equal(inputs[3].checked, true);
assert.equal(inputs[4].checked, true);
assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, true);
inputs[4].checked = false;
await inputs[4].dispatchEvent(event);
assert.htmlEqual(p.innerHTML, 'Checked: d');
assert.equal(inputs[0].checked, false);
assert.equal(inputs[1].checked, false);
assert.equal(inputs[2].checked, false);
assert.equal(inputs[3].checked, true);
assert.equal(inputs[4].checked, false);
assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, true);
}
};