mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FIX: better headerText handling on select-box
This commit is contained in:
@ -272,3 +272,44 @@ componentTest('supports converting select value to integer', {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
componentTest('dynamic headerText', {
|
||||
template: '{{select-box value=1 content=content}}',
|
||||
|
||||
beforeEach() {
|
||||
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
click(".select-box-header");
|
||||
andThen(() => {
|
||||
assert.equal(find(".select-box-header .current-selection").html().trim(), "robin");
|
||||
});
|
||||
|
||||
click(".select-box-row[title='regis']");
|
||||
andThen(() => {
|
||||
assert.equal(find(".select-box-header .current-selection").html().trim(), "regis", "it changes header text");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
componentTest('static headerText', {
|
||||
template: '{{select-box value=1 content=content dynamicHeaderText=false headerText=headerText}}',
|
||||
|
||||
beforeEach() {
|
||||
this.set("content", [{ id: 1, text: "robin" }, { id: 2, text: "regis" }]);
|
||||
this.set("headerText", "Choose...");
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
click(".select-box-header");
|
||||
andThen(() => {
|
||||
assert.equal(find(".select-box-header .current-selection").html().trim(), "Choose...");
|
||||
});
|
||||
|
||||
click(".select-box-row[title='regis']");
|
||||
andThen(() => {
|
||||
assert.equal(find(".select-box-header .current-selection").html().trim(), "Choose...", "it doesn’t change header text");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user