Skip to content

Commit

Permalink
failing test for #910
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Nov 12, 2017
1 parent be0837e commit 7be5b70
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export default {
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, true);

const event = new window.Event('change');

input.checked = true;
input.dispatchEvent(event);

assert.equal(component.get('indeterminate'), false);
assert.equal(component.get('checked'), true);
assert.equal(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, false);
assert.equal(target.innerHTML, `
<input type="checkbox">
<p>checked? false</p>
<p>indeterminate? true</p>
`);

// TODO what is the behaviour when setting both `checked`
// and `indeterminate` to conflicting values simultaneously?
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<input type='checkbox' bind:checked bind:indeterminate>
<p>checked? {{checked}}</p>
<p>indeterminate? {{indeterminate}}</p>

0 comments on commit 7be5b70

Please sign in to comment.