File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
packages/ui/src/fields/Select
test/fields/collections/Select Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -112,10 +112,10 @@ const SelectFieldComponent: SelectFieldClientComponent = (props) => {
112
112
Error = { Error }
113
113
filterOption = {
114
114
selectFilterOptions
115
- ? ( { value } ) =>
115
+ ? ( { label , value } , search ) =>
116
116
selectFilterOptions ?. some (
117
117
( option ) => ( typeof option === 'string' ? option : option . value ) === value ,
118
- )
118
+ ) && label . toLowerCase ( ) . includes ( search . toLowerCase ( ) )
119
119
: undefined
120
120
}
121
121
hasMany = { hasMany }
Original file line number Diff line number Diff line change @@ -110,4 +110,16 @@ describe('Select', () => {
110
110
await field . click ( { delay : 100 } )
111
111
await expect ( options . locator ( 'text=One' ) ) . toBeHidden ( )
112
112
} )
113
+
114
+ test ( 'should retain search when reducing options' , async ( ) => {
115
+ await page . goto ( url . create )
116
+ const field = page . locator ( '#field-selectWithFilteredOptions' )
117
+ await field . click ( { delay : 100 } )
118
+ const options = page . locator ( '.rs__option' )
119
+ await expect ( options . locator ( 'text=One' ) ) . toBeVisible ( )
120
+ await expect ( options . locator ( 'text=Two' ) ) . toBeVisible ( )
121
+ await field . locator ( 'input' ) . fill ( 'On' )
122
+ await expect ( options . locator ( 'text=One' ) ) . toBeVisible ( )
123
+ await expect ( options . locator ( 'text=Two' ) ) . toBeHidden ( )
124
+ } )
113
125
} )
You can’t perform that action at this time.
0 commit comments