2018-11-04 19:44:10 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
import moment from 'moment';
|
2018-01-13 19:11:53 +08:00
|
|
|
import DatePicker from '..';
|
2017-11-30 09:54:31 +08:00
|
|
|
import focusTest from '../../../tests/shared/focusTest';
|
2018-11-04 19:44:10 +08:00
|
|
|
import { openPanel } from './utils';
|
2017-11-30 09:54:31 +08:00
|
|
|
|
2018-01-13 19:11:53 +08:00
|
|
|
const { MonthPicker } = DatePicker;
|
|
|
|
|
2017-11-30 09:54:31 +08:00
|
|
|
describe('MonthPicker', () => {
|
|
|
|
focusTest(MonthPicker);
|
2018-11-04 19:44:10 +08:00
|
|
|
|
|
|
|
it('reset select item when popup close', () => {
|
2018-12-07 20:02:01 +08:00
|
|
|
const wrapper = mount(<MonthPicker value={moment('2018-07-01')} />);
|
2018-11-04 19:44:10 +08:00
|
|
|
openPanel(wrapper);
|
2018-12-07 20:02:01 +08:00
|
|
|
wrapper
|
|
|
|
.find('.ant-calendar-month-panel-month')
|
|
|
|
.first()
|
|
|
|
.simulate('click');
|
|
|
|
wrapper
|
|
|
|
.find('.ant-calendar-month-panel-cell')
|
|
|
|
.at(6)
|
|
|
|
.hasClass('ant-calendar-month-panel-selected-cell');
|
2018-11-04 19:44:10 +08:00
|
|
|
});
|
2017-11-30 09:54:31 +08:00
|
|
|
});
|