Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/date-picker/src/vaadin-month-calendar-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ export const MonthCalendarMixin = (superClass) =>
const weekDayNamesShort = this._applyFirstDayOfWeek(weekdaysShort, firstDayOfWeek);
const weekDayNames = this._applyFirstDayOfWeek(weekdays, firstDayOfWeek);

return weekDayNames.map((day, index) => {
return {
weekDay: day,
weekDayShort: weekDayNamesShort[index],
};
});
return weekDayNames
.map((day, index) => {
return {
weekDay: day,
weekDayShort: weekDayNamesShort[index],
};
})
.slice(0, 7);
}

/** @private */
Expand Down
12 changes: 12 additions & 0 deletions packages/date-picker/test/month-calendar.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ describe('vaadin-month-calendar', () => {
expect(monthCalendar.shadowRoot.querySelector('[part="month-header"]').textContent).to.equal('January 2000');
});

it('should render at most 7 weekdays', async () => {
monthCalendar.i18n = {
...monthCalendar.i18n,
weekdays: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
weekdaysShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
};
await nextRender();

const weekdays = getWeekDayCells(monthCalendar);
expect(weekdays.length).to.equal(7);
});

it('should fire value change on tap', () => {
const dateElements = getDateCells(monthCalendar);
tap(dateElements[10]);
Expand Down