/* eslint-disable react/prefer-stateless-function */ import React from 'react'; import { mount } from 'enzyme'; import Form from '..'; describe('Form', () => { it('hideRequiredMark', () => { const wrapper = mount(
); expect(wrapper.find('form').hasClass('ant-form-hide-required-mark')).toBe(true); }); describe('wrappedComponentRef', () => { it('warns on functional component', () => { if (process.env.REACT === '15') { return; } const spy = jest.spyOn(console, 'error').mockImplementation(() => {}); const TestForm = () => ; const Wrapped = Form.create()(TestForm); mount( {}} />); expect(spy).toHaveBeenCalled(); spy.mockReset(); spy.mockRestore(); }); it('get component ref', () => { class TestForm extends React.Component { // eslint-disable-line render() { return ; } } const Wrapped = Form.create()(TestForm); let form; mount( { form = node; }} />, ); expect(form).toBeInstanceOf(TestForm); }); }); });