You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great bug report! The issue is ultimately that module unit tests (specifically moduleForComponent in unit test mode) falls back to doing container.lookupFactory('component:some-name'), which would normally still get the proper injections except that Ember is only injecting _viewRegistry on view types (discussed a bit here) which IMHO is an Ember bug.
All of that being said, I am working on a fix for this. Hope to have a PR up shortly...
The commit 78ba0c0 breaks the checkbox and switch unit tests over at https://github.com/truenorth/ember-cli-materialize (in particular this assertion: https://github.com/truenorth/ember-cli-materialize/blob/master/tests/helpers/selectable-item.js#L55, because the click() event doesn't propagate to the component).
After doing some debugging on the issue I noticed that, when calling Ember's
event_dispatcher.js
setupHandler()
function, the container that was onceundefined
is now available, and therefore the viewRegistry is set from the lookup of'-view-registry:main'
rather than the globalView.views
(see https://github.com/emberjs/ember.js/blob/680f997ed0958c420abdcd0b1673111aee26afe7/packages/ember-views/lib/system/event_dispatcher.js#L174).However, when calling
this.subject()
from a component test, a view doesn't have the view-registry injected into it, and therefore registers itself with theView.views
global (because of the fallback at https://github.com/emberjs/ember.js/blob/360d41da7877cd7b00943f0b8d7e7025bc53dbf2/packages/ember-views/lib/views/view.js#L1323).This means the view is not available when attempting to look it up by its id in the
viewRegistry
in the event handling function within event_dispatcher.setupHandler() (at https://github.com/emberjs/ember.js/blob/680f997ed0958c420abdcd0b1673111aee26afe7/packages/ember-views/lib/system/event_dispatcher.js#L177), because two different view-registries are being used, the one by the event dispatcher and the one that the view registers itself on.Switching the ember-cli-materialize project's ember-qunit bower dependency back to a hardcoded v0.4.6 causes the tests to pass again.
The text was updated successfully, but these errors were encountered: