Ensure testing elements are properly reset/cleared. #226
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.
Prior to this change, the
innerHTML
of the#ember-testing
element was reset after each test (much in the same way as QUnit itself resets the#qunit-fixture
between tests). There were two specific issues with the approach:teardownRenderingContext
was required to run after theteardownContext
. If the order was set correctly (teardownRenderContext(this)
thenteardownContext(this)
) errors would be thrown because Ember is attempting to clean up the rendering engine and its expected DOM elements to remove are no longer present. This meant that we could not use the normal rule of thumb for these things: that teardown is done in the reverse order of setup.#ember-testing
element were not being cleaned up, and caused a large number of cascading test failures. Ember's acceptance tests set anember-application
class on what it thinks is therootElement
, if it sees that class is already present it throws an error. Due to the way tests were being improperly cleaned up, one failed acceptance test (which failed in such a way as proper cleanup could not happen) would essentially cause all of the remaining acceptance tests to fail.The fix here was to swap from capturing and resetting the
#ember-testing
elementsinnerHTML
to capturing and resetting the#ember-testing-container
'sinnerHTML
. This has the effect of ensuring that the#ember-testing
element (which is contained within the#ember-testing-container
element) is reset completely, and allows Ember's rendering system to continue to do its normal cleanup without error (because the elements it expected to exist are still present).