ant-design/components/form/__tests__/label.test.js
Hans Chan 3d58a3f608 docs: add property colon for Form.Item (#4505)
* docs: 修改错别字

* docs: add property `colon` for Form.Item

`colon` is available since 2.0.0-beta.1
2017-01-13 19:03:59 +08:00

39 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { mount } from 'enzyme';
import Form from '..';
describe('Checkbox', () => {
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('');
});
});