From 97520e28c96702e97c7653fc71f88410b717da96 Mon Sep 17 00:00:00 2001 From: mxie <15623530290@163.com> Date: Fri, 28 Sep 2018 11:34:27 +0800 Subject: [PATCH] test: not-before not-after year month --- test/index.spec.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test/index.spec.js b/test/index.spec.js index 68e8a11..110d137 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -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)', () => {