@@ -738,6 +738,19 @@ describe('ui.grid.exporter', function() {
738
738
callback ( ) ;
739
739
}
740
740
} ) ;
741
+ spyOn ( uiGridExporterService , 'exporterCsvFilename' ) ;
742
+ grid . options . exporterCsvFilename = function ( grid , rowTypes , colTypes ) {
743
+ if ( ! grid ) {
744
+ throw Error ( "got erroneous Parameter: no grid" ) ;
745
+ }
746
+ if ( rowTypes != uiGridExporterConstants . VISIBLE ) {
747
+ throw Error ( "got erroneous Parameter: rowTypes != uiGridExporterConstants.VISIBLE" ) ;
748
+ }
749
+ if ( colTypes != uiGridExporterConstants . VISIBLE ) {
750
+ throw Error ( "got erroneous Parameter: colTypes != uiGridExporterConstants.VISIBLE" ) ;
751
+ }
752
+ return "test" ;
753
+ }
741
754
uiGridExporterService . csvExport ( grid , uiGridExporterConstants . VISIBLE , uiGridExporterConstants . VISIBLE ) ;
742
755
} ) ;
743
756
afterEach ( function ( ) {
@@ -750,6 +763,9 @@ describe('ui.grid.exporter', function() {
750
763
it ( 'calls downloadFile' , function ( ) {
751
764
expect ( uiGridExporterService . downloadFile ) . toHaveBeenCalled ( ) ;
752
765
} ) ;
766
+ it ( 'calls exporterCsvFilename' , function ( ) {
767
+ expect ( uiGridExporterService . exporterCsvFilename ) . toHaveBeenCalled ( ) ;
768
+ } ) ;
753
769
} ) ;
754
770
755
771
describe ( 'loadAllDataIfNeeded' , function ( ) {
@@ -1043,6 +1059,26 @@ describe('ui.grid.exporter', function() {
1043
1059
uiGridExporterService . pdfExport ( grid , uiGridExporterConstants . ALL ) ;
1044
1060
expect ( uiGridExporterService . loadAllDataIfNeeded ) . toHaveBeenCalled ( ) ;
1045
1061
} ) ;
1062
+
1063
+ it ( 'calls exporterPdfFilename' , function ( ) {
1064
+ spyOn ( uiGridExporterService , 'exporterPdfFilename' ) ;
1065
+ grid . options . exporterCsvFilename = function ( grid , rowTypes , colTypes ) {
1066
+ if ( ! grid ) {
1067
+ throw Error ( "got erroneous Parameter: no grid" ) ;
1068
+ }
1069
+ if ( rowTypes != uiGridExporterConstants . VISIBLE ) {
1070
+ throw Error ( "got erroneous Parameter: rowTypes != uiGridExporterConstants.VISIBLE" ) ;
1071
+ }
1072
+ if ( colTypes != uiGridExporterConstants . VISIBLE ) {
1073
+ throw Error ( "got erroneous Parameter: colTypes != uiGridExporterConstants.VISIBLE" ) ;
1074
+ }
1075
+ return "test" ;
1076
+ }
1077
+
1078
+ uiGridExporterService . pdfExport ( grid , uiGridExporterConstants . ALL ) ;
1079
+ expect ( uiGridExporterService . exporterCsvFilename ) . toHaveBeenCalled ( ) ;
1080
+ } ) ;
1081
+
1046
1082
} ) ;
1047
1083
1048
1084
describe ( 'prepareAsPdf' , function ( ) {
@@ -1324,6 +1360,44 @@ describe('ui.grid.exporter', function() {
1324
1360
uiGridExporterService . excelExport ( grid , uiGridExporterConstants . ALL ) ;
1325
1361
expect ( uiGridExporterService . loadAllDataIfNeeded ) . toHaveBeenCalled ( ) ;
1326
1362
} ) ;
1363
+
1364
+ it ( 'calls exporterExcelFilename' , function ( ) {
1365
+ spyOn ( uiGridExporterService , 'exporterExcelFilename' ) ;
1366
+ grid . options . exporterExcelFilename = function ( grid , rowTypes , colTypes ) {
1367
+ if ( ! grid ) {
1368
+ throw Error ( "got erroneous Parameter: no grid" ) ;
1369
+ }
1370
+ if ( rowTypes != uiGridExporterConstants . VISIBLE ) {
1371
+ throw Error ( "got erroneous Parameter: rowTypes != uiGridExporterConstants.VISIBLE" ) ;
1372
+ }
1373
+ if ( colTypes != uiGridExporterConstants . VISIBLE ) {
1374
+ throw Error ( "got erroneous Parameter: colTypes != uiGridExporterConstants.VISIBLE" ) ;
1375
+ }
1376
+ return "test" ;
1377
+ }
1378
+
1379
+ uiGridExporterService . excelExport ( grid , uiGridExporterConstants . ALL ) ;
1380
+ expect ( uiGridExporterService . exporterExcelFilename ) . toHaveBeenCalled ( ) ;
1381
+ } ) ;
1382
+
1383
+ it ( 'calls exporterExcelSheetName' , function ( ) {
1384
+ spyOn ( uiGridExporterService , 'exporterExcelSheetName' ) ;
1385
+ grid . options . exporterExcelSheetName = function ( grid , rowTypes , colTypes ) {
1386
+ if ( ! grid ) {
1387
+ throw Error ( "got erroneous Parameter: no grid" ) ;
1388
+ }
1389
+ if ( rowTypes != uiGridExporterConstants . VISIBLE ) {
1390
+ throw Error ( "got erroneous Parameter: rowTypes != uiGridExporterConstants.VISIBLE" ) ;
1391
+ }
1392
+ if ( colTypes != uiGridExporterConstants . VISIBLE ) {
1393
+ throw Error ( "got erroneous Parameter: colTypes != uiGridExporterConstants.VISIBLE" ) ;
1394
+ }
1395
+ return "test" ;
1396
+ }
1397
+
1398
+ uiGridExporterService . excelExport ( grid , uiGridExporterConstants . ALL ) ;
1399
+ expect ( uiGridExporterService . exporterExcelSheetName ) . toHaveBeenCalled ( ) ;
1400
+ } ) ;
1327
1401
} ) ;
1328
1402
} ) ;
1329
1403
0 commit comments