Skip to content
Closed
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/Selector/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const Input: React.RefForwardingComponent<InputRef, InputProps> = (
disabled,
tabIndex,
autoComplete: autoComplete || 'off',
type: 'search',
autoFocus,
className: `${prefixCls}-selection-search-input`,
style: { ...style, opacity: editable ? null : 0 },
Expand Down
28 changes: 28 additions & 0 deletions tests/Input.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { mount } from 'enzyme';
import Input from '../src/Selector/Input';

describe('Selector.Input', () => {
it('renders correctly', () => {
const noop = () => null;
const wrapper = mount(
<Input
prefixCls=""
id="abc"
inputElement={<input />}
disabled={false}
autoFocus={false}
editable={false}
accessibilityIndex={1}
value="abc"
open={false}
tabIndex={-5}
onKeyDown={noop}
onMouseDown={noop}
onChange={noop}
/>,
);

expect(wrapper.find('input').prop('type')).toBe('search');
});
});
1 change: 1 addition & 0 deletions tests/__snapshots__/Combobox.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`Select.Combobox renders correctly 1`] = `
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
</span>
Expand Down
4 changes: 4 additions & 0 deletions tests/__snapshots__/Multiple.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ exports[`Select.Multiple render not display maxTagPlaceholder if maxTagCount not
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -116,6 +117,7 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -206,6 +208,7 @@ exports[`Select.Multiple render truncates tags by maxTagCount and show maxTagPla
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -285,6 +288,7 @@ exports[`Select.Multiple render truncates values by maxTagTextLength 1`] = `
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
Expand Down
11 changes: 11 additions & 0 deletions tests/__snapshots__/Select.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports[`Select.Basic does not filter when filterOption value is false 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -149,6 +150,7 @@ exports[`Select.Basic filterOption could be true as described in default value 1
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value="3"
/>
</span>
Expand Down Expand Up @@ -203,6 +205,7 @@ exports[`Select.Basic no search 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -252,6 +255,7 @@ exports[`Select.Basic render renders aria-attributes correctly 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -309,6 +313,7 @@ exports[`Select.Basic render renders correctly 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -368,6 +373,7 @@ exports[`Select.Basic render renders data-attributes correctly 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -427,6 +433,7 @@ exports[`Select.Basic render renders disabled select correctly 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -471,6 +478,7 @@ exports[`Select.Basic render renders dropdown correctly 1`] = `
autocomplete="off"
class="antd-selection-search-input"
role="combobox"
type="search"
value=""
/>
</span>
Expand Down Expand Up @@ -654,6 +662,7 @@ exports[`Select.Basic render renders role prop correctly 1`] = `
readonly=""
role="button"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -712,6 +721,7 @@ exports[`Select.Basic should contain falsy children 1`] = `
readonly=""
role="combobox"
style="opacity:0"
type="search"
unselectable="on"
value=""
/>
Expand Down Expand Up @@ -849,6 +859,7 @@ exports[`Select.Basic should render custom dropdown correctly 1`] = `
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
Expand Down
5 changes: 5 additions & 0 deletions tests/__snapshots__/Tags.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ exports[`Select.Tags OptGroup renders correctly 1`] = `
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
Expand Down Expand Up @@ -224,6 +225,7 @@ exports[`Select.Tags render not display maxTagPlaceholder if maxTagCount not rea
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
Expand Down Expand Up @@ -314,6 +316,7 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
Expand Down Expand Up @@ -401,6 +404,7 @@ exports[`Select.Tags render truncates tags by maxTagCount and show maxTagPlaceho
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
Expand Down Expand Up @@ -477,6 +481,7 @@ exports[`Select.Tags render truncates values by maxTagTextLength 1`] = `
class="rc-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
role="combobox"
type="search"
value=""
/>
<span
Expand Down