mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 20:56:54 +08:00
FIX: ensures onSelect/onDeselect are called
This commit is contained in:
@ -835,3 +835,55 @@ componentTest("without forceEscape", {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("onSelect", {
|
||||
template:
|
||||
"<div class='test-external-action'></div>{{single-select content=content onSelect=(action externalAction)}}",
|
||||
|
||||
beforeEach() {
|
||||
this.set("externalAction", actual => {
|
||||
find(".test-external-action").text(actual);
|
||||
});
|
||||
|
||||
this.set("content", ["red", "blue"]);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
await this.get("subject").expand();
|
||||
await this.get("subject").selectRowByValue("red");
|
||||
|
||||
assert.equal(
|
||||
find(".test-external-action")
|
||||
.text()
|
||||
.trim(),
|
||||
"red"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("onDeselect", {
|
||||
template:
|
||||
"<div class='test-external-action'></div>{{single-select content=content onDeselect=(action externalAction)}}",
|
||||
|
||||
beforeEach() {
|
||||
this.set("externalAction", actual => {
|
||||
find(".test-external-action").text(actual);
|
||||
});
|
||||
|
||||
this.set("content", ["red", "blue"]);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
await this.get("subject").expand();
|
||||
await this.get("subject").selectRowByValue("red");
|
||||
await this.get("subject").expand();
|
||||
await this.get("subject").selectRowByValue("blue");
|
||||
|
||||
assert.equal(
|
||||
find(".test-external-action")
|
||||
.text()
|
||||
.trim(),
|
||||
"red"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user