@@ -268,7 +268,7 @@ describe('Select.Basic', () => {
268268 expect ( wrapper2 . find ( '.rc-select-clear-icon' ) . length ) . toBeFalsy ( ) ;
269269
270270 const wrapper3 = mount (
271- < Select allowClear = { { clearIcon : < div className = ' custom-clear-icon' > x</ div > } } value = "1" >
271+ < Select allowClear = { { clearIcon : < div className = " custom-clear-icon" > x</ div > } } value = "1" >
272272 < Option value = "1" > 1</ Option >
273273 < Option value = "2" > 2</ Option >
274274 </ Select > ,
@@ -277,17 +277,16 @@ describe('Select.Basic', () => {
277277 expect ( wrapper3 . find ( '.custom-clear-icon' ) . text ( ) ) . toBe ( 'x' ) ;
278278
279279 const wrapper4 = mount (
280- < Select allowClear = { { clearIcon : < div className = ' custom-clear-icon' > x</ div > } } >
280+ < Select allowClear = { { clearIcon : < div className = " custom-clear-icon" > x</ div > } } >
281281 < Option value = "1" > 1</ Option >
282282 < Option value = "2" > 2</ Option >
283283 </ Select > ,
284284 ) ;
285285 expect ( wrapper4 . find ( '.custom-clear-icon' ) . length ) . toBeFalsy ( ) ;
286286
287-
288287 resetWarned ( ) ;
289288 const wrapper5 = mount (
290- < Select allowClear clearIcon = { < div className = ' custom-clear-icon' > x</ div > } value = "1" >
289+ < Select allowClear clearIcon = { < div className = " custom-clear-icon" > x</ div > } value = "1" >
291290 < Option value = "1" > 1</ Option >
292291 < Option value = "2" > 2</ Option >
293292 </ Select > ,
@@ -296,7 +295,7 @@ describe('Select.Basic', () => {
296295 expect ( wrapper5 . find ( '.custom-clear-icon' ) . text ( ) ) . toBe ( 'x' ) ;
297296
298297 const wrapper6 = mount (
299- < Select allowClear clearIcon = { < div className = ' custom-clear-icon' > x</ div > } >
298+ < Select allowClear clearIcon = { < div className = " custom-clear-icon" > x</ div > } >
300299 < Option value = "1" > 1</ Option >
301300 < Option value = "2" > 2</ Option >
302301 </ Select > ,
@@ -1361,7 +1360,7 @@ describe('Select.Basic', () => {
13611360 beforeAll ( ( ) => {
13621361 domHook = spyElementPrototypes ( HTMLElement , {
13631362 getBoundingClientRect : ( ) => ( {
1364- width : 1000
1363+ width : 1000 ,
13651364 } ) ,
13661365 } ) ;
13671366 } ) ;
@@ -2095,4 +2094,24 @@ describe('Select.Basic', () => {
20952094 const { container } = testingRender ( < Select open direction = "rtl" options = { options } /> ) ;
20962095 expect ( container . querySelector ( '.rc-virtual-list-rtl' ) ) . toBeTruthy ( ) ;
20972096 } ) ;
2097+
2098+ it ( 'Should optionRender work' , ( ) => {
2099+ const options = [
2100+ { label : 'test1' , value : '1' } ,
2101+ { label : 'test2' , value : '2' } ,
2102+ ] ;
2103+
2104+ const { container } = testingRender (
2105+ < Select
2106+ open
2107+ options = { options }
2108+ optionRender = { ( option , { index} ) => {
2109+ return `${ option . label } - ${ index } ` ;
2110+ } }
2111+ /> ,
2112+ ) ;
2113+ expect ( container . querySelector ( '.rc-select-item-option-content' ) . innerHTML ) . toEqual (
2114+ 'test1 - 0' ,
2115+ ) ;
2116+ } ) ;
20982117} ) ;
0 commit comments