@@ -23,6 +23,7 @@ describe('MatPaginator', () => {
23
23
MatPaginatorWithoutPageSizeApp ,
24
24
MatPaginatorWithoutOptionsApp ,
25
25
MatPaginatorWithoutInputsApp ,
26
+ MatPaginatorWithStringValues
26
27
] ,
27
28
providers : [ MatPaginatorIntl ]
28
29
} ) . compileComponents ( ) ;
@@ -251,6 +252,18 @@ describe('MatPaginator', () => {
251
252
fixture . detectChanges ( ) ;
252
253
expect ( fixture . nativeElement . querySelector ( '.mat-select' ) ) . toBeNull ( ) ;
253
254
} ) ;
255
+
256
+ it ( 'should handle the number inputs being passed in as strings' , ( ) => {
257
+ const withStringFixture = TestBed . createComponent ( MatPaginatorWithStringValues ) ;
258
+ const withStringPaginator = withStringFixture . componentInstance . paginator ;
259
+
260
+ withStringFixture . detectChanges ( ) ;
261
+
262
+ expect ( withStringPaginator . pageIndex ) . toEqual ( 0 ) ;
263
+ expect ( withStringPaginator . length ) . toEqual ( 100 ) ;
264
+ expect ( withStringPaginator . pageSize ) . toEqual ( 10 ) ;
265
+ expect ( withStringPaginator . pageSizeOptions ) . toEqual ( [ 5 , 10 , 25 , 100 ] ) ;
266
+ } ) ;
254
267
} ) ;
255
268
256
269
function getPreviousButton ( fixture : ComponentFixture < any > ) {
@@ -264,10 +277,10 @@ function getNextButton(fixture: ComponentFixture<any>) {
264
277
@Component ( {
265
278
template : `
266
279
<mat-paginator [pageIndex]="pageIndex"
267
- [pageSize]="pageSize"
268
- [pageSizeOptions]="pageSizeOptions"
269
- [length]="length"
270
- (page)="latestPageEvent = $event">
280
+ [pageSize]="pageSize"
281
+ [pageSizeOptions]="pageSizeOptions"
282
+ [length]="length"
283
+ (page)="latestPageEvent = $event">
271
284
</mat-paginator>
272
285
` ,
273
286
} )
@@ -312,3 +325,16 @@ class MatPaginatorWithoutPageSizeApp {
312
325
class MatPaginatorWithoutOptionsApp {
313
326
@ViewChild ( MatPaginator ) paginator : MatPaginator ;
314
327
}
328
+
329
+ @Component ( {
330
+ template : `
331
+ <mat-paginator pageIndex="0"
332
+ pageSize="10"
333
+ [pageSizeOptions]="['5', '10', '25', '100']"
334
+ length="100">
335
+ </mat-paginator>
336
+ `
337
+ } )
338
+ class MatPaginatorWithStringValues {
339
+ @ViewChild ( MatPaginator ) paginator : MatPaginator ;
340
+ }
0 commit comments