Skip to content

Commit

Permalink
chore: fix broken date-picker test
Browse files Browse the repository at this point in the history
  • Loading branch information
DRiFTy17 committed Jan 4, 2024
1 parent db849c2 commit 98c9369
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/calendar/calendar-foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,8 @@ export class CalendarFoundation implements ICalendarFoundation {
private _applyMax(): void {
this._adapter.toggleHostAttribute(CALENDAR_CONSTANTS.attributes.MAX, !!this._maxAttribute, this._maxAttribute as string);

if (this._max && this._max.getMonth() < this._month) {
if (this._max && (this._max.getMonth() < this._month || this._max.getFullYear() < this._year)) {
this._year = this._max.getFullYear();
this._month = this._max.getMonth();
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/spec/date-picker/date-picker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ describe('DatePickerComponent', function(this: ITestContext) {

openPopup(this.context.component);
const calendar = getCalendar(this.context.component);
const expectedMonth = date.getMonth() <= 0 ? 11 : date.getMonth() - 1;

expect(calendar.month).toEqual(date.getMonth() - 1);
expect(calendar.month).toEqual(expectedMonth);
});

it('should automatically render a toggle button with a Forge text-field component', function(this: ITestContext) {
Expand Down

0 comments on commit 98c9369

Please sign in to comment.