Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/Cell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,13 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
}

// >>>>> Title
const title = getTitleFromCellRenderChildren({
rowType,
ellipsis,
children: childNode,
});
const title =
additionalProps.title ??
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个换行看着有点难受

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是 prettier 的风格,无须关心。

getTitleFromCellRenderChildren({
rowType,
ellipsis,
children: childNode,
});

// >>>>> ClassName
const mergedClassName = classNames(
Expand Down
21 changes: 21 additions & 0 deletions tests/Cell.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,25 @@ describe('Table.Cell', () => {
wrapper.find('button').simulate('click');
expect(wrapper.find('.rc-table-tbody .rc-table-cell').text()).toEqual('2');
});

it('onHeaderCell', () => {
const wrapper = mount(
<Table
columns={[
{
title: (
<div>
<p>NotYet</p>
</div>
),
onHeaderCell: () => ({
title: 'Bamboo',
}),
},
]}
/>,
);

expect(wrapper.find('thead th').prop('title')).toEqual('Bamboo');
});
});