Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$.trigger does not trigger component actions. #13888

Closed
ghost opened this issue Jul 26, 2016 · 14 comments
Closed

$.trigger does not trigger component actions. #13888

ghost opened this issue Jul 26, 2016 · 14 comments

Comments

@ghost
Copy link

ghost commented Jul 26, 2016

The test suites of ember-one-way-controls and ember-form-for will not pass on canary and 2.8.0-beta.

An example of what is failing: https://github.com/martndemus/ember-form-for/blob/master/tests/integration/components/form-field-test.js#L156-L164

Specifically this does not seem to trigger actions on components anymore:

this.$('input').trigger('change');

Using git bisect I found that components/ember@9cff2f8 is the commit that introduces the bug, which I think corresponds to this commit: 2a233df

@pixelhandler
Copy link
Contributor

@martndemus I'm curious, in this.$('input').trigger('change'); an action named change should be triggered? Or, an event handler named change (not an action)? I thought trigger is a jQuery method that fires events.

@rwjblue
Copy link
Member

rwjblue commented Jul 26, 2016

The issue would likely be (based on the bisect result) that the event dispatched cannot find the component that is created, so it doesn't delegate the event to it. I'll try to dig in more this morning.

@mike-north
Copy link
Contributor

worth mentioning that it seems this only occurs during testing. When apps are run normally, everything seems to work as one would expect

@ghost
Copy link
Author

ghost commented Jul 26, 2016

It is very probable that this is a bug with test tooling working on old View API, that the found commit has broken.

@pixelhandler
Copy link
Contributor

@martndemus Just curious is this post https://dockyard.com/blog/2016/07/26/how-to-bisect-ember about this issue?

@ghost
Copy link
Author

ghost commented Jul 29, 2016

Yes, the blogpost describes how I found the commit that causes the bug.

@ghost ghost closed this as completed Jul 29, 2016
@ghost ghost reopened this Jul 29, 2016
@acorncom acorncom added the Bug label Jul 29, 2016
@acorncom
Copy link
Contributor

@martndemus Would it be possible to get a Twiddle showing a reproduction?

@alexlafroscia
Copy link

alexlafroscia commented Jul 29, 2016

I tried making a Twiddle here but for some reason the whole test thing shows up blank ¯_(ツ)_/¯

@alexlafroscia
Copy link

Seems to be a bug in Twiddle

@ghost
Copy link
Author

ghost commented Jul 30, 2016

@alexlafroscia
Copy link

You can see the same problem on the master branch of Ember AJAX right now too.

@rwjblue
Copy link
Member

rwjblue commented Jul 30, 2016

This is definitely an issue with an interaction between the change that @martndemus pointed out and the way ember-test-helpers sets up the event dispatcher. Ultimately, this causes the event dispatcher gets the event but can't identify which view it should be triggering.

I'll try to get a fix together in time for the next beta.

@rwjblue
Copy link
Member

rwjblue commented Aug 1, 2016

I did a bit more digging and believe that we have this fixed with emberjs/ember-test-helpers#167 (released in ember-test-helpers@0.5.28) and ffc29cd (which is cherry-picked into beta branch).

The basic issue is that since the Ember.Aplication and Ember.ApplicationInstance split there was no good way to execute the registry setup steps that existed in Em.ApplicationInstance. ember-test-helpers uses Ember.Application.buildRegistry to create the registry/container/owner setup that is used in unit and integration tests, but since there was no way to perform the Em.ApplicationInstance registry setup steps we were missing some key injections.

Submitted https://github.com/martndemus/ember-form-for/pull/79 to update and kick off a test run in ember-form-for showing that things are working properly now.

@ghost
Copy link
Author

ghost commented Aug 1, 2016

Can confirm this is fixed now. Closing the issue!

@ghost ghost closed this as completed Aug 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants