2021-09-25 08:51:32 +00:00
|
|
|
import dayjs from 'dayjs';
|
2019-01-12 03:33:27 +00:00
|
|
|
import { mount } from '@vue/test-utils';
|
2021-09-25 08:51:32 +00:00
|
|
|
import { asyncExpect , sleep } from '../../../tests/utils';
|
2019-01-12 03:33:27 +00:00
|
|
|
import MockDate from 'mockdate';
|
|
|
|
import Calendar from '..';
|
2020-03-07 11:45:13 +00:00
|
|
|
import Header from '../Header';
|
|
|
|
import mountTest from '../../../tests/shared/mountTest';
|
2021-09-25 08:51:32 +00:00
|
|
|
import generateConfig from '../../vc-picker/generate/dayjs';
|
2018-05-21 14:59:04 +00:00
|
|
|
|
|
|
|
describe('Calendar', () => {
|
2020-03-07 11:45:13 +00:00
|
|
|
mountTest(Calendar);
|
2020-07-27 08:04:37 +00:00
|
|
|
beforeEach(() => {
|
2020-03-07 11:45:13 +00:00
|
|
|
document.body.innerHTML = '';
|
|
|
|
});
|
2021-09-25 08:51:32 +00:00
|
|
|
|
|
|
|
function openSelect(wrapper, className) {
|
|
|
|
wrapper.find(className).find('.ant-select-selector').trigger('mousedown');
|
|
|
|
}
|
|
|
|
|
|
|
|
function findSelectItem(wrapper) {
|
|
|
|
return wrapper.findAll('.ant-select-item-option');
|
|
|
|
}
|
|
|
|
|
|
|
|
function clickSelectItem(wrapper, index = 0) {
|
|
|
|
findSelectItem(wrapper)[index].trigger('click');
|
|
|
|
}
|
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('Calendar should be selectable', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const onSelect = jest.fn();
|
2018-05-21 14:59:04 +00:00
|
|
|
const wrapper = mount(
|
|
|
|
{
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
return <Calendar onSelect={onSelect} />;
|
2018-05-21 14:59:04 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('.ant-picker-cell')[0].trigger('click');
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2020-03-07 11:45:13 +00:00
|
|
|
expect(onSelect).toHaveBeenCalledWith(expect.anything());
|
2019-01-12 03:33:27 +00:00
|
|
|
const value = onSelect.mock.calls[0][0];
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(dayjs.isDayjs(value)).toBe(true);
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('only Valid range should be selectable', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const onSelect = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const validRange = [dayjs('2018-02-02'), dayjs('2018-02-18')];
|
2018-05-21 14:59:04 +00:00
|
|
|
const wrapper = mount(
|
|
|
|
{
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Calendar
|
|
|
|
onSelect={onSelect}
|
|
|
|
validRange={validRange}
|
2021-09-25 08:51:32 +00:00
|
|
|
defaultValue={dayjs('2018-02-02')}
|
2019-01-12 03:33:27 +00:00
|
|
|
/>
|
|
|
|
);
|
2018-05-21 14:59:04 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('[title="2018-02-01"]')[0].trigger('click');
|
|
|
|
wrapper.findAll('[title="2018-02-02"]')[0].trigger('click');
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(onSelect.mock.calls.length).toBe(1);
|
|
|
|
});
|
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('dates other than in valid range should be disabled', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const onSelect = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const validRange = [dayjs('2018-02-02'), dayjs('2018-02-18')];
|
2018-05-21 14:59:04 +00:00
|
|
|
const wrapper = mount(
|
|
|
|
{
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Calendar
|
|
|
|
onSelect={onSelect}
|
|
|
|
validRange={validRange}
|
2021-09-25 08:51:32 +00:00
|
|
|
defaultValue={dayjs('2018-02-02')}
|
2019-01-12 03:33:27 +00:00
|
|
|
/>
|
|
|
|
);
|
2018-05-21 14:59:04 +00:00
|
|
|
},
|
2018-05-30 06:12:43 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('[title="2018-02-20"]')[0].trigger('click');
|
|
|
|
expect(wrapper.find('[title="2018-02-20"]').classes()).toContain('ant-picker-cell-disabled');
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(onSelect.mock.calls.length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('months other than in valid range should be disabled', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const onSelect = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const validRange = [dayjs('2018-02-02'), dayjs('2018-05-18')];
|
2018-05-21 14:59:04 +00:00
|
|
|
const wrapper = mount(
|
|
|
|
{
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Calendar
|
|
|
|
onSelect={onSelect}
|
|
|
|
validRange={validRange}
|
2021-09-25 08:51:32 +00:00
|
|
|
defaultValue={dayjs('2018-02-02')}
|
2019-01-12 03:33:27 +00:00
|
|
|
mode="year"
|
|
|
|
/>
|
|
|
|
);
|
2018-05-21 14:59:04 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.findAll('[title="2018-01"]')[0].classes()).toContain(
|
|
|
|
'ant-picker-cell-disabled',
|
2020-07-27 08:04:37 +00:00
|
|
|
);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.findAll('[title="2018-02"]')[0].classes()).not.toContain(
|
|
|
|
'ant-picker-cell-disabled',
|
2020-07-27 08:04:37 +00:00
|
|
|
);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.findAll('[title="2018-06"]')[0].classes()).toContain(
|
|
|
|
'ant-picker-cell-disabled',
|
2020-07-27 08:04:37 +00:00
|
|
|
);
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('[title="2018-01"]')[0].trigger('click');
|
|
|
|
wrapper.findAll('[title="2018-03"]')[0].trigger('click');
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(onSelect.mock.calls.length).toBe(1);
|
|
|
|
});
|
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-07-01 09:12:24 +00:00
|
|
|
it('months other than in valid range should not be shown in header', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
document.body.innerHTML = '';
|
2021-09-25 08:51:32 +00:00
|
|
|
const validRange = [dayjs('2017-02-02'), dayjs('2018-05-18')];
|
2020-10-24 12:45:28 +00:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
2018-05-21 14:59:04 +00:00
|
|
|
const wrapper = mount(
|
|
|
|
{
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
return <Calendar validRange={validRange} />;
|
2018-05-21 14:59:04 +00:00
|
|
|
},
|
|
|
|
},
|
2020-07-25 07:46:49 +00:00
|
|
|
{ sync: false, attachTo: 'body' },
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2021-09-25 08:51:32 +00:00
|
|
|
await sleep();
|
|
|
|
openSelect(wrapper, '.ant-picker-calendar-year-select');
|
|
|
|
await sleep();
|
|
|
|
clickSelectItem(wrapper);
|
|
|
|
await sleep();
|
|
|
|
openSelect(wrapper, '.ant-picker-calendar-month-select');
|
|
|
|
await sleep();
|
|
|
|
// 2 years and 11 months
|
|
|
|
expect(wrapper.findAll('.ant-select-item-option').length).toBe(13);
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('getDateRange should returns a disabledDate function', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const validRange = [dayjs('2018-02-02'), dayjs('2018-05-18')];
|
2019-01-12 03:33:27 +00:00
|
|
|
const wrapper = mount(Calendar, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2019-01-12 03:33:27 +00:00
|
|
|
validRange,
|
2021-09-25 08:51:32 +00:00
|
|
|
defaultValue: dayjs('2018-02-02'),
|
2019-01-12 03:33:27 +00:00
|
|
|
},
|
|
|
|
sync: false,
|
|
|
|
});
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const { disabledDate } = wrapper.getComponent({ name: 'PickerPanel' }).props();
|
|
|
|
expect(disabledDate(dayjs('2018-06-02'))).toBe(true);
|
|
|
|
expect(disabledDate(dayjs('2018-04-02'))).toBe(false);
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('Calendar should change mode by prop', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const monthMode = 'month';
|
|
|
|
const yearMode = 'year';
|
|
|
|
const wrapper = mount(Calendar, { sync: false });
|
2020-07-27 08:04:37 +00:00
|
|
|
await sleep(50);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.getComponent({ name: 'CalendarHeader' }).props().mode).toEqual(monthMode);
|
2020-07-27 08:04:37 +00:00
|
|
|
wrapper.setProps({ mode: 'year' });
|
|
|
|
await sleep(50);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.getComponent({ name: 'CalendarHeader' }).props().mode).toEqual(yearMode);
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-05-21 14:59:04 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('Calendar should switch mode', async () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const monthMode = 'month';
|
|
|
|
const yearMode = 'year';
|
|
|
|
const onPanelChangeStub = jest.fn();
|
|
|
|
const wrapper = mount(Calendar, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2019-01-12 03:33:27 +00:00
|
|
|
mode: yearMode,
|
2020-07-25 13:46:52 +00:00
|
|
|
onPanelChange: onPanelChangeStub,
|
2019-01-12 03:33:27 +00:00
|
|
|
},
|
|
|
|
sync: false,
|
|
|
|
});
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.getComponent({ name: 'CalendarHeader' }).props().mode).toEqual(yearMode);
|
2020-03-07 11:45:13 +00:00
|
|
|
wrapper.setProps({ mode: monthMode });
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.getComponent({ name: 'CalendarHeader' }).props().mode).toEqual(monthMode);
|
2020-03-07 11:45:13 +00:00
|
|
|
expect(onPanelChangeStub).toHaveBeenCalledTimes(0);
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
|
|
|
});
|
2018-11-28 13:58:42 +00:00
|
|
|
|
2018-12-08 04:05:42 +00:00
|
|
|
it('Calendar should support locale', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
MockDate.set(dayjs('2018-10-19'));
|
2018-11-28 13:58:42 +00:00
|
|
|
// eslint-disable-next-line
|
|
|
|
const zhCN = require('../locale/zh_CN').default;
|
2019-01-12 03:33:27 +00:00
|
|
|
const wrapper = mount(Calendar, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2019-01-12 03:33:27 +00:00
|
|
|
locale: zhCN,
|
|
|
|
},
|
|
|
|
sync: false,
|
|
|
|
});
|
2018-12-08 04:05:42 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
MockDate.reset();
|
|
|
|
});
|
|
|
|
});
|
2020-03-07 11:45:13 +00:00
|
|
|
|
|
|
|
it('should trigger onPanelChange when click last month of date', () => {
|
|
|
|
const onPanelChange = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const date = new dayjs('1990-09-03');
|
2020-03-07 11:45:13 +00:00
|
|
|
const wrapper = mount(Calendar, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2020-03-07 11:45:13 +00:00
|
|
|
value: date,
|
2020-07-25 13:46:52 +00:00
|
|
|
onPanelChange,
|
2020-03-07 11:45:13 +00:00
|
|
|
},
|
|
|
|
sync: false,
|
|
|
|
});
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('.ant-picker-cell')[0].trigger('click');
|
2020-03-07 11:45:13 +00:00
|
|
|
|
|
|
|
expect(onPanelChange).toHaveBeenCalled();
|
|
|
|
expect(onPanelChange.mock.calls[0][0].month()).toEqual(date.month() - 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('switch should work correctly without prop mode', async () => {
|
|
|
|
const onPanelChange = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const date = new dayjs(new Date(Date.UTC(2017, 7, 9, 8)));
|
2020-03-07 11:45:13 +00:00
|
|
|
const wrapper = mount(Calendar, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2020-03-07 11:45:13 +00:00
|
|
|
value: date,
|
2020-07-25 13:46:52 +00:00
|
|
|
onPanelChange,
|
2020-03-07 11:45:13 +00:00
|
|
|
},
|
|
|
|
sync: false,
|
2020-07-27 08:04:37 +00:00
|
|
|
attachTo: 'body',
|
2020-03-07 11:45:13 +00:00
|
|
|
});
|
2020-07-27 08:04:37 +00:00
|
|
|
await sleep(300);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.getComponent({ name: 'CalendarHeader' }).props().mode).toBe('month');
|
|
|
|
expect(wrapper.findAll('.ant-picker-date-panel').length).toBe(1);
|
|
|
|
expect(wrapper.findAll('.ant-picker-month-panel').length).toBe(0);
|
2020-07-27 08:04:37 +00:00
|
|
|
await wrapper.findAll('.ant-radio-button-input[value="year"]')[0].trigger('change');
|
|
|
|
await sleep(300);
|
2021-09-25 08:51:32 +00:00
|
|
|
expect(wrapper.findAll('.ant-picker-date-panel').length).toBe(0);
|
|
|
|
expect(wrapper.findAll('.ant-picker-month-panel').length).toBe(1);
|
2020-03-07 11:45:13 +00:00
|
|
|
expect(onPanelChange).toHaveBeenCalled();
|
|
|
|
expect(onPanelChange.mock.calls[0][1]).toEqual('year');
|
|
|
|
});
|
|
|
|
|
|
|
|
const createWrapper = async (start, end, value, onValueChange) => {
|
|
|
|
document.body.innerHTML = '';
|
|
|
|
const wrapper = mount(
|
|
|
|
{
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Header
|
2021-09-25 08:51:32 +00:00
|
|
|
prefixCls="ant-picker-calendar"
|
|
|
|
onChange={onValueChange}
|
|
|
|
generateConfig={generateConfig}
|
2020-03-07 11:45:13 +00:00
|
|
|
value={value}
|
|
|
|
validRange={[start, end]}
|
|
|
|
locale={{ year: '年' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sync: false,
|
2020-07-25 07:46:49 +00:00
|
|
|
attachTo: 'body',
|
2020-03-07 11:45:13 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
await sleep(50);
|
2021-09-25 08:51:32 +00:00
|
|
|
openSelect(wrapper, '.ant-picker-calendar-year-select');
|
2020-03-07 11:45:13 +00:00
|
|
|
await sleep(50);
|
2021-09-25 08:51:32 +00:00
|
|
|
clickSelectItem(wrapper);
|
2020-03-07 11:45:13 +00:00
|
|
|
await sleep(50);
|
|
|
|
};
|
|
|
|
|
|
|
|
it('if value.month > end.month, set value.month to end.month', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const value = new dayjs('1990-01-03');
|
|
|
|
const start = new dayjs('2019-04-01');
|
|
|
|
const end = new dayjs('2019-11-01');
|
2020-03-07 11:45:13 +00:00
|
|
|
const onValueChange = jest.fn();
|
|
|
|
await createWrapper(start, end, value, onValueChange);
|
|
|
|
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('3'));
|
|
|
|
});
|
|
|
|
it('if value.month > end.month, set value.month to end.month1', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const value = new dayjs('1990-01-03');
|
|
|
|
const start = new dayjs('2019-04-01');
|
|
|
|
const end = new dayjs('2019-11-01');
|
2020-03-07 11:45:13 +00:00
|
|
|
const onValueChange = jest.fn();
|
|
|
|
await createWrapper(start, end, value, onValueChange);
|
|
|
|
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('3'));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('if start.month > value.month, set value.month to start.month ', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const value = new dayjs('1990-01-03');
|
|
|
|
const start = new dayjs('2019-11-01');
|
|
|
|
const end = new dayjs('2019-03-01');
|
2020-03-07 11:45:13 +00:00
|
|
|
const onValueChange = jest.fn();
|
|
|
|
await createWrapper(start, end, value, onValueChange);
|
|
|
|
expect(onValueChange).toHaveBeenCalledWith(value.year('2019').month('10'));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('onMonthChange should work correctly', async () => {
|
2021-09-25 08:51:32 +00:00
|
|
|
const start = new dayjs('2018-11-01');
|
|
|
|
const end = new dayjs('2019-03-01');
|
|
|
|
const value = new dayjs('2018-12-03');
|
2020-03-07 11:45:13 +00:00
|
|
|
const onValueChange = jest.fn();
|
|
|
|
const wrapper = mount(
|
|
|
|
{
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Header
|
2021-09-25 08:51:32 +00:00
|
|
|
prefixCls="ant-picker-calendar"
|
|
|
|
generateConfig={generateConfig}
|
|
|
|
onChange={onValueChange}
|
2020-03-07 11:45:13 +00:00
|
|
|
value={value}
|
|
|
|
validRange={[start, end]}
|
2021-09-25 08:51:32 +00:00
|
|
|
locale={{ year: '年', locale: 'zh_CN' }}
|
|
|
|
mode="month"
|
2020-03-07 11:45:13 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sync: false,
|
2020-07-25 07:46:49 +00:00
|
|
|
attachTo: 'body',
|
2020-03-07 11:45:13 +00:00
|
|
|
},
|
|
|
|
);
|
2021-09-25 08:51:32 +00:00
|
|
|
await sleep();
|
|
|
|
openSelect(wrapper, '.ant-picker-calendar-month-select');
|
|
|
|
await sleep();
|
|
|
|
clickSelectItem(wrapper);
|
2020-03-07 11:45:13 +00:00
|
|
|
expect(onValueChange).toHaveBeenCalledWith(value.month(10));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('onTypeChange should work correctly', () => {
|
|
|
|
const onTypeChange = jest.fn();
|
2021-09-25 08:51:32 +00:00
|
|
|
const value = new dayjs('2018-12-03');
|
2020-03-07 11:45:13 +00:00
|
|
|
const wrapper = mount({
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Header
|
2021-09-25 08:51:32 +00:00
|
|
|
prefixCls="ant-picker-calendar"
|
|
|
|
generateConfig={generateConfig}
|
|
|
|
onModeChange={onTypeChange}
|
|
|
|
locale={{ year: '年', month: '月', locale: 'zh_CN' }}
|
2020-03-07 11:45:13 +00:00
|
|
|
value={value}
|
|
|
|
type="date"
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
2021-09-25 08:51:32 +00:00
|
|
|
wrapper.findAll('input[type="radio"]')[1].trigger('change');
|
2020-03-07 11:45:13 +00:00
|
|
|
expect(onTypeChange).toHaveBeenCalledWith('year');
|
|
|
|
});
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|