-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
[breaking] Remove view.$()
call in render()
of module for component
#27
Conversation
This prevents a possible error when a callback returns `false` and therefore it skips the cache.
This is a breaking change. Previously, calling `this.render()` in a module-for-component would append the view and then return the view's `this.$()`. This changes `render` to only render the component and append it, returning `undefined`. Test users can still use `this.$()` to get the component's jquery-wrapped element. This avoids a possible issue in Ember >= 1.11.0-beta.5 where tagless components (`tagName = ''`) will give a deprecation warning when their `$()` method is called.
👍 - LGTM |
@bantic can we make We certain have projects that rely on |
@mixonic coming up... |
Updated
|
+1 |
@dgeb I think this is good to go, if you are happy with it |
[breaking] Remove `view.$()` call in `render()` of module for component
Good improvements - thanks @bantic! |
Just tagged v0.4.0. |
from #26
This PR makes two changes:
cachedCalls
object internally in TestModule to track whether a given callback has been called. Previously, the code only did a check on the result (inthis.cache[key]
), which means that a callback that returns a falsy value will (incorrectly, it seems) be called multiple times. This seemed likely to result in inconsistent behavior. (This change is necessary for the following change)this.callbacks.render
to not return anything. It simply renders the component. This is a breaking change. Previously,render
would return the rendered view'sthis.$()
method, but this is problematic because there are cases where a view's$()
method should not be called. Specifically, in Ember 1.11.0.beta-5, callingthis.$()
on a tagless component (wheretagName = ''
) will result in a failed assertion: "You cannot access this.$() on a component withtagName: \'\'
specified.", making it difficult-to-impossible to test such a component in a unit test.Test users can still call
this.$()
to get the jquery-wrapped element (in cases where that makes sense — if the component is tagless they will still get the failed assert mentioned above)cc @rwjblue @mixonic