Skip to content

Commit

Permalink
use computed.bool instead of directly messages length
Browse files Browse the repository at this point in the history
because `computed.or` does not coalesce to bool, we otherwise end up with the number of errors instead of true in `isInvalid` and `isInvalidAndTouched`
  • Loading branch information
panthony committed Mar 16, 2017
1 parent e3790b9 commit d0f5d74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addon/components/paper-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export default Component.extend(FocusableMixin, ColorMixin, ChildMixin, Validati

iconComponent: 'paper-icon',

isInvalid: computed.or('validationErrorMessages.length', 'isNativeInvalid'),
hasErrorMessages: computed.bool('validationErrorMessages.length'),

isInvalid: computed.or('hasErrorMessages', 'isNativeInvalid'),

hasValue: computed('value', 'isNativeInvalid', function() {
let value = this.get('value');
let isNativeInvalid = this.get('isNativeInvalid');
Expand Down

0 comments on commit d0f5d74

Please sign in to comment.