FIX: prevents click on sk header to bubble (#9084)

This commit is contained in:
Joffrey JAFFEUX 2020-03-02 20:06:02 +01:00 committed by GitHub
parent d05142d3f7
commit ed85cfe141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -13,6 +13,7 @@ export default Component.extend(UtilsMixin, {
return;
if (this.eventType !== "click" || event.button !== 0) return;
this.selectKit.toggle(event);
return false;
},
classNames: ["select-kit-header"],

View File

@ -238,3 +238,22 @@ componentTest("selected value can be 0", {
assert.equal(this.subject.header().value(), 0);
}
});
componentTest("prevents propagating click event on header", {
template:
"{{#d-button icon='times' action=onClick}}{{single-select value=value content=content}}{{/d-button}}",
beforeEach() {
this.setProperties({
onClick: () => this.set("value", "foo"),
content: DEFAULT_CONTENT,
value: DEFAULT_VALUE
});
},
async test(assert) {
assert.equal(this.value, DEFAULT_VALUE);
await this.subject.expand();
assert.equal(this.value, DEFAULT_VALUE);
}
});