ant-design/components/date-picker/__tests__/QuarterPicker.test.js
二货机器人 2803ccf658
docs: Update DatePicker docs and add legacy notice (#25768)
* docs: Update DatePicker docs and add legacy notice

* clean up

* only warning for QuarterPicker

* update docs

* fix lint

* note to warning
2020-07-23 11:25:17 +08:00

23 lines
665 B
JavaScript

import React from 'react';
import { mount } from 'enzyme';
import DatePicker from '..';
import { resetWarned } from '../../_util/devWarning';
const { QuarterPicker } = DatePicker;
describe('QuarterPicker', () => {
it('should support style prop', () => {
resetWarned();
const warnSpy = jest.spyOn(console, 'error');
const wrapper = mount(<QuarterPicker style={{ width: 400 }} />);
expect(wrapper.render()).toMatchSnapshot();
expect(warnSpy).toHaveBeenCalledWith(
"Warning: [antd: QuarterPicker] DatePicker.QuarterPicker is legacy usage. Please use DatePicker[picker='quarter'] directly.",
);
warnSpy.mockRestore();
});
});