-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
can't test customEvents #75
Comments
The simplest solution is to allow the user to specify moduleForComponent('foo-bar', {
beforeEach() {
this.customEvents = {
webkitAnimationEnd: 'animationEnd'
msAnimationEnd: 'animationEnd'
oAnimationEnd: 'animationEnd'
animationend: 'animationEnd'
};
}
}); Which would be used here like so: context.dispatcher = Ember.EventDispatcher.create();
context.dispatcher.setup(context.customEvents || {}, '#ember-testing'); |
Ideally we should not require additional config. If you have custom events set up correctly in your app, they should Just Work in integration tests too. We may need to refactor Application a little so that we can use just the customized event setup separately from booting a whole app instance. |
I'd like to contribute, but would need hand holding |
Anybody? it's been a while :| |
Got some help from @rwjblue on this one today and wanted to share here: It seems that a nicer (but currently undocumented solution) is to // inside of app/event_dispatcher.js
import Ember from 'ember';
export default Ember.EventDispatcher.extend({
init() {
this._super(...arguments);
this.events.webkitAnimationEnd = 'animationEnd'
}
}); This works and feels like a better solution since setting up custom events is unlikely to change based on the current environment. The |
Thanks for writing up the solution here. I think I'm going to close this issue now that the solution is documented, but I suspect we might still want to do some work in Ember to make this a bit more ergonomic. I'm happy to help someone spearhead an RFC on this, if they are interested in it... |
We have these on our Application:
...and in a component integration test:
The text was updated successfully, but these errors were encountered: