@@ -173,6 +173,18 @@ describe('IgxGrid - Grid Toolbar #grid - ', () => {
173
173
expect ( $ ( '#csvEntry' ) . textContent ) . toMatch ( instance . customCSVText ) ;
174
174
} ) ;
175
175
176
+ it ( 'progress indicator should stop on canceling the export' , ( ) => {
177
+ fixture . componentInstance . exportStartCancelled = true ;
178
+ fixture . detectChanges ( ) ;
179
+ $ ( TOOLBAR_EXPORTER_TAG ) . querySelector ( 'button' ) . click ( ) ;
180
+ fixture . detectChanges ( ) ;
181
+ $ ( '#excelEntry' ) . click ( ) ;
182
+ fixture . detectChanges ( ) ;
183
+
184
+ expect ( instance . exporterAction . isExporting ) . toBeFalse ( ) ;
185
+ expect ( instance . exporterAction . toolbar . showProgress ) . toBeFalse ( ) ;
186
+ } ) ;
187
+
176
188
it ( 'Setting overlaySettings for each toolbar columns action' , ( ) => {
177
189
const defaultSettings = instance . pinningAction . overlaySettings ;
178
190
const defaultFiltSettings = instance . advancedFiltAction . overlaySettings ;
@@ -297,7 +309,7 @@ export class DefaultToolbarComponent {
297
309
<igx-grid-toolbar-advanced-filtering #advancedFiltAction>
298
310
{{ advancedFilteringTitle }}
299
311
</igx-grid-toolbar-advanced-filtering>
300
- <igx-grid-toolbar-exporter #exporterAction [exportCSV]="exportCSV" [exportExcel]="exportExcel" [filename]="exportFilename">
312
+ <igx-grid-toolbar-exporter #exporterAction [exportCSV]="exportCSV" [exportExcel]="exportExcel" [filename]="exportFilename" (exportStarted)="exportStarted($event)" >
301
313
{{ exporterText }}
302
314
<span id="excelEntry" excelText>{{ customExcelText }}</span>
303
315
<span id="csvEntry" csvText>{{ customCSVText }}</span>
@@ -346,8 +358,15 @@ export class ToolbarActionsComponent {
346
358
modal : true ,
347
359
closeOnEscape : false
348
360
} ;
361
+ public exportStartCancelled = false ;
349
362
350
363
constructor ( ) {
351
364
this . data = [ ...DATA ] ;
352
365
}
366
+
367
+ public exportStarted ( args ) {
368
+ if ( this . exportStartCancelled ) {
369
+ args . cancel = true ;
370
+ }
371
+ }
353
372
}
0 commit comments