Skip to content

Commit dd37ca5

Browse files
paulferaudandrewseguin
authored andcommitted
feat: Use en dash in MatPaginatorIntl (#16693)
This is the correct typography to use to format number ranges BREAKING CHANGE: MatPaginatorIntl will now cause MatPaginator to display an 'EN DASH' (U+2013) rather than a 'HYPHEN-MINUS' (U+002D)
1 parent dccddd9 commit dd37ca5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/material/paginator/paginator-intl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class MatPaginatorIntl {
5050
Math.min(startIndex + pageSize, length) :
5151
startIndex + pageSize;
5252

53-
return `${startIndex + 1} - ${endIndex} of ${length}`;
53+
return `${startIndex + 1} ${endIndex} of ${length}`;
5454
}
5555
}
5656

src/material/paginator/paginator.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ describe('MatPaginator', () => {
4747
component.pageSize = 10;
4848
component.pageIndex = 1;
4949
fixture.detectChanges();
50-
expect(rangeElement.innerText).toBe('11 - 20 of 100');
50+
expect(rangeElement.innerText).toBe('11 20 of 100');
5151

5252
// View third page of list of 200, each page contains 20 items.
5353
component.length = 200;
5454
component.pageSize = 20;
5555
component.pageIndex = 2;
5656
fixture.detectChanges();
57-
expect(rangeElement.innerText).toBe('41 - 60 of 200');
57+
expect(rangeElement.innerText).toBe('41 60 of 200');
5858

5959
// View first page of list of 0, each page contains 5 items.
6060
component.length = 0;
@@ -68,21 +68,21 @@ describe('MatPaginator', () => {
6868
component.pageSize = 5;
6969
component.pageIndex = 2;
7070
fixture.detectChanges();
71-
expect(rangeElement.innerText).toBe('11 - 12 of 12');
71+
expect(rangeElement.innerText).toBe('11 12 of 12');
7272

7373
// View third page of list of 10, each page contains 5 items.
7474
component.length = 10;
7575
component.pageSize = 5;
7676
component.pageIndex = 2;
7777
fixture.detectChanges();
78-
expect(rangeElement.innerText).toBe('11 - 15 of 10');
78+
expect(rangeElement.innerText).toBe('11 15 of 10');
7979

8080
// View third page of list of -5, each page contains 5 items.
8181
component.length = -5;
8282
component.pageSize = 5;
8383
component.pageIndex = 2;
8484
fixture.detectChanges();
85-
expect(rangeElement.innerText).toBe('11 - 15 of 0');
85+
expect(rangeElement.innerText).toBe('11 15 of 0');
8686
});
8787

8888
it('should show right aria-labels for select and buttons', () => {
@@ -247,19 +247,19 @@ describe('MatPaginator', () => {
247247
it('should mark for check when inputs are changed directly', () => {
248248
const rangeElement = fixture.nativeElement.querySelector('.mat-paginator-range-label');
249249

250-
expect(rangeElement.innerText).toBe('1 - 10 of 100');
250+
expect(rangeElement.innerText).toBe('1 10 of 100');
251251

252252
paginator.length = 99;
253253
fixture.detectChanges();
254-
expect(rangeElement.innerText).toBe('1 - 10 of 99');
254+
expect(rangeElement.innerText).toBe('1 10 of 99');
255255

256256
paginator.pageSize = 6;
257257
fixture.detectChanges();
258-
expect(rangeElement.innerText).toBe('1 - 6 of 99');
258+
expect(rangeElement.innerText).toBe('1 6 of 99');
259259

260260
paginator.pageIndex = 1;
261261
fixture.detectChanges();
262-
expect(rangeElement.innerText).toBe('7 - 12 of 99');
262+
expect(rangeElement.innerText).toBe('7 12 of 99');
263263

264264
// Having one option and the same page size should remove the select menu
265265
expect(fixture.nativeElement.querySelector('.mat-select')).not.toBeNull();

0 commit comments

Comments
 (0)