Skip to content

Commit

Permalink
Merge 6601b63 into 00f403c
Browse files Browse the repository at this point in the history
  • Loading branch information
platosha committed Mar 19, 2019
2 parents 00f403c + 6601b63 commit f47386e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-checkbox.html
Expand Up @@ -309,7 +309,7 @@

_toggleChecked() {
this.checked = !this.checked;
this.dispatchEvent(new CustomEvent('change', {composed: true, bubbles: true}));
this.dispatchEvent(new CustomEvent('change', {composed: false, bubbles: true}));
}

/**
Expand Down
8 changes: 8 additions & 0 deletions test/vaadin-checkbox-group_test.html
Expand Up @@ -210,6 +210,14 @@
expect(vaadinCheckboxList[0].checked).to.be.false;
});

it('should not fire change event on programmatic value change', () => {
const spy = sinon.spy();
vaadinCheckboxGroup.addEventListener('change', spy);

vaadinCheckboxGroup.value = ['2'];

expect(spy).to.not.be.called;
});
});

describe('vaadin-checkbox-group validation', () => {
Expand Down
20 changes: 20 additions & 0 deletions test/vaadin-checkbox_test.html
Expand Up @@ -334,6 +334,26 @@
vaadinCheckbox.addEventListener('change', () => done());
vaadinCheckbox.click();
});

it('should bubble', () => {
const spy = sinon.spy();
vaadinCheckbox.addEventListener('change', spy);

vaadinCheckbox.click();

const event = spy.getCall(0).args[0];
expect(event).to.have.property('bubbles', true);
});

it('should not be composed', () => {
const spy = sinon.spy();
vaadinCheckbox.addEventListener('change', spy);

vaadinCheckbox.click();

const event = spy.getCall(0).args[0];
expect(event).to.have.property('composed', false);
});
});

describe('iron-form-checkbox', () => {
Expand Down

0 comments on commit f47386e

Please sign in to comment.