ant-design/components/date-picker/__tests__/other.test.js

37 lines
941 B
JavaScript
Raw Normal View History

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');
2018-12-07 20:02:01 +08:00
const wrapper = mount(<MonthPicker open />);
wrapper.setProps({ value: birthday });
2018-12-07 20:02:01 +08:00
expect(
render(
wrapper
.find('Trigger')
.instance()
.getComponent(),
),
).toMatchSnapshot();
});
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 />);
wrapper.setProps({ value: birthday });
2018-12-07 20:02:01 +08:00
expect(
render(
wrapper
.find('Trigger')
.instance()
.getComponent(),
),
).toMatchSnapshot();
});
});