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

How should mutliple render calls in one test behave? #111

Closed
dschmidt opened this issue Oct 18, 2015 · 8 comments
Closed

How should mutliple render calls in one test behave? #111

dschmidt opened this issue Oct 18, 2015 · 8 comments

Comments

@dschmidt
Copy link

I just generated a component integration test for one of my components which has a hardcoded elementId (F*ck me, right?) and the test exploded into my face with
Assertion Failed: Attempted to register a view with an id already in use: myComponentName
because of the two render calls (block and non-block form).

@rwjblue on Slack:

Should we allow multiple this.render calls in one test, and if we do should we teardown the prior one before doing another?
the answers do not seem obvious to me
I guess I would lean towards cleaning up if a this.render was already run....
if you care and have time, i'd love an issue in ember-test-helpers for this
it seems somewhat edge-casey but seems valuable to get it right

@rwjblue
Copy link
Member

rwjblue commented Oct 18, 2015

Thanks for reporting!

@ef4 / @dgeb - Thoughts on this?

@dschmidt
Copy link
Author

FWIW it's perfectly possible to have two tests invoke this very same component.
It seems questionable to me if there's value in mixing both render types into one test or if it wasn't a better idea to separate them by default in the component-test blueprint.

@rwjblue
Copy link
Member

rwjblue commented Oct 18, 2015

@dschmidt - Yes, the default blueprint is definitely odd at best (having both block and blockless in the same test). We should definitely fix that (perhaps @trabus recalls why we went this specific way).

@trabus
Copy link

trabus commented Oct 19, 2015

I believe the intent was actually to show both forms for the consumer to pick one or the other, we obviously weren't clear about it.

@ef4
Copy link
Contributor

ef4 commented Oct 19, 2015

I think a second render call should properly tear down the first one first. There seems to be no downside to that, and it will Just Work as expected.

@yaymukund
Copy link

👍 this should be fixed.

Cleanup failures are really annoying to debug because it effectively leaks state into subsequent tests.

@rwjblue
Copy link
Member

rwjblue commented May 24, 2016

#147 added the ability to call clearRender as needed, but did not add guards or automatically call clearRender when multiple this.render calls are made.

In theory I am fine with either, but kinda lean towards automatically calling clearRender on any subsequent this.render calls (since multiple this.render calls "works" today).

@rwjblue
Copy link
Member

rwjblue commented May 25, 2016

Should be resolved by #155.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants