@@ -81,8 +81,6 @@ describe('Select.Basic', () => {
81
81
} ) ;
82
82
83
83
it ( 'renders data-attributes correctly' , ( ) => {
84
-
85
-
86
84
const { container } = render (
87
85
genSelect ( {
88
86
'data-test' : 'test-id' ,
@@ -1949,44 +1947,41 @@ describe('Select.Basic', () => {
1949
1947
'Communicated' ,
1950
1948
) ;
1951
1949
} ) ;
1952
- it ( 'filterSort should work with search value when grouping' , ( ) => {
1950
+ it ( 'filterSort should work with search value when grouping' , ( ) => {
1953
1951
const { container } = render (
1954
1952
< Select
1955
- open
1956
- showSearch
1957
- searchValue = "entry"
1958
- style = { { width : 100 } }
1959
- placeholder = "Search to Select"
1960
- optionFilterProp = "label"
1961
- filterSort = {
1962
- ( optionA , optionB , info ) => {
1963
- if ( ! info . searchValue ) return 0 ;
1964
- const labelA = ( optionA ?. label ?? '' ) . toLowerCase ( ) ;
1965
- const labelB = ( optionB ?. label ?? '' ) . toLowerCase ( ) ;
1966
- const matchA = labelA . startsWith ( info . searchValue ) ;
1967
- const matchB = labelB . startsWith ( info . searchValue ) ;
1968
- if ( matchA && ! matchB ) return - 1 ;
1969
- if ( ! matchA && matchB ) return 1 ;
1970
- return labelA . localeCompare ( labelB ) ;
1971
- } }
1972
- options = { [
1973
- {
1974
- value : 'group1' ,
1975
- label : 'group1' ,
1976
- options : [
1977
- { label : 'Entry1' , value : 'Entry1' } ,
1978
- { label : 'Entry2' , value : 'Entry2' } ,
1979
- { label : 'Entry3' , value : 'Entry3' } ,
1980
- { label : 'Entry' , value : 'Entry' } ,
1981
- ] ,
1982
- } ,
1983
- ] }
1953
+ open
1954
+ showSearch
1955
+ searchValue = "entry"
1956
+ style = { { width : 100 } }
1957
+ placeholder = "Search to Select"
1958
+ optionFilterProp = "label"
1959
+ filterSort = { ( optionA , optionB , info ) => {
1960
+ if ( ! info . searchValue ) return 0 ;
1961
+ const labelA = ( optionA ?. label ?? '' ) . toLowerCase ( ) ;
1962
+ const labelB = ( optionB ?. label ?? '' ) . toLowerCase ( ) ;
1963
+ const matchA = labelA . startsWith ( info . searchValue ) ;
1964
+ const matchB = labelB . startsWith ( info . searchValue ) ;
1965
+ if ( matchA && ! matchB ) return - 1 ;
1966
+ if ( ! matchA && matchB ) return 1 ;
1967
+ return labelA . localeCompare ( labelB ) ;
1968
+ } }
1969
+ options = { [
1970
+ {
1971
+ value : 'group1' ,
1972
+ label : 'group1' ,
1973
+ options : [
1974
+ { label : 'Entry1' , value : 'Entry1' } ,
1975
+ { label : 'Entry2' , value : 'Entry2' } ,
1976
+ { label : 'Entry3' , value : 'Entry3' } ,
1977
+ { label : 'Entry' , value : 'Entry' } ,
1978
+ ] ,
1979
+ } ,
1980
+ ] }
1984
1981
/> ,
1985
1982
) ;
1986
- expect ( container . querySelector ( '.rc-select-item-option-grouped' ) . textContent ) . toBe (
1987
- 'Entry' ,
1988
- ) ;
1989
- } )
1983
+ expect ( container . querySelector ( '.rc-select-item-option-grouped' ) . textContent ) . toBe ( 'Entry' ) ;
1984
+ } ) ;
1990
1985
it ( 'correctly handles the `tabIndex` prop' , ( ) => {
1991
1986
const { container } = render ( < Select tabIndex = { 0 } /> ) ;
1992
1987
expect ( container . querySelector ( '.rc-select' ) . getAttribute ( 'tabindex' ) ) . toBeFalsy ( ) ;
0 commit comments