Skip to content

Commit

Permalink
test(Form.Item): add name as default test
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslahm committed Jun 17, 2021
1 parent 1f7b77d commit 6604491
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions components/form/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,23 @@ describe('Form', () => {
expect(wrapper.find('.ant-form-item-explain').first().text()).toEqual('Bamboo is good!');
});

it('`name` support template when label is not provided', async () => {
const wrapper = mount(
// eslint-disable-next-line no-template-curly-in-string
<Form validateMessages={{ required: '${label} is good!' }}>
<Form.Item name="Bamboo" rules={[{ required: true }]}>
<input />
</Form.Item>
</Form>,
);

wrapper.find('form').simulate('submit');
await sleep(100);
wrapper.update();
await sleep(100);
expect(wrapper.find('.ant-form-item-explain').first().text()).toEqual('Bamboo is good!');
});

it('`messageVariables` support validate', async () => {
const wrapper = mount(
// eslint-disable-next-line no-template-curly-in-string
Expand Down

0 comments on commit 6604491

Please sign in to comment.