File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,11 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
377
377
/>
378
378
) ;
379
379
380
+ let suffixNode : React . ReactNode ;
381
+ if ( suffixIcon ) {
382
+ suffixNode = < span className = { `${ prefixCls } -suffix` } > { suffixIcon } </ span > ;
383
+ }
384
+
380
385
let clearNode : React . ReactNode ;
381
386
if ( allowClear && mergedValue && ! disabled ) {
382
387
clearNode = (
@@ -430,7 +435,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
430
435
placeholder = { placeholder }
431
436
ref = { inputRef }
432
437
/>
433
- { suffixIcon }
438
+ { suffixNode }
434
439
{ clearNode }
435
440
</ div >
436
441
</ PickerTrigger >
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` Basic icon 1` ] = `
4
+ <div
5
+ class = " rc-picker-input"
6
+ >
7
+ <input
8
+ readonly = " "
9
+ value = " 1990-09-03"
10
+ />
11
+ <span
12
+ class = " rc-picker-suffix"
13
+ >
14
+ <span
15
+ class = " suffix-icon"
16
+ />
17
+ </span >
18
+ <span
19
+ class = " rc-picker-clear"
20
+ >
21
+ <span
22
+ class = " suffix-icon"
23
+ />
24
+ </span >
25
+ </div >
26
+ ` ;
Original file line number Diff line number Diff line change @@ -431,4 +431,17 @@ describe('Basic', () => {
431
431
wrapper . find ( '.rc-picker-today-btn' ) . simulate ( 'click' ) ;
432
432
expect ( isSame ( onSelect . mock . calls [ 0 ] [ 0 ] , '1990-09-03' ) ) . toBeTruthy ( ) ;
433
433
} ) ;
434
+
435
+ it ( 'icon' , ( ) => {
436
+ const wrapper = mount (
437
+ < MomentPicker
438
+ defaultValue = { getMoment ( '1990-09-03' ) }
439
+ suffixIcon = { < span className = "suffix-icon" /> }
440
+ clearIcon = { < span className = "suffix-icon" /> }
441
+ allowClear
442
+ /> ,
443
+ ) ;
444
+
445
+ expect ( wrapper . find ( '.rc-picker-input' ) . render ( ) ) . toMatchSnapshot ( ) ;
446
+ } ) ;
434
447
} ) ;
You can’t perform that action at this time.
0 commit comments