Skip to content

Commit

Permalink
fix: if breadcrumbRender return false, breadcrumb will hidden (#32738)
Browse files Browse the repository at this point in the history
* fix: if breadcrumbRender return false, breadcrumb will hidden

* add testd
  • Loading branch information
chenshuai2144 authored Nov 10, 2021
1 parent 5f642cb commit 01887b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions components/page-header/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ describe('PageHeader', () => {
expect(wrapper.find('.ant-page-header-back')).toHaveLength(0);
});

it('pageHeader support breadcrumbRender return false', () => {
const wrapper = mount(<PageHeader title="Page Title" breadcrumbRender={() => false} />);
expect(wrapper.find('.ant-page-header-back')).toHaveLength(0);
});

it('pageHeader do not has title', () => {
const routes = [
{
Expand Down
2 changes: 1 addition & 1 deletion components/page-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const PageHeader: React.FC<PageHeaderProps> = props => {
const isBreadcrumbComponent = breadcrumb && 'props' in breadcrumb;
// support breadcrumbRender function
const breadcrumbRenderDomFromProps =
breadcrumbRender?.(props, defaultBreadcrumbDom) || defaultBreadcrumbDom;
breadcrumbRender?.(props, defaultBreadcrumbDom) ?? defaultBreadcrumbDom;

const breadcrumbDom = isBreadcrumbComponent ? breadcrumb : breadcrumbRenderDomFromProps;

Expand Down

0 comments on commit 01887b4

Please sign in to comment.