mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
[FIX] better control on value mutation
This commit is contained in:
@ -275,3 +275,19 @@ componentTest('supports keyboard events', {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
componentTest('supports mutating value when no value given', {
|
||||
template: '{{select-box-kit value=value content=content}}',
|
||||
|
||||
beforeEach() {
|
||||
this.set("value", "");
|
||||
this.set("content", [{ id: "1", name: "robin"}, {id: "2", name: "régis" }]);
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
andThen(() => {
|
||||
assert.equal(this.get("value"), "1");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -23,6 +23,13 @@ componentTest('default', {
|
||||
assert.equal(selectBox().header.name(), "Topic Controls");
|
||||
assert.equal(selectBox().rowByIndex(0).name(), "Bookmark");
|
||||
assert.equal(selectBox().rowByIndex(1).name(), "Share");
|
||||
assert.equal(selectBox().selectedRow.el.length, 0, "it doesn’t preselect first row");
|
||||
});
|
||||
|
||||
selectBoxSelectRow("share");
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(this.get("value"), null, "it resets the value");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user