Skip to content

Commit

Permalink
fix: fix breadcrumb separator (#25984)
Browse files Browse the repository at this point in the history
* fix: fix breadcrumb separator

* add test snapshot

* code lint
  • Loading branch information
afc163 committed Aug 3, 2020
2 parents 2a05d5a + 11bb2ff commit c4418d0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/breadcrumb/BreadcrumbItem.tsx
Expand Up @@ -17,7 +17,7 @@ interface BreadcrumbItemInterface extends React.FC<BreadcrumbItemProps> {
}
const BreadcrumbItem: BreadcrumbItemInterface = ({
prefixCls: customizePrefixCls,
separator,
separator = '/',
children,
overlay,
dropdownProps,
Expand Down
19 changes: 19 additions & 0 deletions components/breadcrumb/__tests__/Breadcrumb.test.js
Expand Up @@ -138,4 +138,23 @@ describe('Breadcrumb', () => {
);
expect(wrapper).toMatchSnapshot();
});

// https://github.com/ant-design/ant-design/issues/25975
it('should support Breadcrumb.Item default separator', () => {
const MockComponent = () => {
return (
<span>
<Breadcrumb.Item>Mock Node</Breadcrumb.Item>
</span>
);
};
const wrapper = render(
<Breadcrumb>
<Breadcrumb.Item>Location</Breadcrumb.Item>
<MockComponent />
<Breadcrumb.Item>Application Center</Breadcrumb.Item>
</Breadcrumb>,
);
expect(wrapper).toMatchSnapshot();
});
});
Expand Up @@ -185,6 +185,51 @@ exports[`Breadcrumb should render a menu 1`] = `
</div>
`;

exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = `
<div
class="ant-breadcrumb"
>
<span>
<span
class="ant-breadcrumb-link"
>
Location
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
<span>
<span>
<span
class="ant-breadcrumb-link"
>
Mock Node
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
</span>
<span>
<span
class="ant-breadcrumb-link"
>
Application Center
</span>
<span
class="ant-breadcrumb-separator"
>
/
</span>
</span>
</div>
`;

exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
<div
class="ant-breadcrumb"
Expand Down

0 comments on commit c4418d0

Please sign in to comment.