File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,22 @@ var domMutateNode = require('can-dom-mutate/node');
1313var canSymbol = require ( "can-symbol" ) ;
1414var testHelpers = require ( 'can-test-helpers' ) ;
1515var canReflectDeps = require ( 'can-reflect-dependencies' ) ;
16+ var globals = require ( "can-globals" ) ;
17+
18+
19+ // This is a helper from can-stache-bindings
20+ function afterMutation ( cb ) {
21+ var doc = globals . getKeyValue ( 'document' ) ;
22+ var div = doc . createElement ( "div" ) ;
23+ var undo = domMutate . onNodeInsertion ( div , function ( ) {
24+ undo ( ) ;
25+ doc . body . removeChild ( div ) ;
26+ setTimeout ( cb , 5 ) ;
27+ } ) ;
28+ setTimeout ( function ( ) {
29+ domMutateNode . appendChild . call ( doc . body , div ) ;
30+ } , 10 ) ;
31+ }
1632
1733QUnit . module ( "can-view-live.list" , {
1834 setup : function ( ) {
@@ -365,13 +381,15 @@ test("no memory leaks", function () {
365381
366382
367383 QUnit . stop ( ) ;
384+
385+
368386 setTimeout ( function ( ) {
369387 domMutateNode . removeChild . call ( fixture , div ) ;
370- setTimeout ( function ( ) {
388+ afterMutation ( function ( ) {
371389 var handlers = map [ canSymbol . for ( "can.meta" ) ] . handlers . get ( [ ] ) ;
372390 equal ( handlers . length , 0 , "there are no bindings" ) ;
373391 start ( ) ;
374- } , 50 ) ;
392+ } ) ;
375393 } , 10 ) ;
376394} ) ;
377395
You can’t perform that action at this time.
0 commit comments