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>) {
176176 }
177177
178178 // >>>>> 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+ } ) ;
184186
185187 // >>>>> ClassName
186188 const mergedClassName = classNames (
Original file line number Diff line number Diff line change @@ -101,4 +101,25 @@ describe('Table.Cell', () => {
101101 wrapper . find ( 'button' ) . simulate ( 'click' ) ;
102102 expect ( wrapper . find ( '.rc-table-tbody .rc-table-cell' ) . text ( ) ) . toEqual ( '2' ) ;
103103 } ) ;
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+ } ) ;
104125} ) ;
You can’t perform that action at this time.
0 commit comments