2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-23 22:50:35 +03:00

fix: when year < 100 && year >= 0 should be right

This commit is contained in:
mengxiong10
2019-11-13 15:30:07 +08:00
parent c03632fa87
commit 8c546cc994
4 changed files with 31 additions and 8 deletions
+13
View File
@@ -43,6 +43,19 @@ describe('CalendarPanel', () => {
expect(wrapper.emitted().select[0][0]).toEqual(new Date(2010, 0));
});
it('feat: when year >= 0 && year < 100, should be emit right', () => {
wrapper = mount(CalendarPanel, {
propsData: {
type: 'year',
defaultValue: new Date().setFullYear(11),
},
});
const tds = wrapper.findAll('.mx-table-year td > div');
tds.at(0).trigger('click');
const expectedDate = new Date(10, 0).setFullYear(10);
expect(wrapper.emitted().select[0][0].getTime()).toBe(expectedDate);
});
it('feat: active class', () => {
wrapper = mount(CalendarPanel);
const td = wrapper.find('.mx-table-date td:nth-child(6)');