mirror of https://github.com/sveltejs/svelte
https://github.com/sveltejs/svelte/issues/1104 https://github.com/sveltejs/svelte/issues/1263pull/1264/head
parent
bc416a538f
commit
63421744b8
@ -0,0 +1,42 @@
|
|||||||
|
export default {
|
||||||
|
'skip-ssr': true,
|
||||||
|
|
||||||
|
data: {
|
||||||
|
indeterminate: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<input type="radio">
|
||||||
|
<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="radio">
|
||||||
|
<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="radio">
|
||||||
|
<p>checked? true</p>
|
||||||
|
<p>indeterminate? true</p>
|
||||||
|
`);
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
<input type='radio' bind:checked bind:indeterminate>
|
||||||
|
<p>checked? {{checked}}</p>
|
||||||
|
<p>indeterminate? {{indeterminate}}</p>
|
Loading…
Reference in new issue