File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,13 @@ EmberApplication.reopen({
423
423
this . helperContainer = window ;
424
424
}
425
425
426
+ this . reopen ( {
427
+ willDestroy ( ) {
428
+ this . _super ( ...arguments ) ;
429
+ this . removeTestHelpers ( ) ;
430
+ }
431
+ } ) ;
432
+
426
433
this . testHelpers = { } ;
427
434
for ( var name in helpers ) {
428
435
this . originalMethods [ name ] = this . helperContainer [ name ] ;
Original file line number Diff line number Diff line change @@ -97,7 +97,6 @@ QUnit.module('ember-testing Acceptance', {
97
97
} ,
98
98
99
99
teardown ( ) {
100
- App . removeTestHelpers ( ) ;
101
100
Test . unregisterHelper ( 'slowHelper' ) ;
102
101
jQuery ( '#ember-testing-container, #ember-testing' ) . remove ( ) ;
103
102
run ( App , App . destroy ) ;
@@ -379,3 +378,28 @@ QUnit.test('visiting a URL and then visiting a second URL with a transition shou
379
378
equal ( currentURL ( ) , '/comments' , 'Redirected to Comments URL' ) ;
380
379
} ) ;
381
380
} ) ;
381
+
382
+ QUnit . module ( 'ember-testing Acceptance – teardown' ) ;
383
+
384
+ QUnit . test ( 'that the setup/teardown happens correct' , function ( ) {
385
+ expect ( 2 ) ;
386
+
387
+ jQuery ( '<style>#ember-testing-container { position: absolute; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; } #ember-testing { zoom: 50%; }</style>' ) . appendTo ( 'head' ) ;
388
+ jQuery ( '<div id="ember-testing-container"><div id="ember-testing"></div></div>' ) . appendTo ( 'body' ) ;
389
+
390
+ run ( function ( ) {
391
+ indexHitCount = 0 ;
392
+ App = EmberApplication . create ( {
393
+ rootElement : '#ember-testing'
394
+ } ) ;
395
+ } ) ;
396
+ App . injectTestHelpers ( ) ;
397
+
398
+ jQuery ( '#ember-testing-container, #ember-testing' ) . remove ( ) ;
399
+ ok ( typeof Test . Promise . prototype . click === 'function' ) ;
400
+ run ( App , App . destroy ) ;
401
+ equal ( Test . Promise . prototype . click , undefined ) ;
402
+ App = null ;
403
+ Test . adapter = originalAdapter ;
404
+ indexHitCount = 0 ;
405
+ } ) ;
You can’t perform that action at this time.
0 commit comments