Skip to content
Permalink
Browse files

FIX: value-list choices when removing a value

Fixes an issue where choices were broken when removing an item from the value-list component.

Adds test case for this scenario.
  • Loading branch information
pmusaraj committed Feb 14, 2020
1 parent dafa354 commit 89d9704194c837f027f428fc370247c52e361266
@@ -73,11 +73,10 @@ export default Component.extend({
_removeValue(value) {
this.collection.removeObject(value);

const item = { id: value, name: value };
if (this.choices) {
this.choices.addObject(item);
this.set("choices", this.choices.push(value).uniq());
} else {
this.set("choices", makeArray(item));
this.set("choices", makeArray(value));
}

this._saveValues();
@@ -45,6 +45,14 @@ componentTest("removing a value", {
);

assert.equal(this.values, "osama", "it removes the expected value");

await selectKit().expand();

assert.ok(
find(".select-kit-collection li.select-kit-row span.name")[0]
.innerText === "vinkas",
"it adds the removed value to choices"
);
}
});

0 comments on commit 89d9704

Please sign in to comment.
You can’t perform that action at this time.