Skip to content

Commit 6400931

Browse files
committed
address comments
1 parent b2caad6 commit 6400931

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

src/lib/datepicker/calendar.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('MatCalendar', () => {
126126
expect(calendarInstance._currentView).toBe('multi-year');
127127
expect(calendarInstance._activeDate).toEqual(new Date(2017, JAN, 31));
128128

129-
(<HTMLElement>calendarElement.querySelector('.mat-calendar-body-active')).click();
129+
(calendarElement.querySelector('.mat-calendar-body-active') as HTMLElement).click();
130130
fixture.detectChanges();
131131

132132
expect(calendarInstance._currentView).toBe('year');
@@ -168,7 +168,7 @@ describe('MatCalendar', () => {
168168
expect(calendarInstance._activeDate).toEqual(new Date(2017, JAN, 31));
169169

170170
let yearCells = calendarElement.querySelectorAll('.mat-calendar-body-cell');
171-
(<HTMLElement>yearCells[0]).click();
171+
(yearCells[0] as HTMLElement).click();
172172
fixture.detectChanges();
173173

174174
expect(calendarInstance._currentView).toBe('year');
@@ -345,7 +345,7 @@ describe('MatCalendar', () => {
345345

346346
expect(calendarInstance._currentView).toBe('multi-year');
347347

348-
(<HTMLElement>calendarBodyEl.querySelector('.mat-calendar-body-active')).click();
348+
(calendarBodyEl.querySelector('.mat-calendar-body-active') as HTMLElement).click();
349349
fixture.detectChanges();
350350

351351
expect(calendarInstance._currentView).toBe('year');
@@ -713,7 +713,7 @@ describe('MatCalendar', () => {
713713
periodButton.click();
714714
fixture.detectChanges();
715715

716-
(<HTMLElement>calendarElement.querySelector('.mat-calendar-body-active')).click();
716+
(calendarElement.querySelector('.mat-calendar-body-active') as HTMLElement).click();
717717
fixture.detectChanges();
718718

719719
spyOn(calendarInstance.yearView, '_init').and.callThrough();
@@ -731,7 +731,7 @@ describe('MatCalendar', () => {
731731
periodButton.click();
732732
fixture.detectChanges();
733733

734-
(<HTMLElement>calendarElement.querySelector('.mat-calendar-body-active')).click();
734+
(calendarElement.querySelector('.mat-calendar-body-active') as HTMLElement).click();
735735
fixture.detectChanges();
736736

737737
spyOn(calendarInstance.yearView, '_init').and.callThrough();
@@ -829,7 +829,7 @@ describe('MatCalendar', () => {
829829
dispatchMouseEvent(periodButton, 'click');
830830
fixture.detectChanges();
831831

832-
(<HTMLElement>calendarElement.querySelector('.mat-calendar-body-active')).click();
832+
(calendarElement.querySelector('.mat-calendar-body-active') as HTMLElement).click();
833833
fixture.detectChanges();
834834

835835
calendarInstance._activeDate = new Date(2017, NOV, 1);

src/lib/datepicker/calendar.ts

+1-19
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
297297
private _isSameView(date1: D, date2: D): boolean {
298298
if (this._currentView == 'month') {
299299
return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) &&
300-
this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2)
300+
this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2);
301301
}
302302
if (this._currentView == 'year') {
303303
return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2);
@@ -449,24 +449,6 @@ export class MatCalendar<D> implements AfterContentInit, OnDestroy, OnChanges {
449449
event.preventDefault();
450450
}
451451

452-
/**
453-
* Determine the date for the month that comes before the given month in the same column in the
454-
* calendar table.
455-
*/
456-
private _prevMonthInSameCol(date: D): D {
457-
// Decrement by 4 since there are 4 months per row.
458-
return this._dateAdapter.addCalendarMonths(date, -4);
459-
}
460-
461-
/**
462-
* Determine the date for the month that comes after the given month in the same column in the
463-
* calendar table.
464-
*/
465-
private _nextMonthInSameCol(date: D): D {
466-
// Increment by 4 since there are 4 months per row.
467-
return this._dateAdapter.addCalendarMonths(date, 4);
468-
}
469-
470452
/**
471453
* @param obj The object to check.
472454
* @returns The given object if it is both a date instance and valid, otherwise null.

0 commit comments

Comments
 (0)