From dbadebacd17c31a2dceae4b36dfbd39bef67e678 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 1 Dec 2017 20:02:00 +0100 Subject: [PATCH] FIX: allows select-kit to search by null value --- .../select-kit/components/single-select.js.es6 | 1 - .../components/single-select-test.js.es6 | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/select-kit/components/single-select.js.es6 b/app/assets/javascripts/select-kit/components/single-select.js.es6 index 5f539a5268..c05c6b7db0 100644 --- a/app/assets/javascripts/select-kit/components/single-select.js.es6 +++ b/app/assets/javascripts/select-kit/components/single-select.js.es6 @@ -94,7 +94,6 @@ export default SelectKitComponent.extend({ @computed("computedValue", "computedContent.[]") selectedComputedContent(computedValue, computedContent) { - if (isNone(computedValue) || isNone(computedContent)) { return null; } return computedContent.findBy("value", computedValue); }, diff --git a/test/javascripts/components/single-select-test.js.es6 b/test/javascripts/components/single-select-test.js.es6 index 1093fea0d0..5dfef9c4fe 100644 --- a/test/javascripts/components/single-select-test.js.es6 +++ b/test/javascripts/components/single-select-test.js.es6 @@ -423,3 +423,20 @@ componentTest('with nameChanges', { }); } }); + + +componentTest('with null value', { + template: '{{single-select content=content}}', + + beforeEach() { + this.set("content", [{ name: "robin" }]); + }, + + test(assert) { + expandSelectKit(); + + andThen(() => { + assert.equal(selectKit().header.name(), "robin"); + }); + } +});