Reset <html class> after every test, back to its original static value

This commit is contained in:
John Cowen 2018-06-25 12:11:01 +01:00
parent fe14af4916
commit 7f821cbd17
2 changed files with 13 additions and 3 deletions

View file

@ -3,7 +3,6 @@ Feature: startup
In order to give users an indication as early as possible that they are at the right place
As a user
I should be able to see a startup logo
@ignore
Scenario: When loading the index.html file into a browser
Given 1 datacenter model with the value "dc-1"
Then the url should be ''

View file

@ -3,6 +3,18 @@ import { skip } from 'qunit';
import { setupApplicationTest, setupRenderingTest, setupTest } from 'ember-qunit';
import api from 'consul-ui/tests/helpers/api';
const staticClassList = [...document.documentElement.classList];
function reset() {
window.localStorage.clear();
api.server.reset();
const list = document.documentElement.classList;
while (list.length > 0) {
list.remove(list.item(0));
}
staticClassList.forEach(function(item) {
list.add(item);
});
}
// this logic could be anything, but in this case...
// if @ignore, then return skip (for backwards compatibility)
// if have annotations in config, then only run those that have a matching annotation
@ -64,8 +76,7 @@ function setupScenario(featureAnnotations, scenarioAnnotations) {
}
return function(model) {
model.afterEach(function() {
window.localStorage.clear();
api.server.reset();
reset();
});
};
// return setupFn;