-
-
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
Render for tagless component should not call view.$()
#26
Conversation
In ember version >= 1.11.0-beta, an [assertion will be raised when calling `this.$()` on component with no tagName](https://github.com/emberjs/ember.js/blob/06e41ad7ccd28558dd4e651aa070bc06f7757821/packages/ember-views/lib/views/view.js#L943-L946)
I think that I would prefer to simply remove the |
@dgeb - Do you have any objections to changing |
@rwjblue my thoughts are to decouple this from var element = Ember.get(view, 'element');
if (element) {
return jQuery(element);
}
return null; |
@rwjblue I like that suggestion. I like @mixonic's suggestion for decoupling the If that sounds good to @dgeb I can rework this PR to move it to that. |
I am not heavily invested in this issue, so if you all have reached consensus then I am 👍 as well. |
|
Oh |
I made a PR that changes |
In Ember 1.11, calling
this.$()
for a tagless component (tagName === ''
), ember will throw an assertion complaining.moduleForComponent
always callsthis.$()
in itsrender
callback, so in Ember 1.11 you can't effectively test the rendering of tagless components.This adds an isolated commit with a failing test (and ember upgraded to 1.11.0-beta.5) and a second commit fixing that test.
I'm not sure if this is the best solution. It makes
this.render
simply returnundefined
for tagless components, which may be more surprising for a user than the assertion message that ember will raise.Perhaps the
render
callback's call signature can change to include ashouldGetElement
boolean instead?So for a tagless component you would call
this.render(false)
in your test. And in that caserender
could raise its own assertion when called withoutfalse
for a tagless component.Alternatively, could use a heuristic to just find the first child of the ContainerView in the
#ember-testing
div, so thatthis.render
always returns an element.