@@ -1104,77 +1104,70 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
11041104 } ) ;
11051105
11061106 describe ( 'ngOnDestroy' , ( ) => {
1107- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed' )
1108- . it ( 'should be called on view destruction' , fakeAsync ( ( ) => {
1109- const ctx = createCompFixture ( '<div testDirective="dir"></div>' ) ;
1110- ctx . detectChanges ( false ) ;
1107+ it ( 'should be called on view destruction' , fakeAsync ( ( ) => {
1108+ const ctx = createCompFixture ( '<div testDirective="dir"></div>' ) ;
1109+ ctx . detectChanges ( false ) ;
11111110
1112- ctx . destroy ( ) ;
1111+ ctx . destroy ( ) ;
11131112
1114- expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [ 'dir.ngOnDestroy' ] ) ;
1115- } ) ) ;
1113+ expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [ 'dir.ngOnDestroy' ] ) ;
1114+ } ) ) ;
11161115
1117- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed' )
1118- . it ( 'should be called after processing the content and view children' , fakeAsync ( ( ) => {
1119- TestBed . overrideComponent ( AnotherComponent , {
1120- set : new Component ( {
1121- selector : 'other-cmp' ,
1122- template : '<div testDirective="viewChild"></div>'
1123- } )
1124- } ) ;
1116+ it ( 'should be called after processing the content and view children' , fakeAsync ( ( ) => {
1117+ TestBed . overrideComponent ( AnotherComponent , {
1118+ set : new Component (
1119+ { selector : 'other-cmp' , template : '<div testDirective="viewChild"></div>' } )
1120+ } ) ;
11251121
1126- const ctx = createCompFixture (
1127- '<div testDirective="parent"><div *ngFor="let x of [0,1]" testDirective="contentChild{{x}}"></div>' +
1128- '<other-cmp></other-cmp></div>' ,
1129- TestComponent ) ;
1122+ const ctx = createCompFixture (
1123+ '<div testDirective="parent"><div *ngFor="let x of [0,1]" testDirective="contentChild{{x}}"></div>' +
1124+ '<other-cmp></other-cmp></div>' ,
1125+ TestComponent ) ;
11301126
1131- ctx . detectChanges ( false ) ;
1132- ctx . destroy ( ) ;
1127+ ctx . detectChanges ( false ) ;
1128+ ctx . destroy ( ) ;
11331129
1134- expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1135- 'contentChild0.ngOnDestroy' , 'contentChild1.ngOnDestroy' ,
1136- 'viewChild.ngOnDestroy' , 'parent.ngOnDestroy'
1137- ] ) ;
1138- } ) ) ;
1130+ expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1131+ 'contentChild0.ngOnDestroy' , 'contentChild1.ngOnDestroy' , 'viewChild .ngOnDestroy',
1132+ 'parent.ngOnDestroy'
1133+ ] ) ;
1134+ } ) ) ;
11391135
1140- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed' )
1141- . it ( 'should be called in reverse order so the child is always notified before the parent' ,
1142- fakeAsync ( ( ) => {
1143- const ctx = createCompFixture (
1144- '<div testDirective="parent"><div testDirective="child"></div></div><div testDirective="sibling"></div>' ) ;
1136+ it ( 'should be called in reverse order so the child is always notified before the parent' ,
1137+ fakeAsync ( ( ) => {
1138+ const ctx = createCompFixture (
1139+ '<div testDirective="parent"><div testDirective="child"></div></div><div testDirective="sibling"></div>' ) ;
11451140
1146- ctx . detectChanges ( false ) ;
1147- ctx . destroy ( ) ;
1141+ ctx . detectChanges ( false ) ;
1142+ ctx . destroy ( ) ;
11481143
1149- expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1150- 'child.ngOnDestroy' , 'parent.ngOnDestroy' , 'sibling.ngOnDestroy'
1151- ] ) ;
1152- } ) ) ;
1144+ expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1145+ 'child.ngOnDestroy' , 'parent.ngOnDestroy' , 'sibling.ngOnDestroy'
1146+ ] ) ;
1147+ } ) ) ;
11531148
1154- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed' )
1155- . it ( 'should deliver synchronous events to parent' , fakeAsync ( ( ) => {
1156- const ctx =
1157- createCompFixture ( '<div (destroy)="a=$event" onDestroyDirective></div>' ) ;
1149+ it ( 'should deliver synchronous events to parent' , fakeAsync ( ( ) => {
1150+ const ctx = createCompFixture ( '<div (destroy)="a=$event" onDestroyDirective></div>' ) ;
11581151
1159- ctx . detectChanges ( false ) ;
1160- ctx . destroy ( ) ;
1152+ ctx . detectChanges ( false ) ;
1153+ ctx . destroy ( ) ;
11611154
1162- expect ( ctx . componentInstance . a ) . toEqual ( 'destroyed' ) ;
1163- } ) ) ;
1155+ expect ( ctx . componentInstance . a ) . toEqual ( 'destroyed' ) ;
1156+ } ) ) ;
11641157
1165- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed' )
1166- . it ( 'should call ngOnDestroy on pipes' , fakeAsync ( ( ) => {
1167- const ctx = createCompFixture ( '{{true | pipeWithOnDestroy }}' ) ;
11681158
1169- ctx . detectChanges ( false ) ;
1170- ctx . destroy ( ) ;
1159+ it ( 'should call ngOnDestroy on pipes' , fakeAsync ( ( ) => {
1160+ const ctx = createCompFixture ( '{{true | pipeWithOnDestroy }}' ) ;
11711161
1172- expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1173- 'pipeWithOnDestroy.ngOnDestroy'
1174- ] ) ;
1175- } ) ) ;
1162+ ctx . detectChanges ( false ) ;
1163+ ctx . destroy ( ) ;
1164+
1165+ expect ( directiveLog . filter ( [ 'ngOnDestroy' ] ) ) . toEqual ( [
1166+ 'pipeWithOnDestroy.ngOnDestroy'
1167+ ] ) ;
1168+ } ) ) ;
11761169
1177- fixmeIvy ( 'FW-763: LView tree not properly constructed / destroyed ' )
1170+ fixmeIvy ( 'FW-848: ngOnDestroy hooks are not called on providers ' )
11781171 . it ( 'should call ngOnDestroy on an injectable class' , fakeAsync ( ( ) => {
11791172 TestBed . overrideDirective (
11801173 TestDirective , { set : { providers : [ InjectableWithLifecycle ] } } ) ;
0 commit comments