mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 00:46:29 +01:00
f45e2b70fd
This also includes elements of RFCs 2 and 3
43 lines
952 B
JavaScript
43 lines
952 B
JavaScript
export default {
|
|
skip_if_ssr: true,
|
|
|
|
props: {
|
|
indeterminate: true,
|
|
},
|
|
|
|
html: `
|
|
<input type="checkbox">
|
|
<p>checked? false</p>
|
|
<p>indeterminate? true</p>
|
|
`,
|
|
|
|
async 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;
|
|
await input.dispatchEvent(event);
|
|
|
|
assert.equal(component.indeterminate, false);
|
|
assert.equal(component.checked, true);
|
|
assert.htmlEqual(target.innerHTML, `
|
|
<input type="checkbox">
|
|
<p>checked? true</p>
|
|
<p>indeterminate? false</p>
|
|
`);
|
|
|
|
component.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>
|
|
`);
|
|
},
|
|
};
|