Skip to content

Commit

Permalink
Merge d8ae9ef into 7056546
Browse files Browse the repository at this point in the history
  • Loading branch information
martinherweg committed Jun 12, 2019
2 parents 7056546 + d8ae9ef commit 630edc6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
:selectedDate="selectedDate"
:showMonthView="showMonthView"
:allowedToShowView="allowedToShowView"
:full-month-name="fullMonthName"
:disabledDates="disabledDates"
:calendarClass="calendarClass"
:calendarStyle="calendarStyle"
Expand Down
4 changes: 3 additions & 1 deletion src/components/PickerMonth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
selectedDate: Date,
pageDate: Date,
pageTimestamp: Number,
fullMonthName: Boolean,
disabledDates: Object,
calendarClass: [String, Object, Array],
calendarStyle: Object,
Expand All @@ -50,8 +51,9 @@ export default {
? new Date(Date.UTC(d.getUTCFullYear(), 0, d.getUTCDate()))
: new Date(d.getFullYear(), 0, d.getDate(), d.getHours(), d.getMinutes())
for (let i = 0; i < 12; i++) {
const month = this.fullMonthName ? this.utils.getMonthName(i, this.translation.months) : this.utils.getMonthNameAbbr(i, this.translation.monthsAbbr)
months.push({
month: this.utils.getMonthName(i, this.translation.months),
month,
timestamp: dObj.getTime(),
isSelected: this.isSelectedMonth(dObj),
isDisabled: this.isDisabledMonth(dObj)
Expand Down
2 changes: 2 additions & 0 deletions test/unit/jest.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const path = require('path')

module.exports = {
rootDir: path.resolve(__dirname, '../../'),
testURL: 'http://localhost/',
verbose: true,
moduleFileExtensions: [
'js',
'json',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/DateInput/typedDates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('DateInput', () => {
it('emits closeCalendar when return is pressed', () => {
const input = wrapper.find('input')
const blurSpy = jest.spyOn(input.element, 'blur')
input.trigger('keyup', {keyCode: 13})
input.trigger('keyup.enter')
expect(blurSpy).toBeCalled()
})

Expand Down
6 changes: 6 additions & 0 deletions test/unit/specs/PickerMonth/pickerMonth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ describe('PickerMonth', () => {
yearBtn.trigger('click')
expect(wrapper.emitted().showYearCalendar).toBeTruthy()
})

it('shows abbreviated month names when full-month-name is false', () => {
const firstMonth = wrapper.find('.month')
const abbreviatedMonth = en._monthsAbbr[0]
expect(firstMonth.text()).toEqual(abbreviatedMonth)
})
})

0 comments on commit 630edc6

Please sign in to comment.