mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
clean data after test
This commit is contained in:
@@ -8,27 +8,6 @@
|
||||
<script>
|
||||
mocha.setup('bdd');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
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?';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// CORE
|
||||
import './unit/Animation-test.ts';
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user