File tree Expand file tree Collapse file tree 4 files changed +87
-2
lines changed Expand file tree Collapse file tree 4 files changed +87
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rc-cascader" ,
3
- "version" : " 0.17.4 " ,
3
+ "version" : " 0.17.5 " ,
4
4
"description" : " cascade select ui component for react" ,
5
5
"keywords" : [
6
6
" react" ,
Original file line number Diff line number Diff line change @@ -62,8 +62,9 @@ class Menus extends React.Component {
62
62
menuItemCls += ` ${ prefixCls } -menu-item-loading` ;
63
63
loadingIconNode = loadingIcon || null ;
64
64
}
65
+
65
66
let title = '' ;
66
- if ( option . title ) {
67
+ if ( ' title' in option ) {
67
68
title = option . title ;
68
69
} else if ( typeof option [ this . getFieldName ( 'label' ) ] === 'string' ) {
69
70
title = option [ this . getFieldName ( 'label' ) ] ;
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` Cascader should not show title when title is falsy 1` ] = `
4
+ <ul
5
+ className = " rc-cascader-menu"
6
+ key = " 0"
7
+ >
8
+ <li
9
+ className = " rc-cascader-menu-item"
10
+ key = " 1"
11
+ onClick = { [Function ]}
12
+ onDoubleClick = { [Function ]}
13
+ onMouseDown = { [Function ]}
14
+ role = " menuitem"
15
+ title = " "
16
+ >
17
+ 1
18
+ </li >
19
+ <li
20
+ className = " rc-cascader-menu-item"
21
+ key = " 2"
22
+ onClick = { [Function ]}
23
+ onDoubleClick = { [Function ]}
24
+ onMouseDown = { [Function ]}
25
+ role = " menuitem"
26
+ >
27
+ 2
28
+ </li >
29
+ <li
30
+ className = " rc-cascader-menu-item"
31
+ key = " 3"
32
+ onClick = { [Function ]}
33
+ onDoubleClick = { [Function ]}
34
+ onMouseDown = { [Function ]}
35
+ role = " menuitem"
36
+ title = " 3"
37
+ >
38
+ 3
39
+ </li >
40
+ <li
41
+ className = " rc-cascader-menu-item"
42
+ key = " 4"
43
+ onClick = { [Function ]}
44
+ onDoubleClick = { [Function ]}
45
+ onMouseDown = { [Function ]}
46
+ role = " menuitem"
47
+ title = " title"
48
+ >
49
+ 4
50
+ </li >
51
+ </ul >
52
+ ` ;
Original file line number Diff line number Diff line change @@ -562,4 +562,36 @@ describe('Cascader', () => {
562
562
expect ( onFocus ) . toHaveBeenCalledTimes ( 1 ) ;
563
563
expect ( onBlur ) . toHaveBeenCalledTimes ( 0 ) ;
564
564
} ) ;
565
+
566
+ // https://github.com/ant-design/ant-design/issues/18713
567
+ it ( 'should not show title when title is falsy' , ( ) => {
568
+ const options = [
569
+ {
570
+ value : '1' ,
571
+ label : '1' ,
572
+ title : '' ,
573
+ } ,
574
+ {
575
+ value : '2' ,
576
+ label : '2' ,
577
+ title : undefined ,
578
+ } ,
579
+ {
580
+ value : '3' ,
581
+ label : '3' ,
582
+ } ,
583
+ {
584
+ value : '4' ,
585
+ label : '4' ,
586
+ title : 'title' ,
587
+ } ,
588
+ ] ;
589
+ const wrapper = mount (
590
+ < Cascader options = { options } popupVisible >
591
+ < input readOnly />
592
+ </ Cascader > ,
593
+ ) ;
594
+ const menus = wrapper . find ( '.rc-cascader-menu' ) ;
595
+ expect ( menus ) . toMatchSnapshot ( ) ;
596
+ } ) ;
565
597
} ) ;
You can’t perform that action at this time.
0 commit comments