diff --git a/components/breadcrumb/__tests__/__snapshots__/router.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/router.test.js.snap
new file mode 100644
index 0000000000..feaed14345
--- /dev/null
+++ b/components/breadcrumb/__tests__/__snapshots__/router.test.js.snap
@@ -0,0 +1,170 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`react router react router 3 1`] = `
+
+
+
+`;
diff --git a/components/breadcrumb/__tests__/router.test.js b/components/breadcrumb/__tests__/router.test.js
index 907670e548..b745f5c125 100644
--- a/components/breadcrumb/__tests__/router.test.js
+++ b/components/breadcrumb/__tests__/router.test.js
@@ -1,15 +1,15 @@
import React from 'react';
import { Route, Switch, Link, withRouter, MemoryRouter } from 'react-router-dom';
-import { Breadcrumb } from 'antd';
+import Breadcrumb from '../index';
import { mount } from 'enzyme';
const Apps = () => (
-
+
-
- Application1:Detail
+ Application1:Detail
-
- Application2:Detail
+ Application2:Detail
);
@@ -36,18 +36,18 @@ const Home = withRouter((props) => {
);
});
const breadcrumbItems = [(
-
- Home
+
+ Home
)].concat(extraBreadcrumbItems);
return (
-
-
+
+
-
+
Home Page} />
@@ -78,4 +78,73 @@ describe('react router', () => {
expect(wrapper.find('BreadcrumbItem').length).toBe(2);
expect(wrapper.find('BreadcrumbItem .ant-breadcrumb-link').at(1).text()).toBe('Application List');
});
+
+ it('react router 3', () => {
+ const routes = [{
+ name: 'home',
+ breadcrumbName: 'Home',
+ path: '/',
+ childRoutes: [
+ {
+ name: 'apps',
+ breadcrumbName: 'Application List',
+ path: 'apps',
+ childRoutes: [
+ {
+ name: 'app',
+ breadcrumbName: 'Application:id',
+ path: ':id',
+ childRoutes: [
+ {
+ name: 'detail',
+ breadcrumbName: 'Detail',
+ path: 'detail',
+ },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'apps',
+ breadcrumbName: 'Application List',
+ path: 'apps',
+ childRoutes: [
+ {
+ name: 'app',
+ breadcrumbName: 'Application:id',
+ path: ':id',
+ childRoutes: [
+ {
+ name: 'detail',
+ breadcrumbName: 'Detail',
+ path: 'detail',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'app',
+ breadcrumbName: 'Application:id',
+ path: ':id',
+ childRoutes: [
+ {
+ name: 'detail',
+ breadcrumbName: 'Detail',
+ path: 'detail',
+ },
+ ],
+ },
+ {
+ name: 'detail',
+ breadcrumbName: 'Detail',
+ path: 'detail',
+ }];
+ const wrapper = mount(
+
+ );
+ expect(wrapper).toMatchSnapshot();
+ });
});