ant-design/components/input/__tests__/Search.test.js
诸岳 b52053051c Input.Search should disable enter button when disabled prop is true (#10051)
* Input Search should disable enter button when disabled prop is true, close #10040

* test: Add test case for commit bd21722
2018-04-15 13:14:26 +08:00

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);
});
});