Skip to content

Commit e6814d0

Browse files
committed
fix(calendar): fix tests for viewDate
1 parent f7beb24 commit e6814d0

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

projects/igniteui-angular/src/lib/calendar/calendar.component.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ describe('IgxCalendar - ', () => {
253253
expect(calendar.formatOptions).toEqual(jasmine.objectContaining(defaultOptions));
254254
expect(calendar.formatViews).toEqual(jasmine.objectContaining(defaultViews));
255255
expect(headerYear.nativeElement.textContent.trim()).toMatch('2018');
256-
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Mon');
257-
expect(headerDate.nativeElement.textContent.trim()).toMatch('Sep 17');
256+
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Sat');
257+
expect(headerDate.nativeElement.textContent.trim()).toMatch('Sep 1');
258258
expect(bodyYear.nativeElement.textContent.trim()).toMatch('2018');
259259
expect(bodyMonth.nativeElement.textContent.trim()).toMatch('Sep');
260260

@@ -268,8 +268,8 @@ describe('IgxCalendar - ', () => {
268268
expect(calendar.formatOptions).toEqual(jasmine.objectContaining(Object.assign(defaultOptions, formatOptions)));
269269
expect(calendar.formatViews).toEqual(jasmine.objectContaining(Object.assign(defaultViews, formatViews)));
270270
expect(headerYear.nativeElement.textContent.trim()).toMatch('18');
271-
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Mon');
272-
expect(headerDate.nativeElement.textContent.trim()).toMatch('September 17');
271+
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Sat');
272+
expect(headerDate.nativeElement.textContent.trim()).toMatch('September 1');
273273
expect(bodyYear.nativeElement.textContent.trim()).toMatch('18');
274274
expect(bodyMonth.nativeElement.textContent.trim()).toMatch('September');
275275

@@ -284,8 +284,8 @@ describe('IgxCalendar - ', () => {
284284
expect(calendar.formatOptions).toEqual(jasmine.objectContaining(Object.assign(defaultOptions, formatOptions)));
285285
expect(calendar.formatViews).toEqual(jasmine.objectContaining(Object.assign(defaultViews, formatViews)));
286286
expect(headerYear.nativeElement.textContent.trim()).toMatch('2018');
287-
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Mon');
288-
expect(headerDate.nativeElement.textContent.trim()).toMatch('September 17');
287+
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Sat');
288+
expect(headerDate.nativeElement.textContent.trim()).toMatch('September 1');
289289
expect(bodyYear.nativeElement.textContent.trim()).toMatch('2018');
290290
expect(bodyMonth.nativeElement.textContent.trim()).toMatch('8');
291291
});
@@ -327,8 +327,8 @@ describe('IgxCalendar - ', () => {
327327
fixture.detectChanges();
328328

329329
expect(headerYear.nativeElement.textContent.trim()).toMatch('2018');
330-
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Mon');
331-
expect(headerDate.nativeElement.textContent.trim()).toMatch('Sep 17');
330+
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('Sat');
331+
expect(headerDate.nativeElement.textContent.trim()).toMatch('Sep 1');
332332
expect(bodyYear.nativeElement.textContent.trim()).toMatch('2018');
333333
expect(bodyMonth.nativeElement.textContent.trim()).toMatch('Sep');
334334
expect(bodyWeekday.nativeElement.textContent.trim()).toMatch('Sun');
@@ -341,8 +341,8 @@ describe('IgxCalendar - ', () => {
341341
bodyWeekday = dom.query(By.css(HelperTestFunctions.WEEKSTART_LABEL_CSSCLASS));
342342
expect(calendar.locale).toEqual(locale);
343343
expect(headerYear.nativeElement.textContent.trim()).toMatch('18');
344-
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('lun.,');
345-
expect(headerDate.nativeElement.textContent.trim()).toMatch('17 sept.');
344+
expect(headerWeekday.nativeElement.textContent.trim()).toMatch('sam.,');
345+
expect(headerDate.nativeElement.textContent.trim()).toMatch('1 sept.');
346346
expect(bodyYear.nativeElement.textContent.trim()).toMatch('18');
347347
expect(bodyMonth.nativeElement.textContent.trim()).toMatch('sept.');
348348
expect(bodyWeekday.nativeElement.textContent.trim()).toMatch('Dim.');

projects/igniteui-angular/src/lib/calendar/month-picker/month-picker.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('IgxMonthPicker', () => {
7676
};
7777

7878
expect(monthPicker.value).toBeUndefined();
79-
expect(monthPicker.viewDate.getDate()).toEqual(instance.viewDate.getDate());
79+
expect(monthPicker.viewDate.getDate()).toEqual(1);
8080
expect(monthPicker.locale).toEqual('en');
8181

8282
const today = new Date(Date.now());
@@ -89,7 +89,7 @@ describe('IgxMonthPicker', () => {
8989
expect(monthPicker.locale).toEqual('fr');
9090
expect(monthPicker.formatOptions.year).toEqual('2-digit');
9191
expect(monthPicker.value.getDate()).toEqual(today.getDate());
92-
expect(monthPicker.viewDate.getDate()).toEqual(today.getDate());
92+
expect(monthPicker.viewDate.getDate()).toEqual(1);
9393
});
9494

9595
it('should properly set formatOptions and formatViews', () => {
@@ -173,7 +173,7 @@ describe('IgxMonthPicker', () => {
173173
expect(monthPicker.onSelection.emit).toHaveBeenCalled();
174174
expect(currentMonth.nativeElement.textContent.trim()).toEqual('Mar');
175175

176-
const nextDay = new Date(2019, 2, 7);
176+
const nextDay = new Date(2019, 2, 1);
177177
expect(fixture.componentInstance.model.getDate()).toEqual(nextDay.getDate());
178178
});
179179

0 commit comments

Comments
 (0)