Component not in dom in willDestroyElement #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We found this issue when upgrading ember-cli to 0.1.15
It seems that a change introduced in the new version of ember-test-helpers causes our component tests to fail because the element is no longer in the DOM when the
willDestroyElement
hook is called.We use a jquery ui datepicker component that cleans itself up in the
willDestroyElement
hook, but now when we run the tests the jquery ui datepicker code errors because it can't destroy the datepicker on the component's element.In
test-module-for-component.js
a teardown is added toteardownSteps
that destroys the containing view:https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module-for-component.js#L41
but it looks like that teardown is added after
teardownTestElements
intest-module.js
is added:https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module.js#L65-L67
and
teardownTestElements
empties the test div using jquery without letting Ember know:https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module.js#L141-L144
It seems like a fix would be to prepend the module-for-component's teardown -- not sure if this is the right way to do it, but it allows the test in this PR to pass and it allows our project's failing tests to pass:
Is there a better fix for this issue?