@@ -13,6 +13,7 @@ import type { ScrollConfig } from 'rc-virtual-list/lib/List';
1313import React from 'react' ;
1414import type { SelectProps } from '../src' ;
1515import Select , { OptGroup , Option , useBaseProps } from '../src' ;
16+ import BaseSelect from '../src/BaseSelect' ;
1617import type { BaseSelectRef } from '../src/BaseSelect' ;
1718import allowClearTest from './shared/allowClearTest' ;
1819import blurTest from './shared/blurTest' ;
@@ -2464,4 +2465,46 @@ describe('Select.Basic', () => {
24642465 expect ( input ) . toHaveClass ( customClassNames . input ) ;
24652466 expect ( input ) . toHaveStyle ( customStyle . input ) ;
24662467 } ) ;
2468+ it ( 'support classnames and styles for baseSelect' , ( ) => {
2469+ const customClassNames = {
2470+ prefix : 'cutsom-prefix' ,
2471+ suffix : 'custom-suffix' ,
2472+ list : 'custom-list' ,
2473+ listItem : 'custom-item' ,
2474+ input : 'custom-input' ,
2475+ } ;
2476+ const customStyle = {
2477+ prefix : { color : 'red' } ,
2478+ suffix : { color : 'green' } ,
2479+ list : { color : 'yellow' } ,
2480+ listItem : { color : 'blue' } ,
2481+ input : { color : 'black' } ,
2482+ } ;
2483+ const { container } = render (
2484+ < BaseSelect
2485+ displayValues = { [ ] }
2486+ prefixCls = "rc-select"
2487+ id = "base-select"
2488+ open
2489+ classNames = { customClassNames }
2490+ styles = { customStyle }
2491+ suffixIcon = { < div > arrow</ div > }
2492+ prefix = "Foobar"
2493+ onDisplayValuesChange = { ( ) => { } }
2494+ searchValue = ""
2495+ onSearch = { ( ) => { } }
2496+ OptionList = { ( ) => < div > Option List</ div > }
2497+ emptyOptions = { false }
2498+ /> ,
2499+ ) ;
2500+ const prefix = container . querySelector ( '.rc-select-prefix' ) ;
2501+ const suffix = container . querySelector ( '.rc-select-arrow' ) ;
2502+ const input = container . querySelector ( '.rc-select-selection-search-input' ) ;
2503+ expect ( prefix ) . toHaveClass ( customClassNames . prefix ) ;
2504+ expect ( prefix ) . toHaveStyle ( customStyle . prefix ) ;
2505+ expect ( suffix ) . toHaveClass ( customClassNames . suffix ) ;
2506+ expect ( suffix ) . toHaveStyle ( customStyle . suffix ) ;
2507+ expect ( input ) . toHaveClass ( customClassNames . input ) ;
2508+ expect ( input ) . toHaveStyle ( customStyle . input ) ;
2509+ } ) ;
24672510} ) ;
0 commit comments