Skip to content

Commit f5f3d6f

Browse files
add qunit test
fix click subscription in events_engine (T1307313)
1 parent c750384 commit f5f3d6f

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

packages/devextreme/testing/launch

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ function waitForRunner() {
4141
function openBrowser() {
4242
spawn(
4343
getBrowserCommand(),
44-
[ 'http://localhost:' + PORT ],
44+
[
45+
'--js-flags=--expose-gc',
46+
'--enable-precise-memory-info',
47+
'http://localhost:' + PORT,
48+
],
4549
{ shell: true, detached: true }
4650
);
4751
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import $ from 'jquery';
2+
3+
QUnit.testStart(function() {
4+
const markup = '<div id="dataGrid"></div>';
5+
$('#qunit-fixture').html(markup);
6+
});
7+
8+
QUnit.module('event nodes disposing');
9+
10+
QUnit.test('should not leak memory when clicking on body with DxDataGrid on page', function(assert) {
11+
$('#dataGrid').dxDataGrid({
12+
dataSource: []
13+
});
14+
15+
globalThis.gc();
16+
17+
const initialMemory = performance.memory.usedJSHeapSize;
18+
19+
for(let i = 0; i < 100; i++) {
20+
$('body').trigger('click');
21+
}
22+
23+
globalThis.gc();
24+
25+
const finalMemory = performance.memory.usedJSHeapSize;
26+
const memoryDiff = finalMemory - initialMemory;
27+
28+
assert.ok(
29+
memoryDiffMB <= 0,
30+
`Memory should not leak. Memory diff: ${memoryDiff}B`
31+
);
32+
});

0 commit comments

Comments
 (0)