Skip to content

Commit 3461dd1

Browse files
wnvkojelbourn
authored andcommitted
test(navDatePicker): fix failing tests, #16356
1 parent 8df7006 commit 3461dd1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/material/datepicker/calendar-body.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
[style.paddingTop]="_cellPadding"
4343
[style.paddingBottom]="_cellPadding">
4444
<button class="mat-calendar-body-cell-content"
45-
mat-button
45+
mat-button type="button"
46+
[attr.aria-label]="item.displayValue"
4647
[class.mat-calendar-body-selected]="selectedValue === item.value"
4748
[class.mat-calendar-body-today]="todayValue === item.value">
4849
{{item.displayValue}}

src/material/datepicker/calendar.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,19 @@ describe('MatCalendar', () => {
7070

7171
let todayCell = calendarElement.querySelector('.mat-calendar-body-today')!;
7272
expect(todayCell).not.toBeNull();
73-
expect(todayCell.innerHTML.trim()).toBe('1');
73+
let todayCellSpan = todayCell.querySelector('span')!;
74+
expect(todayCellSpan).not.toBeNull();
75+
expect(todayCellSpan.innerHTML.trim()).toBe('1');
7476

7577
fakeToday = new Date(2018, 0, 10);
7678
calendarInstance.updateTodaysDate();
7779
fixture.detectChanges();
7880

7981
todayCell = calendarElement.querySelector('.mat-calendar-body-today')!;
8082
expect(todayCell).not.toBeNull();
81-
expect(todayCell.innerHTML.trim()).toBe('10');
83+
todayCellSpan = todayCell.querySelector('span')!;
84+
expect(todayCellSpan).not.toBeNull();
85+
expect(todayCellSpan.innerHTML.trim()).toBe('10');
8286
}));
8387

8488
it('should be in month view with specified month active', () => {

0 commit comments

Comments
 (0)