fix(segment): fixed segment UI not updating when changing value from view button

Added a test for this. Closes #657
This commit is contained in:
Brandy Carney
2015-12-10 12:58:51 -05:00
parent 9f0ab4a86e
commit 37ca863531
4 changed files with 46 additions and 12 deletions

View File

@ -72,6 +72,9 @@ export class Segment extends Ion {
*/
writeValue(value) {
this.value = !value ? '' : value;
for (let button of this.buttons) {
button.isActive = (button.value === value);
}
}
/**
@ -109,11 +112,9 @@ export class Segment extends Ion {
if (this.buttons.length == 0) {
return;
}
this.buttons.forEach(function(button) {
if (button.value === value) {
button.isActive = true;
}
});
for (let button of this.buttons) {
button.isActive = (button.value === value);
}
}
/**