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

prepend tear down steps like tearDownForComponent in the begining of tearDownSteps array #104

Merged
merged 2 commits into from
Oct 9, 2015

Conversation

tsing80
Copy link
Contributor

@tsing80 tsing80 commented Sep 27, 2015

Currently, component.destroy() is only run after #ember-testing DOM element is emptied. When the component which use third party library like jquery-ui or bootstrap javascript component do cleanup using willDestroyElement() hook, it cannot cleanup properly because the element is already removed from DOM. In additional , teardownStep should be run in reverse order as setupSteps in general. So this PR also fix the _resetViewRegistry() hook in TestModuleForComponent.

@tsing80
Copy link
Contributor Author

tsing80 commented Oct 4, 2015

@rwjblue ping

@rwjblue
Copy link
Member

rwjblue commented Oct 4, 2015

Thanks for the reminder! This looks good, but I'd love to have a test that ensures the ordering of teardown is what we expect. A good place to start is by adding a test similar to this one that shows the ordering of all the hooks. You would need to add a component that pushes a component-destroyed entry to the callbackOrder when it's destroy was called, then deepEqual the final array in afterTeardown to ensure it happens properly.

@tsing80
Copy link
Contributor Author

tsing80 commented Oct 9, 2015

@rwjblue I have added a test based on the one in component unit test

@rwjblue
Copy link
Member

rwjblue commented Oct 9, 2015

awesome, thank you!

rwjblue added a commit that referenced this pull request Oct 9, 2015
prepend tear down steps like tearDownForComponent in the begining of tearDownSteps array
@rwjblue rwjblue merged commit 9f961d7 into emberjs:master Oct 9, 2015
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

Successfully merging this pull request may close these issues.

2 participants