-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
add assertions for tagless component event handlers #12503
Conversation
Yes, the custom events added by As discussed in #ember-dev in slack, I think the easiest/best way to do this would be via a small change to the var events = this._handledEvents = assign({}, get(this, 'events'), addedEvents); (or some better name than |
this.tagName !== '' || !(() => { | ||
var eventDispatcher = this.container.lookup('event_dispatcher:main'); | ||
var application = this.container.lookup('application:main'); | ||
var events = assign({}, eventDispatcher.events, application.customEvents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed with that tweak to the event dispatcher we discussed.
I left one more minor nit-pick, but this looks great to me. @miguelcobain - Thank you for putting the time in and figuring this out! |
`You can not define a function that handles DOM events in the \`${this}\` tagless component since it doesn't have any DOM element.`, | ||
this.tagName !== '' || !(() => { | ||
let eventDispatcher = this.container.lookup('event_dispatcher:main'); | ||
let events = (eventDispatcher && eventDispatcher._finalEvents) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjblue Like this? :)
I think a test may be a bit paranoic here. Are we testing &&
and ||
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HA! Agreed. This looks good.
Should be ready now! |
Restarted sauce labs tests. |
add assertions for tagless component event handlers
Thanks again @miguelcobain ! |
🎉 |
Should application instance custom events be considered as well?
Should I access it using
this.container.lookup('-application-instance:main')
?Feel free to tag this PR if needed.
/cc @rwjblue @mixonic