Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ constructor(props) {
this.state.inputValue = this.getInputDOMNode().value = '';
}
props.onBlur(this.getVLForOnChange(value));
this.setOpenState(false);
}, 10);
}

Expand Down
15 changes: 15 additions & 0 deletions tests/Select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,21 @@ describe('Select', () => {
it('set className', () => {
expect(wrapper.find('.rc-select').node.className).not.toContain('-focus');
});

// Fix https://github.com/ant-design/ant-design/issues/6342
it('should be close when blur Select[showSearch=false]', () => {
wrapper = mount(
<Select showSearch={false}>
<Option value="1">1</Option>
<Option value="2">2</Option>
</Select>
);
wrapper.find('.rc-select').simulate('click');
expect(wrapper.state().open).toBe(true);
wrapper.find('.rc-select').simulate('blur');
jest.runAllTimers();
expect(wrapper.state().open).toBe(false);
});
});

describe('unmount', () => {
Expand Down