2017-01-09 11:03:35 +08:00
|
|
|
|
import React from 'react';
|
|
|
|
|
import { mount } from 'enzyme';
|
|
|
|
|
import Form from '..';
|
|
|
|
|
|
2017-01-15 14:37:22 +08:00
|
|
|
|
describe('Form', () => {
|
2017-01-09 11:03:35 +08:00
|
|
|
|
it('should remove duplicated user input colon', () => {
|
|
|
|
|
const wrapper = mount(
|
|
|
|
|
<Form>
|
|
|
|
|
<Form.Item label="label:">input</Form.Item>
|
|
|
|
|
<Form.Item label="label:">input</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
);
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(0).text()).not.toContain(':');
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(1).text()).not.toContain(':');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not remove duplicated user input colon when props colon is false', () => {
|
|
|
|
|
const wrapper = mount(
|
|
|
|
|
<Form>
|
|
|
|
|
<Form.Item label="label:" colon={false}>input</Form.Item>
|
|
|
|
|
<Form.Item label="label:" colon={false}>input</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
);
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(0).text()).toContain(':');
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(1).text()).toContain(':');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should not remove duplicated user input colon when layout is vertical', () => {
|
|
|
|
|
const wrapper = mount(
|
|
|
|
|
<Form vertical>
|
|
|
|
|
<Form.Item label="label:">input</Form.Item>
|
|
|
|
|
<Form.Item label="label:">input</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
);
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(0).text()).toContain(':');
|
|
|
|
|
expect(wrapper.find('.ant-form-item-label label').at(1).text()).toContain(':');
|
|
|
|
|
});
|
|
|
|
|
});
|