[FIX] better control on value mutation

This commit is contained in:
Joffrey JAFFEUX
2017-10-20 13:40:56 -07:00
committed by GitHub
parent 383191cafc
commit ae1e4de286
4 changed files with 48 additions and 12 deletions

View File

@ -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");
});
}
});

View File

@ -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");
});
}
});