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 @@ -297,6 +297,7 @@ const Select = createClass({
onPlaceholderClick() {
if (this.getInputDOMNode()) {
this.getInputDOMNode().focus();
this.props.onFocus();
}
},

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

it('click placeholder should trigger onFocus', () => {
const handleFocus2 = jest.fn();
const wrapper2 = mount(
<Select onFocus={handleFocus2} placeholder="xxxx">
<Option value="1">1</Option>
<Option value="2">2</Option>
</Select>
);
wrapper2.find('.rc-select-selection__placeholder').simulate('click');
expect(handleFocus2).toBeCalled();
});
});

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