From c0167338e9d1ddbcab145a70c06eb8153db525c4 Mon Sep 17 00:00:00 2001 From: PY Date: Mon, 9 Oct 2023 05:01:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20cascader=20?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=20(#3446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 cascader label * chore: update snapshots --- src/cascader/cascader.tsx | 1 + test/unit/snap/__snapshots__/csr.test.js.snap | 126 +++--------------- test/unit/snap/__snapshots__/ssr.test.js.snap | 28 ++-- 3 files changed, 36 insertions(+), 119 deletions(-) diff --git a/src/cascader/cascader.tsx b/src/cascader/cascader.tsx index cdd1ab6088..967ab85781 100644 --- a/src/cascader/cascader.tsx +++ b/src/cascader/cascader.tsx @@ -79,6 +79,7 @@ export default defineComponent({ const renderLabel = () => { const label = renderTNodeJSX('label'); if (props.multiple) return label; + if (!label) return null; return
{label}
; }; diff --git a/test/unit/snap/__snapshots__/csr.test.js.snap b/test/unit/snap/__snapshots__/csr.test.js.snap index 3359588012..eacae047e5 100644 --- a/test/unit/snap/__snapshots__/csr.test.js.snap +++ b/test/unit/snap/__snapshots__/csr.test.js.snap @@ -29084,11 +29084,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/base.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -29156,11 +29152,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/check-strictly.vue class="t-input__prefix" > -
- -
+ @@ -29632,11 +29624,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/custom-options.vue class="t-input__prefix" > -
- -
+ @@ -29699,11 +29687,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/custom-options.vue class="t-input__prefix" > -
- -
+ @@ -29766,11 +29750,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/custom-options.vue class="t-input__prefix" > -
- -
+ @@ -29843,11 +29823,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/disabled.vue 1`] = class="t-input__prefix" > -
- -
+ @@ -29996,11 +29972,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/ellipsis.vue 1`] = class="t-input__prefix" > -
- -
+ @@ -30158,11 +30130,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/filterable.vue 1`] class="t-input__prefix" > -
- -
+ @@ -30306,11 +30274,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/filterable.vue 1`] class="t-input__prefix" > -
- -
+ @@ -30381,11 +30345,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/keys.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -30534,11 +30494,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/load.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -30930,11 +30886,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/show-all-levels.vu class="t-input__prefix" > -
- -
+ @@ -31072,11 +31024,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/size.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -31139,11 +31087,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/size.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -31206,11 +31150,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/size.vue 1`] = ` class="t-input__prefix" > -
- -
+ @@ -31283,11 +31223,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/trigger.vue 1`] = class="t-input__prefix" > -
- -
+ @@ -31350,11 +31286,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/trigger.vue 1`] = class="t-input__prefix" > -
- -
+ @@ -31923,11 +31855,7 @@ exports[`csr snapshot test > csr test ./src/cascader/_example/value-type.vue 1`] class="t-input__prefix" > -
- -
+ @@ -46025,11 +45953,7 @@ exports[`csr snapshot test > csr test ./src/config-provider/_example/others.vue class="t-input__prefix" > -
- -
+ @@ -46095,11 +46019,7 @@ exports[`csr snapshot test > csr test ./src/config-provider/_example/others.vue class="t-input__prefix" > -
- -
+ @@ -62603,11 +62523,7 @@ exports[`csr snapshot test > csr test ./src/form/_example/disabled.vue 1`] = ` class="t-input__prefix" > -
- -
+ diff --git a/test/unit/snap/__snapshots__/ssr.test.js.snap b/test/unit/snap/__snapshots__/ssr.test.js.snap index 389b732cc5..7448f3d43f 100644 --- a/test/unit/snap/__snapshots__/ssr.test.js.snap +++ b/test/unit/snap/__snapshots__/ssr.test.js.snap @@ -185,23 +185,23 @@ exports[`ssr snapshot test > ssr test ./src/card/_example/small.vue 1`] = ` 很长很长很长很长很长很长很长很长很长很长很长的内容示例。 " `; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/base.vue 1`] = `"
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/base.vue 1`] = `"
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/check-strictly.vue 1`] = `"
1/1.1/1.1.2/1.1.2.12
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/check-strictly.vue 1`] = `"
1/1.1/1.1.2/1.1.2.12
"`; exports[`ssr snapshot test > ssr test ./src/cascader/_example/collapsed.vue 1`] = `"
选项一/子选项一+2
选项一/子选项一+1
选项一/子选项一+1
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/custom-options.vue 1`] = `"
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/custom-options.vue 1`] = `"
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/disabled.vue 1`] = `"
选项一/子选项一
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/disabled.vue 1`] = `"
选项一/子选项一
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/ellipsis.vue 1`] = `"
当选项一数据展示文本过长时/子选项一
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/ellipsis.vue 1`] = `"
当选项一数据展示文本过长时/子选项一
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/filterable.vue 1`] = `"
当选项一数据展示文本过长时/子选项一
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/filterable.vue 1`] = `"
当选项一数据展示文本过长时/子选项一
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/keys.vue 1`] = `"
选项一/子选项一
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/keys.vue 1`] = `"
选项一/子选项一
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/load.vue 1`] = `"
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/load.vue 1`] = `"
"`; exports[`ssr snapshot test > ssr test ./src/cascader/_example/max.vue 1`] = `"
请选择
"`; @@ -209,11 +209,11 @@ exports[`ssr snapshot test > ssr test ./src/cascader/_example/multiple.vue 1`] = exports[`ssr snapshot test > ssr test ./src/cascader/_example/panel.vue 1`] = `"
  • 选项一
  • 选项二
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/show-all-levels.vue 1`] = `"
请选择
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/show-all-levels.vue 1`] = `"
请选择
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/size.vue 1`] = `"
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/size.vue 1`] = `"
"`; -exports[`ssr snapshot test > ssr test ./src/cascader/_example/trigger.vue 1`] = `"
"`; +exports[`ssr snapshot test > ssr test ./src/cascader/_example/trigger.vue 1`] = `"
"`; exports[`ssr snapshot test > ssr test ./src/cascader/_example/value-display.vue 1`] = `"
单选:
子选项二(2.2)
多选:
子选项三(1.3)子选项一(2.1)子选项二(2.2)
"`; @@ -223,7 +223,7 @@ exports[`ssr snapshot test > ssr test ./src/cascader/_example/value-type.vue 1`] "
[ "1", "1.1" -]
[ +]
[ [ "1", "1.1" @@ -299,7 +299,7 @@ exports[`ssr snapshot test > ssr test ./src/config-provider/_example/global.vue exports[`ssr snapshot test > ssr test ./src/config-provider/_example/input.vue 1`] = `"
"`; -exports[`ssr snapshot test > ssr test ./src/config-provider/_example/others.vue 1`] = `"


0 / 20
0 / 0
Empty Data





















Feature TagFeature TagFeature TagFeature Tag

Tree Empty Data


Department A
Department B



First Step
You need to click the blue button
Second Step
Fill your base information into the form
Error Step
Something Wrong! Custom Error Icon!
4
Last Step
You haven't finish this step.


图片加载中
"`; +exports[`ssr snapshot test > ssr test ./src/config-provider/_example/others.vue 1`] = `"


0 / 20
0 / 0
Empty Data





















Feature TagFeature TagFeature TagFeature Tag

Tree Empty Data


Department A
Department B



First Step
You need to click the blue button
Second Step
Fill your base information into the form
Error Step
Something Wrong! Custom Error Icon!
4
Last Step
You haven't finish this step.


图片加载中
"`; exports[`ssr snapshot test > ssr test ./src/config-provider/_example/pagination.vue 1`] = `"
Total 36 items
10 / page
  • 1
  • 2
  • 3
  • 4
jump to
/ 4
"`; @@ -411,7 +411,7 @@ exports[`ssr snapshot test > ssr test ./src/form/_example/clear-validate.vue 1`] exports[`ssr snapshot test > ssr test ./src/form/_example/custom-validator.vue 1`] = `"
同一个校验方法可输出不同的错误信息和类型,依次输入:1234 观察变化
自定义异步校验方法
"`; -exports[`ssr snapshot test > ssr test ./src/form/_example/disabled.vue 1`] = `"
接受
  • 图片加载中
请选择单张图片文件上传
"`; +exports[`ssr snapshot test > ssr test ./src/form/_example/disabled.vue 1`] = `"
接受
  • 图片加载中
请选择单张图片文件上传
"`; exports[`ssr snapshot test > ssr test ./src/form/_example/error-message.vue 1`] = `"
这是用户名字段帮助说明
一句话介绍自己
"`;