File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
packages/devextreme/testing
tests/DevExpress.ui.events Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ function waitForRunner() {
4141function 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}
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments