File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 33 "version" : " 5.0.3" ,
44 "description" : " A packaged version of Ignite UI wrappers for Angular" ,
55 "license" : " MIT" ,
6+ "types" : " main.d.ts" ,
67 "main" : " bundles/igniteui-angular-wrappers.umd.js" ,
78 "repository" : {
89 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -179,8 +179,11 @@ export class IgControlBase<Model> implements DoCheck {
179179 }
180180
181181 ngOnDestroy ( ) {
182- jQuery ( this . _el ) [ this . _widgetName ] ( "destroy" ) ;
183- jQuery ( this . _el ) . remove ( ) ;
184- jQuery ( this . _nativeElement ) . remove ( ) ;
182+ // igZoombar should be attached to body when being destroyed
183+ if ( this . _widgetName !== "igZoombar" || document . body . contains ( this . _el ) ) {
184+ jQuery ( this . _el ) [ this . _widgetName ] ( "destroy" ) ;
185+ jQuery ( this . _el ) . remove ( ) ;
186+ jQuery ( this . _nativeElement ) . remove ( ) ;
187+ }
185188 }
186189}
Original file line number Diff line number Diff line change @@ -97,6 +97,24 @@ export function main() {
9797 done ( ) ;
9898 } ) ;
9999 } ) ;
100+
101+ it ( 'Zoombar should destroy correctly' , ( done ) => {
102+ var template = '<div><div *ngIf="isChartAreaVisible"><ig-data-chart widgetId="datachart1" [(options)]="opts"></ig-data-chart><ig-zoombar [(options)]="zoombarOpts" widgetId="zoombar"></ig-zoombar></div></div>' ;
103+ TestBed . overrideComponent ( TestComponent , {
104+ set : {
105+ template : template
106+ }
107+ } ) ;
108+ TestBed . compileComponents ( ) . then ( ( ) => {
109+ let fixture = TestBed . createComponent ( TestComponent ) ;
110+ fixture . detectChanges ( ) ;
111+ fixture . componentInstance . isChartAreaVisible = false ;
112+ fixture . detectChanges ( ) ;
113+ expect ( $ ( fixture . debugElement . nativeElement ) . find ( "#datachart1" ) . data ( "igDataChart" ) ) . toBeUndefined ( ) ;
114+ expect ( $ ( fixture . debugElement . nativeElement ) . find ( "#zoombar" ) . data ( "igZoombar" ) ) . toBeUndefined ( ) ;
115+ done ( ) ;
116+ } ) ;
117+ } ) ;
100118 } ) ;
101119}
102120
@@ -110,6 +128,7 @@ class TestComponent {
110128 public opts2 : any ;
111129 private zoombarOpts : any ;
112130 public data : Array < any > ;
131+ public isChartAreaVisible : boolean = true ;
113132 @ViewChild ( Infragistics . IgDataChartComponent ) public viewChild : Infragistics . IgDataChartComponent ;
114133 @ViewChild ( Infragistics . IgZoombarComponent ) public viewChild2 : Infragistics . IgZoombarComponent ;
115134
You can’t perform that action at this time.
0 commit comments