From 4e0d5ce4b7d6bf9b94a345fd51c4417e507a1be3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 11 Dec 2018 11:40:27 +0800 Subject: [PATCH] feat: update select --- components/_util/vnode.js | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 12 +- .../__tests__/__snapshots__/demo.test.js.snap | 20 +- .../__snapshots__/index.test.js.snap | 4 +- .../date-picker/__tests__/DatePicker.test.js | 15 +- .../__tests__/__snapshots__/demo.test.js.snap | 10 +- .../__tests__/__snapshots__/demo.test.js.snap | 20 +- .../__tests__/__snapshots__/demo.test.js.snap | 10 +- .../__snapshots__/index.test.js.snap | 296 +++++++++--------- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +- .../__tests__/__snapshots__/demo.test.js.snap | 49 ++- components/select/__tests__/index.test.js | 52 +++ components/select/demo/index.vue | 2 + components/select/demo/suffix.md | 38 +++ components/select/index.en-US.md | 7 +- components/select/index.jsx | 46 ++- components/select/index.zh-CN.md | 9 +- components/vc-select/SelectTrigger.jsx | 4 +- 19 files changed, 376 insertions(+), 230 deletions(-) create mode 100644 components/select/demo/suffix.md diff --git a/components/_util/vnode.js b/components/_util/vnode.js index 06b6235a1..7d5e01603 100644 --- a/components/_util/vnode.js +++ b/components/_util/vnode.js @@ -51,7 +51,7 @@ export function cloneVNodes (vnodes, deep) { return res } -export function cloneElement (n, nodeProps, deep) { +export function cloneElement (n, nodeProps = {}, deep) { let ele = n if (Array.isArray(n)) { ele = filterEmpty(n)[0] diff --git a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap index cd5e2ae20..dc5a08f8e 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap @@ -10,7 +10,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
 
- + `; @@ -26,7 +26,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
 
- + @@ -41,7 +41,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
 
- + `; @@ -56,7 +56,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
 
- + `; @@ -71,7 +71,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
 
- + `; @@ -87,7 +87,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
 
- + diff --git a/components/calendar/__tests__/__snapshots__/demo.test.js.snap b/components/calendar/__tests__/__snapshots__/demo.test.js.snap index b49312553..00db10164 100644 --- a/components/calendar/__tests__/__snapshots__/demo.test.js.snap +++ b/components/calendar/__tests__/__snapshots__/demo.test.js.snap @@ -7,14 +7,14 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
2016
-
+
Nov
-
+
@@ -313,14 +313,14 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
2016
-
+
Nov
-
+
@@ -619,14 +619,14 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
2016
-
+
Nov
-
+
@@ -1032,14 +1032,14 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
2017
-
+
Jan
-
+
@@ -1336,14 +1336,14 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
2017
-
+
Jan
-
+
diff --git a/components/calendar/__tests__/__snapshots__/index.test.js.snap b/components/calendar/__tests__/__snapshots__/index.test.js.snap index 7d8d9b783..6f1ea3eb1 100644 --- a/components/calendar/__tests__/__snapshots__/index.test.js.snap +++ b/components/calendar/__tests__/__snapshots__/index.test.js.snap @@ -7,14 +7,14 @@ exports[`Calendar Calendar should support locale 1`] = `
2018年
-
+
Oct
-
+
diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js index a9f10a445..6eed25bf0 100644 --- a/components/date-picker/__tests__/DatePicker.test.js +++ b/components/date-picker/__tests__/DatePicker.test.js @@ -146,28 +146,25 @@ describe('DatePicker', () => { }, { sync: false, attachToDocument: true }) await asyncExpect(() => { openPanel(wrapper) - }) + }, 0) await asyncExpect(() => { nextYear() - }, 0) + }, 1000) await asyncExpect(() => { expect(handleChange).not.toBeCalled() - }) + }, 0) await asyncExpect(() => { nextMonth() - }) + }, 0) await asyncExpect(() => { expect(handleChange).not.toBeCalled() }) await asyncExpect(() => { selectDateFromBody(moment('2017-12-22')) - }) + }, 1000) await asyncExpect(() => { expect(handleChange).toBeCalled() - }) - await asyncExpect(() => { - - }) + }, 0) }) it('clear input', async () => { diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index f66e09653..2812bb1c3 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -129,7 +129,7 @@ exports[`renders ./components/form/demo/coordinated.vue correctly 1`] = `
-
Select a option and change input text above
+
Select a option and change input text above
@@ -383,7 +383,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
+86
+
+86
@@ -395,7 +395,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
@@ -506,7 +506,7 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
Please select a country
+
Please select a country
@@ -674,7 +674,7 @@ exports[`renders ./components/form/demo/validate-static.vue correctly 1`] = `
-
Option 1
+
Option 1
diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 53747aedf..52f43b234 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -3,8 +3,8 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
Http://.com
-
Http://
-
.com
+
Http://
+
.com
@@ -18,19 +18,19 @@ exports[`renders ./components/input/demo/autosize-textarea.md correctly 1`] = ` exports[`renders ./components/input/demo/basic.md correctly 1`] = ``; exports[`renders ./components/input/demo/group.md correctly 1`] = ` -


Zhejiang
-

Option1
-


Option1-1
+


Zhejiang
+

Option1
+


Option1-1
Option2-2
-
+
-
Between
-

Sign Up
+
Between
+

Sign Up
-

Home
+
Home
diff --git a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap index 3dd7d6844..83ce94898 100644 --- a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap @@ -24,7 +24,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
10 / page
-
+
@@ -37,7 +37,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = ` -
+
~
2016
-
+
Nov
-
+
@@ -400,7 +400,7 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
10 / page
-
+
diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index 3cd22a508..8e9d24b2c 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -553,7 +553,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
10 / الصفحة
-
+
@@ -564,7 +564,7 @@ exports[`Locale Provider should display the text as ar 1`] = ` -
+
~
2017
-
+
سبتمبر
-
+
@@ -930,7 +930,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
10 / страница
-
+
@@ -941,7 +941,7 @@ exports[`Locale Provider should display the text as bg 1`] = ` - +
~
2017
-
+
сеп
-
+
@@ -1307,7 +1307,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
10 / pàgina
-
+
@@ -1318,7 +1318,7 @@ exports[`Locale Provider should display the text as ca 1`] = ` - +
~
2017
-
+
set.
-
+
@@ -1684,7 +1684,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
10 / strana
-
+
@@ -1695,7 +1695,7 @@ exports[`Locale Provider should display the text as cs 1`] = ` - +
~
2017
-
+
zář
-
+
@@ -2061,7 +2061,7 @@ exports[`Locale Provider should display the text as de 1`] = `
10 / Seite
-
+
@@ -2072,7 +2072,7 @@ exports[`Locale Provider should display the text as de 1`] = ` - +
~
2017
-
+
Sep.
-
+
@@ -2438,7 +2438,7 @@ exports[`Locale Provider should display the text as el 1`] = `
10 / σελίδα
-
+
@@ -2449,7 +2449,7 @@ exports[`Locale Provider should display the text as el 1`] = ` - +
~
2017
-
+
Σεπ
-
+
@@ -2815,7 +2815,7 @@ exports[`Locale Provider should display the text as en 1`] = `
10 / page
-
+
@@ -2826,7 +2826,7 @@ exports[`Locale Provider should display the text as en 1`] = ` - +
~
2017
-
+
Sep
-
+
@@ -3192,7 +3192,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
10 / page
-
+
@@ -3203,7 +3203,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = ` - +
~
2017
-
+
Sep
-
+
@@ -3569,7 +3569,7 @@ exports[`Locale Provider should display the text as es 1`] = `
10 / página
-
+
@@ -3580,7 +3580,7 @@ exports[`Locale Provider should display the text as es 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -3946,7 +3946,7 @@ exports[`Locale Provider should display the text as et 1`] = `
10 / leheküljel
-
+
@@ -3957,7 +3957,7 @@ exports[`Locale Provider should display the text as et 1`] = ` - +
~
2017
-
+
sept
-
+
@@ -4323,7 +4323,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
10 / صفحه
-
+
@@ -4334,7 +4334,7 @@ exports[`Locale Provider should display the text as fa 1`] = ` - +
~
2017
-
+
سپتامبر
-
+
@@ -4700,7 +4700,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
10 / sivu
-
+
@@ -4711,7 +4711,7 @@ exports[`Locale Provider should display the text as fi 1`] = ` - +
~
2017
-
+
syys
-
+
@@ -5077,7 +5077,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
10 / page
-
+
@@ -5088,7 +5088,7 @@ exports[`Locale Provider should display the text as fr 1`] = ` - +
~
2017
-
+
sept.
-
+
@@ -5454,7 +5454,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
10 / page
-
+
@@ -5465,7 +5465,7 @@ exports[`Locale Provider should display the text as fr 2`] = ` - +
~
2017
-
+
sept.
-
+
@@ -5831,7 +5831,7 @@ exports[`Locale Provider should display the text as is 1`] = `
10 / síðu
-
+
@@ -5842,7 +5842,7 @@ exports[`Locale Provider should display the text as is 1`] = ` - +
~
2017
-
+
sep
-
+
@@ -6208,7 +6208,7 @@ exports[`Locale Provider should display the text as it 1`] = `
10 / pagina
-
+
@@ -6219,7 +6219,7 @@ exports[`Locale Provider should display the text as it 1`] = ` - +
~
2017
-
+
set
-
+
@@ -6585,7 +6585,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
10 / ページ
-
+
@@ -6596,7 +6596,7 @@ exports[`Locale Provider should display the text as ja 1`] = ` - +
~
2017年
-
+
9月
-
+
@@ -6962,7 +6962,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
10 / 쪽
-
+
@@ -6973,7 +6973,7 @@ exports[`Locale Provider should display the text as ko 1`] = ` - +
~
2017
-
+
9월
-
+
@@ -7339,7 +7339,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
10 / rûpel
-
+
@@ -7350,7 +7350,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = ` - +
~
2017
-
+
9月
-
+
@@ -7716,7 +7716,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
10 / хуудас
-
+
@@ -7727,7 +7727,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = ` - +
~
2017
-
+
9 сар
-
+
@@ -8093,7 +8093,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
10 / side
-
+
@@ -8104,7 +8104,7 @@ exports[`Locale Provider should display the text as nb 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -8470,7 +8470,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
10 / pagina
-
+
@@ -8481,7 +8481,7 @@ exports[`Locale Provider should display the text as nl 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -8847,7 +8847,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
10 / pagina
-
+
@@ -8858,7 +8858,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -9224,7 +9224,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
10 / stronę
-
+
@@ -9235,7 +9235,7 @@ exports[`Locale Provider should display the text as pl 1`] = ` - +
~
2017
-
+
wrz
-
+
@@ -9601,7 +9601,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
10 / página
-
+
@@ -9612,7 +9612,7 @@ exports[`Locale Provider should display the text as pt 1`] = ` - +
~
2017
-
+
set
-
+
@@ -9978,7 +9978,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
10 / páginas
-
+
@@ -9989,7 +9989,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = ` - +
~
2017
-
+
set
-
+
@@ -10355,7 +10355,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
10 / стр.
-
+
@@ -10366,7 +10366,7 @@ exports[`Locale Provider should display the text as ru 1`] = ` - +
~
2017
-
+
сент.
-
+
@@ -10732,7 +10732,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
10 / strana
-
+
@@ -10743,7 +10743,7 @@ exports[`Locale Provider should display the text as sk 1`] = ` - +
~
2017
-
+
sep
-
+
@@ -11109,7 +11109,7 @@ exports[`Locale Provider should display the text as sl 1`] = `
10 / strani
-
+
@@ -11120,7 +11120,7 @@ exports[`Locale Provider should display the text as sl 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -11486,7 +11486,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
10 / strani
-
+
@@ -11497,7 +11497,7 @@ exports[`Locale Provider should display the text as sr 1`] = ` - +
~
2017
-
+
sep.
-
+
@@ -11863,7 +11863,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
10 / sida
-
+
@@ -11874,7 +11874,7 @@ exports[`Locale Provider should display the text as sv 1`] = ` - +
~
2017
-
+
sep
-
+
@@ -12240,7 +12240,7 @@ exports[`Locale Provider should display the text as th 1`] = `
10 / หน้า
-
+
@@ -12251,7 +12251,7 @@ exports[`Locale Provider should display the text as th 1`] = ` - +
~
2017
-
+
ก.ย.
-
+
@@ -12617,7 +12617,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
10 / sayfa
-
+
@@ -12628,7 +12628,7 @@ exports[`Locale Provider should display the text as tr 1`] = ` - +
~
2017
-
+
Eyl
-
+
@@ -12994,7 +12994,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
10 / сторінці
-
+
@@ -13005,7 +13005,7 @@ exports[`Locale Provider should display the text as uk 1`] = ` - +
~
2017
-
+
вер
-
+
@@ -13371,7 +13371,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
10 / trang
-
+
@@ -13382,7 +13382,7 @@ exports[`Locale Provider should display the text as vi 1`] = ` - +
~
2017
-
+
Th09
-
+
@@ -13748,7 +13748,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
10 条/页
-
+
@@ -13759,7 +13759,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = ` - +
~
2017年
-
+
9月
-
+
@@ -14125,7 +14125,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
10 條/頁
-
+
@@ -14136,7 +14136,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = ` - +
~
2017年
-
+
9月
-
+
diff --git a/components/notification/__tests__/__snapshots__/demo.test.js.snap b/components/notification/__tests__/__snapshots__/demo.test.js.snap index ea04f975a..8a02df53c 100644 --- a/components/notification/__tests__/__snapshots__/demo.test.js.snap +++ b/components/notification/__tests__/__snapshots__/demo.test.js.snap @@ -14,7 +14,7 @@ exports[`renders ./components/notification/demo/placement.md correctly 1`] = `
topRight
-
+
diff --git a/components/pagination/__tests__/__snapshots__/demo.test.js.snap b/components/pagination/__tests__/__snapshots__/demo.test.js.snap index 5a91b29b5..e88de765a 100644 --- a/components/pagination/__tests__/__snapshots__/demo.test.js.snap +++ b/components/pagination/__tests__/__snapshots__/demo.test.js.snap @@ -42,7 +42,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
10 / page
-
+
@@ -71,7 +71,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
20 / page
-
+
@@ -116,7 +116,7 @@ exports[`renders ./components/pagination/demo/custom-changer.md correctly 1`] =
10条/页
- + @@ -200,7 +200,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
10 / page
-
+
Goto
diff --git a/components/select/__tests__/__snapshots__/demo.test.js.snap b/components/select/__tests__/__snapshots__/demo.test.js.snap index f99bd46fe..03b6f0fd4 100644 --- a/components/select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/select/__tests__/__snapshots__/demo.test.js.snap @@ -20,14 +20,14 @@ exports[`renders ./components/select/demo/basic.md correctly 1`] = `
Lucy
-
+
Lucy
-
+
@@ -39,14 +39,14 @@ exports[`renders ./components/select/demo/coordinate.md correctly 1`] = `
Zhejiang
-
+
Hangzhou
-
+
@@ -57,7 +57,7 @@ exports[`renders ./components/select/demo/label-in-value.md correctly 1`] = `
Lucy (101)
-
+
`; @@ -69,10 +69,10 @@ exports[`renders ./components/select/demo/multiple.md correctly 1`] = `
  • -
    a1
    × +
    a1
  • -
    b2
    × +
    b2
  • `; @@ -98,7 +98,7 @@ exports[`renders ./components/select/demo/options.md correctly 1`] = `
    北京
    -
    +
    `; @@ -111,7 +111,7 @@ exports[`renders ./components/select/demo/search.md correctly 1`] = ` - + `; @@ -155,7 +155,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = ` " class="ant-select-selection-selected-value" style="display: block; opacity: 1;"> a1 - +
    @@ -168,14 +168,14 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = ` " class="ant-select-selection__choice">
    a1 -
    × +
  • b2 -
    × +
  • b2 -
    × +