From a3932af9a2d106df6ba1921aa5fc99f83cdf5f8b Mon Sep 17 00:00:00 2001 From: Gabe Smedresman Date: Fri, 30 Aug 2013 18:42:31 -0700 Subject: [PATCH] Update ItemViewValueSupport to allow for falsy values. The existing method for calculating item values fails for falsy values like `null`, `0`, or `false`. I've updated ItemViewValueSupport to only default to the whole content object for the value when the calculated value === undefined. --- .../ember-bootstrap/lib/mixins/item_view_value_support.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ember-bootstrap/lib/mixins/item_view_value_support.js b/packages/ember-bootstrap/lib/mixins/item_view_value_support.js index 8ccc267..fdb9fd9 100644 --- a/packages/ember-bootstrap/lib/mixins/item_view_value_support.js +++ b/packages/ember-bootstrap/lib/mixins/item_view_value_support.js @@ -3,10 +3,11 @@ var get = Ember.get; Bootstrap.ItemViewValueSupport = Ember.Mixin.create({ value: Ember.computed(function() { var parentView = get(this, 'parentView'), - content, valueKey; + content, valueKey, value; if (!parentView) return null; content = get(this, 'content'); valueKey = get(parentView, 'itemValueKey') || 'value'; - return get(content, valueKey) || content; + value = get(content, valueKey); + return value !== undefined ? value : content; }).property('content').cacheable() });