@@ -13,6 +13,7 @@ import type { ScrollConfig } from 'rc-virtual-list/lib/List';
13
13
import React from 'react' ;
14
14
import type { SelectProps } from '../src' ;
15
15
import Select , { OptGroup , Option , useBaseProps } from '../src' ;
16
+ import BaseSelect from '../src/BaseSelect' ;
16
17
import type { BaseSelectRef } from '../src/BaseSelect' ;
17
18
import allowClearTest from './shared/allowClearTest' ;
18
19
import blurTest from './shared/blurTest' ;
@@ -2464,4 +2465,46 @@ describe('Select.Basic', () => {
2464
2465
expect ( input ) . toHaveClass ( customClassNames . input ) ;
2465
2466
expect ( input ) . toHaveStyle ( customStyle . input ) ;
2466
2467
} ) ;
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
+ } ) ;
2467
2510
} ) ;
0 commit comments