From 2e4b88d055b93b99f46a9d016332e5f7ebdea478 Mon Sep 17 00:00:00 2001 From: "James A. Rosen" Date: Sat, 27 Jun 2015 17:33:58 -0700 Subject: [PATCH] x-select: set value to null, not undefined, for no selection `Ember.computed.alias` treats `undefined` specially, causing some writes to fail. --- addon/components/x-select.js | 2 +- tests/acceptance/x-select-single-blockless-option-value-test.js | 2 +- tests/acceptance/x-select-single-blockless-test.js | 2 +- tests/acceptance/x-select-single-test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addon/components/x-select.js b/addon/components/x-select.js index 9754d91..dd8e36a 100644 --- a/addon/components/x-select.js +++ b/addon/components/x-select.js @@ -156,7 +156,7 @@ export default Ember.Component.extend({ if (option) { this.set('value', option.get('value')); } else { - this.set('value', undefined); + this.set('value', null); } }, diff --git a/tests/acceptance/x-select-single-blockless-option-value-test.js b/tests/acceptance/x-select-single-blockless-option-value-test.js index 8ce7729..d99b4c4 100644 --- a/tests/acceptance/x-select-single-blockless-option-value-test.js +++ b/tests/acceptance/x-select-single-blockless-option-value-test.js @@ -89,7 +89,7 @@ describe('XSelect: Single Selection Blockless w/ Option Value', function() { this.$().prop('selectedIndex', 4).trigger('change'); }); it("has no value", function() { - expect(controller.get('tagged')).to.equal(undefined); + expect(controller.get('tagged')).to.equal(null); }); }); diff --git a/tests/acceptance/x-select-single-blockless-test.js b/tests/acceptance/x-select-single-blockless-test.js index 6695d5e..87a254e 100644 --- a/tests/acceptance/x-select-single-blockless-test.js +++ b/tests/acceptance/x-select-single-blockless-test.js @@ -84,7 +84,7 @@ describe('XSelect: Single Selection Blockless', function() { this.$().prop('selectedIndex', 4).trigger('change'); }); it("has no value", function() { - expect(controller.get('tagged')).to.equal(undefined); + expect(controller.get('tagged')).to.equal(null); }); }); diff --git a/tests/acceptance/x-select-single-test.js b/tests/acceptance/x-select-single-test.js index 2a0842c..088ccc2 100644 --- a/tests/acceptance/x-select-single-test.js +++ b/tests/acceptance/x-select-single-test.js @@ -79,7 +79,7 @@ describe('XSelect: Single Selection', function() { this.$().prop('selectedIndex', 4).trigger('change'); }); it("has no value", function() { - expect(controller.get('tagged')).to.equal(undefined); + expect(controller.get('tagged')).to.equal(null); }); });