Skip to content

Commit 8ad086b

Browse files
committed
qunit: syncronized executeAsyncMock setups and terminates
1 parent af1b448 commit 8ad086b

File tree

7 files changed

+55
-10
lines changed

7 files changed

+55
-10
lines changed

packages/devextreme/testing/tests/Bootstrap Integration/widget_bundled.tests.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ QUnit.testStart(function() {
1515
$('#qunit-fixture').html(markup);
1616
});
1717

18-
executeAsyncMock.setup();
19-
2018
const BOOTSTRAP_CSS_URL = window.ROOT_URL + 'packages/devextreme-themebuilder/node_modules/bootstrap/dist/css/bootstrap.css';
2119

2220
const applyBootstrap = (function() {

packages/devextreme/testing/tests/DevExpress.knockout/collectionWidget.tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class TestComponent extends CollectionWidget {
123123

124124
moduleWithoutCsp('render', {
125125
beforeEach: function() {
126+
executeAsyncMock.setup();
126127
this.element = $('#cmp');
127128
this.clock = sinon.useFakeTimers();
128129
},

packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/columnsController.tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9334,6 +9334,7 @@ QUnit.module('Customization of the command columns', {
93349334
setupModule.apply(this, [['adaptivity']]);
93359335
},
93369336
afterEach: function() {
9337+
teardownModule.apply(this);
93379338
this.dispose && this.dispose();
93389339
}
93399340
}, function() {

packages/devextreme/testing/tests/DevExpress.ui.widgets/gallery.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,6 @@ QUnit.module('options changed callbacks', {
11441144

11451145
},
11461146
afterEach() {
1147-
executeAsyncMock.teardown();
11481147
fx.off = false;
11491148
this.clock.restore();
11501149
}
@@ -1177,6 +1176,7 @@ QUnit.module('options changed callbacks', {
11771176
const store = new ArrayStore([11, 22]);
11781177
this.instance.option('dataSource', new DataSource(store));
11791178
assert.equal(getImageSources(this.$element), '1122');
1179+
executeAsyncMock.teardown();
11801180
});
11811181

11821182
QUnit.test('selectedIndex', function(assert) {

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.materialTheme.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ QUnit.testStart(function() {
2727
$('#qunit-fixture').html(markup);
2828
});
2929

30-
executeAsyncMock.setup();
31-
3230
QUnit.module('popover content size', {
3331
beforeEach: function() {
3432
viewPort($('#qunit-fixture').addClass('dx-viewport'));
3533

3634
fx.off = true;
35+
executeAsyncMock.setup();
3736
},
3837
afterEach: function() {
3938
fx.off = false;
39+
executeAsyncMock.teardown();
4040
}
4141
}, () => {
4242
QUnit.test('popover content has correct size switch', function(assert) {

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.tests.js

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ QUnit.testStart(function() {
118118
$('#qunit-fixture').html(markup);
119119
});
120120

121-
executeAsyncMock.setup();
122-
123121
const POPUP_CLASS = 'dx-popup';
124122
const POPUP_WRAPPER_CLASS = 'dx-popup-wrapper';
125123
const POPUP_CONTENT_CLASS = 'dx-popup-content';
@@ -144,7 +142,14 @@ const VIEWPORT_CLASS = 'dx-viewport';
144142

145143
const viewport = function() { return $(`.${VIEWPORT_CLASS}`); };
146144

147-
QUnit.module('basic', () => {
145+
QUnit.module('basic', {
146+
beforeEach: function() {
147+
executeAsyncMock.setup();
148+
},
149+
afterEach: function() {
150+
executeAsyncMock.teardown();
151+
}
152+
}, () => {
148153
QUnit.test('markup init', function(assert) {
149154
const $element = $('#popup').dxPopup();
150155
assert.ok($element.hasClass(POPUP_CLASS));
@@ -650,9 +655,11 @@ QUnit.module('basic', () => {
650655
QUnit.module('dimensions', {
651656
beforeEach: function() {
652657
fx.off = true;
658+
executeAsyncMock.setup();
653659
},
654660
afterEach: function() {
655661
fx.off = false;
662+
executeAsyncMock.teardown();
656663
}
657664
}, () => {
658665
QUnit.test('content must not overlap bottom buttons', function(assert) {
@@ -932,12 +939,15 @@ QUnit.module('options changed callbacks', {
932939
};
933940
this.init();
934941

942+
executeAsyncMock.setup();
943+
935944
return new Promise((resolve) => themes.initialized(resolve));
936945
},
937946

938947
afterEach: function() {
939948
fx.off = false;
940949
this.clock.restore();
950+
executeAsyncMock.teardown();
941951
}
942952
}, () => {
943953
QUnit.test('width/height', function(assert) {
@@ -2085,6 +2095,11 @@ QUnit.module('drag', {
20852095
};
20862096

20872097
this.init();
2098+
2099+
executeAsyncMock.setup();
2100+
},
2101+
afterEach: function() {
2102+
executeAsyncMock.teardown();
20882103
}
20892104
}, () => {
20902105
QUnit.test('class should be added if drag is enabled', function(assert) {
@@ -2357,6 +2372,11 @@ QUnit.module('resize', {
23572372
};
23582373

23592374
this.init();
2375+
2376+
executeAsyncMock.setup();
2377+
},
2378+
afterEach: function() {
2379+
executeAsyncMock.teardown();
23602380
}
23612381
}, () => {
23622382
QUnit.test('popup should have resizable component on overlay content', function(assert) {
@@ -2566,6 +2586,10 @@ QUnit.module('keyboard navigation', {
25662586
this.position = this.$overlayContent.position();
25672587
this.keyboard = keyboardMock(this.$overlayContent);
25682588
};
2589+
executeAsyncMock.setup();
2590+
},
2591+
afterEach: function() {
2592+
executeAsyncMock.teardown();
25692593
}
25702594
}, () => {
25712595
QUnit.test('arrows handling', function(assert) {
@@ -2663,7 +2687,11 @@ QUnit.module('rendering', {
26632687
this.element = $('#popup').dxPopup();
26642688
this.instance = this.element.dxPopup('instance');
26652689
devices.current('desktop');
2690+
executeAsyncMock.setup();
26662691
return new Promise((resolve) => themes.initialized(resolve));
2692+
},
2693+
afterEach: function() {
2694+
executeAsyncMock.teardown();
26672695
}
26682696
}, () => {
26692697
QUnit.test('anonymous content template rendering', function(assert) {
@@ -2796,7 +2824,14 @@ QUnit.module('rendering', {
27962824
});
27972825
});
27982826

2799-
QUnit.module('templates', () => {
2827+
QUnit.module('templates', {
2828+
beforeEach: function() {
2829+
executeAsyncMock.setup();
2830+
},
2831+
afterEach: function() {
2832+
executeAsyncMock.teardown();
2833+
}
2834+
}, () => {
28002835
QUnit.test('titleTemplate', function(assert) {
28012836
assert.expect(6);
28022837

@@ -3027,6 +3062,10 @@ QUnit.module('renderGeometry', {
30273062

30283063
this.init();
30293064

3065+
executeAsyncMock.setup();
3066+
},
3067+
afterEach: function() {
3068+
executeAsyncMock.teardown();
30303069
}
30313070
}, () => {
30323071
QUnit.test('toolbar should update geometry after toolbarItems visibility option change', function(assert) {
@@ -3142,6 +3181,10 @@ QUnit.module('positioning', {
31423181
this.init(options);
31433182
};
31443183
this.init();
3184+
executeAsyncMock.setup();
3185+
},
3186+
afterEach: function() {
3187+
executeAsyncMock.teardown();
31453188
}
31463189
}, () => {
31473190
QUnit.module('after fullScreen option change', () => {
@@ -3530,9 +3573,11 @@ QUnit.module('animation', {
35303573
},
35313574
fullScreen: true,
35323575
}).dxPopup('instance');
3576+
executeAsyncMock.setup();
35333577
},
35343578
afterEach: function() {
35353579
this.animateStub.restore();
3580+
executeAsyncMock.teardown();
35363581
}
35373582
}, () => {
35383583
QUnit.test('animation.show.to should have position.of=window if fullScreen=true even if popup position.of is set', function(assert) {

packages/devextreme/testing/tests/DevExpress.ui/collectionWidget.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ module('render', {
9696
this.clock = sinon.useFakeTimers();
9797
},
9898
afterEach: function() {
99-
executeAsyncMock.teardown();
10099
this.clock.restore();
101100
}
102101
}, () => {
@@ -538,6 +537,7 @@ module('render', {
538537
});
539538

540539
assert.equal(this.element.find('.' + EMPTY_MESSAGE_CLASS).length, 0);
540+
executeAsyncMock.teardown();
541541
});
542542

543543
test('No data text message - value', function(assert) {

0 commit comments

Comments
 (0)