clean data after test

This commit is contained in:
Anton Lavrenov
2021-05-05 13:44:32 -05:00
parent e27b32ebef
commit 89687574d1
2 changed files with 19 additions and 21 deletions

View File

@@ -18,6 +18,25 @@ beforeEach(function () {
Konva['inDblClickWindow'] = false;
});
// clear after test
afterEach(function () {
var isFailed = this.currentTest.state == 'failed';
var isManual = this.currentTest.parent.title === 'Manual';
Konva.stages.forEach(function (stage) {
clearTimeout(stage.dblTimeout);
});
if (!isFailed && !isManual) {
Konva.stages.forEach(function (stage) {
stage.destroy();
});
if (Konva.DD._dragElements.size) {
throw 'Why drag elements are not cleaned?';
}
}
});
export const isNode = typeof global.document === 'undefined';
export const isBrowser = !isNode;