2017-08-31 20:44:22 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { mount, render } from 'enzyme';
|
|
|
|
import moment from 'moment';
|
2018-06-22 21:05:13 +08:00
|
|
|
import DatePicker from '..';
|
2018-01-13 19:11:53 +08:00
|
|
|
|
|
|
|
const { MonthPicker, WeekPicker } = DatePicker;
|
2017-08-31 20:44:22 +08:00
|
|
|
|
|
|
|
describe('MonthPicker and WeekPicker', () => {
|
|
|
|
it('render MonthPicker', () => {
|
|
|
|
const birthday = moment('2000-01-01', 'YYYY-MM-DD').locale('zh-cn');
|
2018-12-07 20:02:01 +08:00
|
|
|
const wrapper = mount(<MonthPicker open />);
|
2017-08-31 20:44:22 +08:00
|
|
|
wrapper.setProps({ value: birthday });
|
2018-12-07 20:02:01 +08:00
|
|
|
expect(
|
|
|
|
render(
|
|
|
|
wrapper
|
|
|
|
.find('Trigger')
|
|
|
|
.instance()
|
|
|
|
.getComponent(),
|
|
|
|
),
|
|
|
|
).toMatchSnapshot();
|
2017-08-31 20:44:22 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('render WeekPicker', () => {
|
|
|
|
const birthday = moment('2000-01-01', 'YYYY-MM-DD').locale('zh-cn');
|
2018-12-07 20:02:01 +08:00
|
|
|
const wrapper = mount(<WeekPicker open />);
|
2017-08-31 20:44:22 +08:00
|
|
|
wrapper.setProps({ value: birthday });
|
2018-12-07 20:02:01 +08:00
|
|
|
expect(
|
|
|
|
render(
|
|
|
|
wrapper
|
|
|
|
.find('Trigger')
|
|
|
|
.instance()
|
|
|
|
.getComponent(),
|
|
|
|
),
|
|
|
|
).toMatchSnapshot();
|
2017-08-31 20:44:22 +08:00
|
|
|
});
|
|
|
|
});
|