mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 15:19:58 +08:00
b52053051c
* Input Search should disable enter button when disabled prop is true, close #10040
* test: Add test case for commit bd21722
31 lines
866 B
JavaScript
31 lines
866 B
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import Search from '../Search';
|
|
import Button from '../../button';
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
|
|
describe('Input.Search', () => {
|
|
focusTest(Search);
|
|
|
|
it('should support custom button', () => {
|
|
const wrapper = mount(
|
|
<Search enterButton={<button>ok</button>} />
|
|
);
|
|
expect(wrapper.render()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should support custom Button', () => {
|
|
const wrapper = mount(
|
|
<Search enterButton={<Button>ok</Button>} />
|
|
);
|
|
expect(wrapper.render()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should disable enter button when disabled prop is true', () => {
|
|
const wrapper = mount(
|
|
<Search placeholder="input search text" enterButton disabled />
|
|
);
|
|
expect(wrapper.find('.ant-btn-primary[disabled]')).toHaveLength(1);
|
|
});
|
|
});
|