mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 06:58:33 +08:00
37 lines
941 B
JavaScript
37 lines
941 B
JavaScript
import React from 'react';
|
|
import { mount, render } from 'enzyme';
|
|
import moment from 'moment';
|
|
import DatePicker from '..';
|
|
|
|
const { MonthPicker, WeekPicker } = DatePicker;
|
|
|
|
describe('MonthPicker and WeekPicker', () => {
|
|
it('render MonthPicker', () => {
|
|
const birthday = moment('2000-01-01', 'YYYY-MM-DD').locale('zh-cn');
|
|
const wrapper = mount(<MonthPicker open />);
|
|
wrapper.setProps({ value: birthday });
|
|
expect(
|
|
render(
|
|
wrapper
|
|
.find('Trigger')
|
|
.instance()
|
|
.getComponent(),
|
|
),
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
it('render WeekPicker', () => {
|
|
const birthday = moment('2000-01-01', 'YYYY-MM-DD').locale('zh-cn');
|
|
const wrapper = mount(<WeekPicker open />);
|
|
wrapper.setProps({ value: birthday });
|
|
expect(
|
|
render(
|
|
wrapper
|
|
.find('Trigger')
|
|
.instance()
|
|
.getComponent(),
|
|
),
|
|
).toMatchSnapshot();
|
|
});
|
|
});
|