2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-10 21:12:26 +03:00

test: not-before not-after year month

This commit is contained in:
mxie
2018-09-28 11:34:27 +08:00
parent fef39dc0cc
commit 97520e28c9
+22 -2
View File
@@ -352,7 +352,7 @@ describe('calendar-panel', () => {
wrapper = mount(CalendarPanel, {
propsData: {
value: new Date(2018, 4, 2),
notBefore: new Date(2018, 4, 1, 12),
notBefore: new Date(2018, 4, 2, 12),
notAfter: new Date(2018, 4, 31, 12)
}
})
@@ -360,12 +360,32 @@ describe('calendar-panel', () => {
for (let i = 0; i < 42; i++) {
const td = tds.at(i)
const classes = td.classes()
if (i < 2 || i > 32) {
if (i < 3 || i > 32) {
expect(classes).toContain('disabled')
} else {
expect(classes).not.toContain('disabled')
}
}
const months = wrapper.findAll('.mx-panel-month .cell')
for (let i = 0; i < 12; i++) {
const month = months.at(i)
const classes = month.classes()
if (i === 4) {
expect(classes).not.toContain('disabled')
} else {
expect(classes).toContain('disabled')
}
}
const years = wrapper.findAll('.mx-panel-year .cell')
for (let i = 0; i < years.length; i++) {
const year = years.at(i)
const classes = year.classes()
if (i === 8) {
expect(classes).not.toContain('disabled')
} else {
expect(classes).toContain('disabled')
}
}
})
it('prop: disabledDays(Array)', () => {