Skip to content

Commit

Permalink
fix(...) input validations
Browse files Browse the repository at this point in the history
1. For paper-input, validate only when value changes
2. For paper-autocomplete, validate when selection is made.
  • Loading branch information
xomaczar committed Jul 16, 2018
1 parent 7f77a7d commit ce63371
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions addon/components/paper-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export default PowerSelect.extend(ValidationMixin, ChildMixin, {
this._super(...arguments);
},

updateSelection() {
this._super(...arguments);
this.notifyValidityChange();
},

actions: {

onTriggerMouseDown() {
Expand Down
8 changes: 7 additions & 1 deletion addon/components/paper-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ export default Component.extend(FocusableMixin, ColorMixin, ChildMixin, Validati
didReceiveAttrs() {
this._super(...arguments);
assert('{{paper-input}} requires an `onChange` action or null for no action.', this.get('onChange') !== undefined);
this.notifyValidityChange();

let value = this.get('value');
let prevValue = this.get('_prevValue');
if (value !== prevValue) {
this.notifyValidityChange();
}
this._prevValue = value;
},

didInsertElement() {
Expand Down

0 comments on commit ce63371

Please sign in to comment.