Ember.js: Ember 2.10.0 - Calling this.$() in willDestroyElement hooks during unit tests returns undefined

Created on 1 Dec 2016  ·  3Comments  ·  Source: emberjs/ember.js

After upgrading to Ember 2.10.0, our component unit tests started breaking when willDestroyElement runs because this.$() is now returning undefined. This was not happening in Ember 2.9.0.

You can see this happening in this ember-twiddle.

Bug Ember 2.10 Has Reproduction

Most helpful comment

@omarestrella @kamilogorek this is fixed in 2.10.2, thanks for reporting!

All 3 comments

This looks like a bug, we should be able to use this.$() in willDestroyElement, especially to remove event listeners.

Bug flow:

  1. Renderer calls remove method which contains _transitionTo('destroying') function call link
  2. _transitionTo change currentState to destroying link
  3. _states lookup ends up finding destroying state link
  4. which is created using default state link1 link2
  5. which on the other hand returns undefined for $() calls link

@omarestrella @kamilogorek this is fixed in 2.10.2, thanks for reporting!

Was this page helpful?
0 / 5 - 0 ratings