File tree Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,14 @@ class Test extends React.Component {
66
66
id = "my-select"
67
67
value = { value }
68
68
placeholder = "placeholder"
69
- showSearch = { false }
69
+ showSearch
70
70
style = { { width : 500 } }
71
71
onBlur = { this . onBlur }
72
72
onFocus = { this . onFocus }
73
73
onSearch = { this . onSearch }
74
74
allowClear
75
75
optionFilterProp = "text"
76
76
onChange = { this . onChange }
77
- backfill
78
77
onPopupScroll = { ( ) => {
79
78
console . log ( 'Scroll!' ) ;
80
79
} }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const SingleSelector: React.FC<SelectorProps> = props => {
40
40
const [ inputChanged , setInputChanged ] = React . useState ( false ) ;
41
41
42
42
const combobox = mode === 'combobox' ;
43
- const inputEditable = combobox || ( showSearch && open ) ;
43
+ const inputEditable = combobox || showSearch ;
44
44
const item = values [ 0 ] ;
45
45
46
46
let inputValue : string = searchValue || '' ;
Original file line number Diff line number Diff line change @@ -243,6 +243,21 @@ describe('Select.Basic', () => {
243
243
expect ( findSelection ( wrapper ) . text ( ) ) . toBe ( '1' ) ;
244
244
} ) ;
245
245
246
+ it ( 'search input should be editable initially' , ( ) => {
247
+ const wrapper = mount (
248
+ < Select showSearch >
249
+ < Option value = "1" > One</ Option >
250
+ < Option value = "2" > Two</ Option >
251
+ </ Select > ,
252
+ ) ;
253
+ expect (
254
+ wrapper
255
+ . find ( 'input' )
256
+ . getDOMNode ( )
257
+ . getAttribute ( 'readonly' ) ,
258
+ ) . toBeFalsy ( ) ;
259
+ } ) ;
260
+
246
261
it ( 'filter options by "value" prop by default' , ( ) => {
247
262
const wrapper = mount (
248
263
< Select showSearch >
Original file line number Diff line number Diff line change @@ -254,11 +254,8 @@ exports[`Select.Basic render renders aria-attributes correctly 1`] = `
254
254
aria-owns = " undefined_list"
255
255
autocomplete = " off"
256
256
class = " antd-selection-search-input"
257
- readonly = " "
258
257
role = " combobox"
259
- style = " opacity:0"
260
258
type = " search"
261
- unselectable = " on"
262
259
value = " "
263
260
/>
264
261
</span >
@@ -312,11 +309,8 @@ exports[`Select.Basic render renders correctly 1`] = `
312
309
aria-owns = " undefined_list"
313
310
autocomplete = " off"
314
311
class = " antd-selection-search-input"
315
- readonly = " "
316
312
role = " combobox"
317
- style = " opacity:0"
318
313
type = " search"
319
- unselectable = " on"
320
314
value = " "
321
315
/>
322
316
</span >
@@ -372,11 +366,8 @@ exports[`Select.Basic render renders data-attributes correctly 1`] = `
372
366
aria-owns = " undefined_list"
373
367
autocomplete = " off"
374
368
class = " antd-selection-search-input"
375
- readonly = " "
376
369
role = " combobox"
377
- style = " opacity:0"
378
370
type = " search"
379
- unselectable = " on"
380
371
value = " "
381
372
/>
382
373
</span >
@@ -432,11 +423,8 @@ exports[`Select.Basic render renders disabled select correctly 1`] = `
432
423
autocomplete = " off"
433
424
class = " antd-selection-search-input"
434
425
disabled = " "
435
- readonly = " "
436
426
role = " combobox"
437
- style = " opacity:0"
438
427
type = " search"
439
- unselectable = " on"
440
428
value = " "
441
429
/>
442
430
</span >
@@ -663,11 +651,8 @@ exports[`Select.Basic render renders role prop correctly 1`] = `
663
651
aria-owns = " undefined_list"
664
652
autocomplete = " off"
665
653
class = " antd-selection-search-input"
666
- readonly = " "
667
654
role = " button"
668
- style = " opacity:0"
669
655
type = " search"
670
- unselectable = " on"
671
656
value = " "
672
657
/>
673
658
</span >
You can’t perform that action at this time.
0 commit comments