Skip to content

Commit

Permalink
remove onValidityChange call on component destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Dec 12, 2016
1 parent 0f79ea6 commit 4134ccd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
5 changes: 0 additions & 5 deletions addon/components/paper-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ export default Component.extend(FocusableMixin, ColorMixin, ChildMixin, Validati
this.growTextarea();
},

willClearRender() {
this._super(...arguments);
this.sendAction('onValidityChange', false);
},

willDestroyElement() {
this._super(...arguments);
if (this.get('textarea')) {
Expand Down
5 changes: 2 additions & 3 deletions addon/components/paper-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ export default PowerSelect.extend(ValidationMixin, ChildMixin, FocusableMixin, {
attributeBindings: ['parentTabindex:tabindex'],
shouldShowLabel: computed.and('label', 'selected'),
focusedAndSelected: computed.and('focused', 'selected'),

didReceiveAttrs() {
this._super(...arguments);
this.notifyValidityChange();
},
willClearRender() {
this.sendAction('onValidityChange', false);
},

concatenatedTriggerClasses: computed('triggerClass', 'publicAPI.isActive', function() {
let classes = ['ember-power-select-trigger'];
if (this.get('isInvalid')) {
Expand Down
5 changes: 1 addition & 4 deletions tests/integration/components/paper-form-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ test('form `onSubmit` action is invoked', function(assert) {
test('form `onValidityChange` action is invoked', function(assert) {
// paper-input triggers `onValidityChange` on render
// so we expect two runs: one on render and another on validity change

// on ember 2.4, it isn't running on destroy
// check if we need to notify validity change on destroy
// assert.expect(3);
assert.expect(2);

this.set('onValidityChange', () => {
assert.ok(true);
Expand Down

0 comments on commit 4134ccd

Please sign in to comment.