@@ -176,6 +176,7 @@ main() => describe('dte.compiler', () {
176
176
module.type (PublishMeDirective );
177
177
module.type (LogComponent );
178
178
module.type (AttachDetachComponent );
179
+ module.type (SimpleAttachComponent );
179
180
module.type (SimpleComponent );
180
181
module.type (ExprAttrComponent );
181
182
module.type (SayHelloFilter );
@@ -482,6 +483,18 @@ main() => describe('dte.compiler', () {
482
483
expect (logger).toEqual (['detach' ]);
483
484
expect (element.textWithShadow ()).toEqual ('WORKED' );
484
485
})));
486
+
487
+ it ('should should not call attach after scope is destroyed' , async (inject ((Logger logger) {
488
+ var element = $('<simple-attach></simple-attach>' );
489
+ var scope = rootScope.createChild ({});
490
+ $compile (element, directives)(injector.createChild ([new Module ()..value (Scope , scope)]), element);
491
+ expect (logger).toEqual (['SimpleAttachComponent' ]);
492
+ scope.destroy ();
493
+
494
+ rootScope.apply ();
495
+
496
+ expect (logger).toEqual (['SimpleAttachComponent' ]);
497
+ })));
485
498
});
486
499
487
500
describe ('invalid components' , () {
@@ -844,3 +857,11 @@ class ExprAttrComponent {
844
857
}
845
858
}
846
859
860
+ @NgComponent (selector: 'simple-attach' )
861
+ class SimpleAttachComponent implements NgAttachAware {
862
+ Logger logger;
863
+ SimpleAttachComponent (this .logger) {
864
+ logger ('SimpleAttachComponent' );
865
+ }
866
+ attach () => logger ('attach' );
867
+ }
0 commit comments