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/_config.js

32 lines
625 B

export default {
props: {
foo: true
},
html: `
<input type="checkbox">
<p>true</p>
`,
ssrHtml: `
<input type="checkbox" checked>
<p>true</p>
`,
async test({ assert, component, target, window }) {
const input = target.querySelector('input');
assert.equal(input.checked, true);
const event = new window.Event('change');
input.checked = false;
await input.dispatchEvent(event);
assert.equal(target.innerHTML, `<input type="checkbox">\n<p>false</p>`);
component.foo = true;
assert.equal(input.checked, true);
assert.equal(target.innerHTML, `<input type="checkbox">\n<p>true</p>`);
}
};