DEV: Clean up HTML state between tests
A bunch of tests were leaving leftovers in the DOM like class names, custom styles and scroll positions. This ensures they are cleared between tests.
This commit is contained in:
parent
23d7fcf9a1
commit
3350657553
|
@ -342,8 +342,20 @@ function setupTestsCommon(application, container, config) {
|
||||||
resetPretender();
|
resetPretender();
|
||||||
clearPresenceState();
|
clearPresenceState();
|
||||||
|
|
||||||
// Destroy any modals
|
// Clean up the DOM. Some tests might leave extra classes or elements behind.
|
||||||
$(".modal-backdrop").remove();
|
Array.from(document.getElementsByClassName("modal-backdrop")).forEach((e) =>
|
||||||
|
e.remove()
|
||||||
|
);
|
||||||
|
document.body.removeAttribute("class");
|
||||||
|
let html = document.getElementsByTagName("html")[0];
|
||||||
|
html.removeAttribute("class");
|
||||||
|
html.removeAttribute("style");
|
||||||
|
let testing = document.getElementById("ember-testing");
|
||||||
|
testing.removeAttribute("class");
|
||||||
|
testing.removeAttribute("style");
|
||||||
|
let testContainer = document.getElementById("ember-testing-container");
|
||||||
|
testContainer.scrollTop = 0;
|
||||||
|
|
||||||
flushMap();
|
flushMap();
|
||||||
|
|
||||||
MessageBus.unsubscribe("*");
|
MessageBus.unsubscribe("*");
|
||||||
|
|
Loading…
Reference in New Issue