@@ -173,6 +173,18 @@ describe('IgxGrid - Grid Toolbar #grid - ', () => {
173173 expect ( $ ( '#csvEntry' ) . textContent ) . toMatch ( instance . customCSVText ) ;
174174 } ) ;
175175
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+
176188 it ( 'Setting overlaySettings for each toolbar columns action' , ( ) => {
177189 const defaultSettings = instance . pinningAction . overlaySettings ;
178190 const defaultFiltSettings = instance . advancedFiltAction . overlaySettings ;
@@ -297,7 +309,7 @@ export class DefaultToolbarComponent {
297309 <igx-grid-toolbar-advanced-filtering #advancedFiltAction>
298310 {{ advancedFilteringTitle }}
299311 </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)" >
301313 {{ exporterText }}
302314 <span id="excelEntry" excelText>{{ customExcelText }}</span>
303315 <span id="csvEntry" csvText>{{ customCSVText }}</span>
@@ -346,8 +358,15 @@ export class ToolbarActionsComponent {
346358 modal : true ,
347359 closeOnEscape : false
348360 } ;
361+ public exportStartCancelled = false ;
349362
350363 constructor ( ) {
351364 this . data = [ ...DATA ] ;
352365 }
366+
367+ public exportStarted ( args ) {
368+ if ( this . exportStartCancelled ) {
369+ args . cancel = true ;
370+ }
371+ }
353372}
0 commit comments