2018-03-12 20:51:04 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { mount } from 'enzyme';
|
2017-12-01 19:39:32 +08:00
|
|
|
import Search from '../Search';
|
2018-03-12 21:02:20 +08:00
|
|
|
import Button from '../../button';
|
2017-12-01 19:39:32 +08:00
|
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
|
|
|
|
|
|
describe('Input.Search', () => {
|
|
|
|
focusTest(Search);
|
2018-03-12 20:51:04 +08:00
|
|
|
|
|
|
|
it('should support custom button', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<Search enterButton={<button>ok</button>} />
|
|
|
|
);
|
2018-03-12 21:02:20 +08:00
|
|
|
expect(wrapper.render()).toMatchSnapshot();
|
2018-03-12 20:51:04 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should support custom Button', () => {
|
|
|
|
const wrapper = mount(
|
|
|
|
<Search enterButton={<Button>ok</Button>} />
|
|
|
|
);
|
2018-03-12 21:02:20 +08:00
|
|
|
expect(wrapper.render()).toMatchSnapshot();
|
2018-03-12 20:51:04 +08:00
|
|
|
});
|
2018-04-15 13:14:26 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
2017-12-01 19:39:32 +08:00
|
|
|
});
|