File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -176,11 +176,13 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
176
176
}
177
177
178
178
// >>>>> Title
179
- const title = getTitleFromCellRenderChildren ( {
180
- rowType,
181
- ellipsis,
182
- children : childNode ,
183
- } ) ;
179
+ const title =
180
+ additionalProps . title ??
181
+ getTitleFromCellRenderChildren ( {
182
+ rowType,
183
+ ellipsis,
184
+ children : childNode ,
185
+ } ) ;
184
186
185
187
// >>>>> ClassName
186
188
const mergedClassName = classNames (
Original file line number Diff line number Diff line change @@ -101,4 +101,25 @@ describe('Table.Cell', () => {
101
101
wrapper . find ( 'button' ) . simulate ( 'click' ) ;
102
102
expect ( wrapper . find ( '.rc-table-tbody .rc-table-cell' ) . text ( ) ) . toEqual ( '2' ) ;
103
103
} ) ;
104
+
105
+ it ( 'onHeaderCell' , ( ) => {
106
+ const wrapper = mount (
107
+ < Table
108
+ columns = { [
109
+ {
110
+ title : (
111
+ < div >
112
+ < p > NotYet</ p >
113
+ </ div >
114
+ ) ,
115
+ onHeaderCell : ( ) => ( {
116
+ title : 'Bamboo' ,
117
+ } ) ,
118
+ } ,
119
+ ] }
120
+ /> ,
121
+ ) ;
122
+
123
+ expect ( wrapper . find ( 'thead th' ) . prop ( 'title' ) ) . toEqual ( 'Bamboo' ) ;
124
+ } ) ;
104
125
} ) ;
You can’t perform that action at this time.
0 commit comments