From 4e264966977416c19d19643159541a6246439911 Mon Sep 17 00:00:00 2001 From: Amour1688 <31695475+Amour1688@users.noreply.github.com> Date: Sat, 28 Mar 2020 15:28:06 +0800 Subject: [PATCH] feat: avatar, breadcrumb and cascader use new icon (#1943) * feat: avatar, breadcrumb and cascader use new icon * feat: avatar icon string --> VNode | slot --- components/avatar/Avatar.jsx | 7 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +-- components/breadcrumb/BreadcrumbItem.jsx | 4 +- .../__snapshots__/Breadcrumb.test.js.snap | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 9 +-- .../__tests__/__snapshots__/demo.test.js.snap | 72 +++---------------- .../__snapshots__/index.test.js.snap | 36 ++++------ components/cascader/index.jsx | 15 ++-- types/avatar.d.ts | 4 +- 9 files changed, 47 insertions(+), 114 deletions(-) diff --git a/components/avatar/Avatar.jsx b/components/avatar/Avatar.jsx index 71d76979d..d64cc3788 100644 --- a/components/avatar/Avatar.jsx +++ b/components/avatar/Avatar.jsx @@ -1,5 +1,4 @@ import { ConfigConsumerProps } from '../config-provider'; -import Icon from '../icon'; import { getListeners, getComponentFromProp } from '../_util/props-util'; import PropTypes from '../_util/vue-types'; @@ -121,11 +120,7 @@ export default { if (src && isImgExist) { children = {alt}; } else if (icon) { - if (typeof icon === 'string') { - children = ; - } else { - children = icon; - } + children = icon; } else { const childrenNode = this.$refs.avatarChildren; if (childrenNode || scale !== 1) { diff --git a/components/avatar/__tests__/__snapshots__/demo.test.js.snap b/components/avatar/__tests__/__snapshots__/demo.test.js.snap index cb58d6b15..00727e923 100644 --- a/components/avatar/__tests__/__snapshots__/demo.test.js.snap +++ b/components/avatar/__tests__/__snapshots__/demo.test.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./antdv-demo/docs/avatar/demo/badge.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

`; +exports[`renders ./antdv-demo/docs/avatar/demo/badge.md correctly 1`] = `

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

`; exports[`renders ./antdv-demo/docs/avatar/demo/basic.md correctly 1`] = `
-

-
+

+
`; exports[`renders ./antdv-demo/docs/avatar/demo/dynamic.md correctly 1`] = `
U
`; -exports[`renders ./antdv-demo/docs/avatar/demo/type.md correctly 1`] = `
U USER U
`; +exports[`renders ./antdv-demo/docs/avatar/demo/type.md correctly 1`] = `
U USER U
`; diff --git a/components/breadcrumb/BreadcrumbItem.jsx b/components/breadcrumb/BreadcrumbItem.jsx index bfebfb63c..e8f91fa19 100644 --- a/components/breadcrumb/BreadcrumbItem.jsx +++ b/components/breadcrumb/BreadcrumbItem.jsx @@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types'; import { hasProp, getComponentFromProp } from '../_util/props-util'; import { ConfigConsumerProps } from '../config-provider'; import DropDown from '../dropdown/dropdown'; -import Icon from '../icon'; +import DownOutlined from '@ant-design/icons-vue/DownOutlined'; export default { name: 'ABreadcrumbItem', @@ -28,7 +28,7 @@ export default { {breadcrumbItem} - + ); diff --git a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap index bf76d0d88..2a6d74522 100644 --- a/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap +++ b/components/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.js.snap @@ -7,10 +7,6 @@ exports[`Breadcrumb should not display Breadcrumb Item when its children is fals xxx/yyy/ `; -exports[`Breadcrumb should render a menu 1`] = ` -
home/first/second/
-`; +exports[`Breadcrumb should render a menu 1`] = `
home/first/second/
`; exports[`Breadcrumb should support custom attribute 1`] = `
xxx/yyy/
`; diff --git a/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap b/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap index 80fe80e24..9c18decc8 100644 --- a/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap +++ b/components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap @@ -2,11 +2,7 @@ exports[`renders ./antdv-demo/docs/breadcrumb/demo/basic.md correctly 1`] = `
Home/Application Center/Application List/An Application/
`; -exports[`renders ./antdv-demo/docs/breadcrumb/demo/overlay.md correctly 1`] = ` -
Ant Design Vue/Component/General /Button/
-`; +exports[`renders ./antdv-demo/docs/breadcrumb/demo/overlay.md correctly 1`] = `
Ant Design Vue/Component/General /Button/
`; exports[`renders ./antdv-demo/docs/breadcrumb/demo/separator.md correctly 1`] = `
@@ -18,7 +14,8 @@ exports[`renders ./antdv-demo/docs/breadcrumb/demo/separator.md correctly 1`] = exports[`renders ./antdv-demo/docs/breadcrumb/demo/separator-indepent.md correctly 1`] = `
Location:Application Center/Application List/An Application
`; exports[`renders ./antdv-demo/docs/breadcrumb/demo/withIcon.md correctly 1`] = ` -
/ Application List/ +
+ Application List/ Application /
`; diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index 237c562f2..d51abe535 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -1,16 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./antdv-demo/docs/cascader/demo/basic.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/basic.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/change-on-select.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/change-on-select.md correctly 1`] = ``; exports[`renders ./antdv-demo/docs/cascader/demo/custom-render.md correctly 1`] = ` @@ -19,11 +11,7 @@ exports[`renders ./antdv-demo/docs/cascader/demo/custom-render.md correctly 1`] Hangzhou / West Lake (752100) - +
`; exports[`renders ./antdv-demo/docs/cascader/demo/custom-trigger.md correctly 1`] = ` @@ -32,56 +20,18 @@ exports[`renders ./antdv-demo/docs/cascader/demo/custom-trigger.md correctly 1`] Change city `; -exports[`renders ./antdv-demo/docs/cascader/demo/default-value.md correctly 1`] = ` -Zhejiang / Hangzhou / West Lake -`; +exports[`renders ./antdv-demo/docs/cascader/demo/default-value.md correctly 1`] = `Zhejiang / Hangzhou / West Lake`; -exports[`renders ./antdv-demo/docs/cascader/demo/disabled-option.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/disabled-option.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/fields-name.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/fields-name.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/hover.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/hover.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/lazy.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/lazy.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/search.md correctly 1`] = ` - -`; +exports[`renders ./antdv-demo/docs/cascader/demo/search.md correctly 1`] = ``; -exports[`renders ./antdv-demo/docs/cascader/demo/size.md correctly 1`] = ` -






-`; +exports[`renders ./antdv-demo/docs/cascader/demo/size.md correctly 1`] = `






`; -exports[`renders ./antdv-demo/docs/cascader/demo/suffix.md correctly 1`] = ` -
ab
-`; +exports[`renders ./antdv-demo/docs/cascader/demo/suffix.md correctly 1`] = `
ab
`; diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index 02350581d..fbf762fa1 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -5,11 +5,11 @@ exports[`Cascader can be selected 1`] = `
    - - + +
    - +
@@ -21,11 +21,11 @@ exports[`Cascader can be selected 2`] = `
    - - + +
    - +
    @@ -40,11 +40,11 @@ exports[`Cascader can be selected 3`] = `