adopted-ember-addons / emberx-select

Select component for Ember based on the native html select element.
https://emberx-select.netlify.com/
MIT License
199 stars 81 forks source link

Unexpected behavior when initially selected value is falsy #112

Closed kategengler closed 8 years ago

kategengler commented 8 years ago

Version of x-select: 2.1.1

Ember Version / Ember CLI Version:

Ember Version: 2.4.3 Ember CLI Version: 2.4.2

Expected Behavior

When setting value on {{x-select}} to a falsy value (explicitly false in our case), the bound property should remain false.

Actual Behavior

If set to false, the bound property's value is updated to null. We tracked this down to this line: https://github.com/thefrontside/emberx-select/blob/master/addon/components/x-select.js#L156

Steps To Reproduce:

  1. When using {{x-select}} pass in value bound to a property that is falsy (false, 0, etc)
  2. Observe that the bound value is updated to null.

    JSBin / Ember Twiddle / Example repo / Failing test:

Tracked down to this line: https://github.com/thefrontside/emberx-select/blob/master/addon/components/x-select.js#L156

kategengler commented 8 years ago

Plan to PR a fix but wanted to document this in case we forgot.

Robdel12 commented 8 years ago

Thanks for detailed issue @kategengler! If you don't get to the PR I'll try to fix this today :)

Robdel12 commented 8 years ago

This was closed with https://github.com/thefrontside/emberx-select/commit/440f9662d62524cc8d6a6883b21c29eda8d89128

kategengler commented 8 years ago

Thanks!