Merge "Fix issue with gr-select when value is 0"

This commit is contained in:
Kasper Nilsson
2017-12-06 18:48:17 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 1 deletions

View File

@@ -34,7 +34,8 @@
},
_updateValue() {
if (this.bindValue) {
// It's possible to have a value of 0.
if (this.bindValue !== undefined) {
// Set for chrome/safari so it happens instantly
this.nativeSelect.value = this.bindValue;
// Async needed for firefox to populate value. It was trying to do it

View File

@@ -45,6 +45,11 @@ limitations under the License.
element = fixture('basic');
});
test('value of 0 should still trigger value updates', () => {
element.bindValue = 0;
assert.equal(element.nativeSelect.value, 0);
});
test('bidirectional binding property-to-attribute', () => {
const changeStub = sinon.stub();
element.addEventListener('bind-value-changed', changeStub);