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.
svelte/test/runtime/samples/binding-input-checkbox-inde.../_config.js

43 lines
954 B

export default {
'skip-ssr': true,
data: {
indeterminate: true,
},
html: `
<input type="checkbox">
<p>checked? false</p>
<p>indeterminate? true</p>
`,
test(assert, component, target, window) {
const input = target.querySelector('input');
assert.equal(input.checked, false);
assert.equal(input.indeterminate, true);
const event = new window.Event('change');
input.checked = true;
input.indeterminate = false;
input.dispatchEvent(event);
assert.equal(component.get().indeterminate, false);
assert.equal(component.get().checked, true);
assert.htmlEqual(target.innerHTML, `
<input type="checkbox">
<p>checked? true</p>
<p>indeterminate? false</p>
`);
component.set({ indeterminate: true });
assert.equal(input.indeterminate, true);
assert.equal(input.checked, true);
assert.htmlEqual(target.innerHTML, `
<input type="checkbox">
<p>checked? true</p>
<p>indeterminate? true</p>
`);
},
};