From e6dd15f01f9d5da0a849a6543d7a34f64736382c Mon Sep 17 00:00:00 2001 From: flyerH Date: Mon, 3 Aug 2020 17:22:51 +0800 Subject: [PATCH 1/3] fix: fix breadcrumb separator --- components/breadcrumb/BreadcrumbItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index 9274a15842..7e2201e68f 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -17,7 +17,7 @@ interface BreadcrumbItemInterface extends React.FC { } const BreadcrumbItem: BreadcrumbItemInterface = ({ prefixCls: customizePrefixCls, - separator, + separator = '/', children, overlay, dropdownProps, From 3950dce5e37ca5caf2b91ec3140583077a4412ca Mon Sep 17 00:00:00 2001 From: flyerH Date: Mon, 3 Aug 2020 21:34:29 +0800 Subject: [PATCH 2/3] add test snapshot --- .../breadcrumb/__tests__/Breadcrumb.test.js | 19 ++++++++ .../__snapshots__/Breadcrumb.test.js.snap | 45 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.js b/components/breadcrumb/__tests__/Breadcrumb.test.js index 3cb4cad451..32fe92d43a 100644 --- a/components/breadcrumb/__tests__/Breadcrumb.test.js +++ b/components/breadcrumb/__tests__/Breadcrumb.test.js @@ -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 ( + + Mock Node + + ); + }; + const wrapper = render( + + Location + + Application Center + + ); + expect(wrapper).toMatchSnapshot(); + }); }); diff --git a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap index 6e4412319d..2befd1bb32 100644 --- a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap +++ b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap @@ -185,6 +185,51 @@ exports[`Breadcrumb should render a menu 1`] = ` `; +exports[`Breadcrumb should support Breadcrumb.Item default separator 1`] = ` +
+ + + Location + + + / + + + + + + Mock Node + + + / + + + + + + Application Center + + + / + + +
+`; + exports[`Breadcrumb should support React.Fragment and falsy children 1`] = `
Date: Mon, 3 Aug 2020 21:53:13 +0800 Subject: [PATCH 3/3] code lint --- components/breadcrumb/__tests__/Breadcrumb.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.js b/components/breadcrumb/__tests__/Breadcrumb.test.js index 32fe92d43a..1878b497d5 100644 --- a/components/breadcrumb/__tests__/Breadcrumb.test.js +++ b/components/breadcrumb/__tests__/Breadcrumb.test.js @@ -153,7 +153,7 @@ describe('Breadcrumb', () => { Location Application Center - + , ); expect(wrapper).toMatchSnapshot(); });