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) => {
112112 Error = { Error }
113113 filterOption = {
114114 selectFilterOptions
115- ? ( { value } ) =>
115+ ? ( { label , value } , search ) =>
116116 selectFilterOptions ?. some (
117117 ( option ) => ( typeof option === 'string' ? option : option . value ) === value ,
118- )
118+ ) && label . toLowerCase ( ) . includes ( search . toLowerCase ( ) )
119119 : undefined
120120 }
121121 hasMany = { hasMany }
Original file line number Diff line number Diff line change @@ -110,4 +110,16 @@ describe('Select', () => {
110110 await field . click ( { delay : 100 } )
111111 await expect ( options . locator ( 'text=One' ) ) . toBeHidden ( )
112112 } )
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+ } )
113125} )
You can’t perform that action at this time.
0 commit comments