Repository: Tencent/tdesign-mobile-vue
Pull request #905 (2023-06-27 04:34:40)

fix: resolve some test case error
<!--
首先，感谢你的贡献！😄
请阅读并遵循 [TDesign 贡献指南](https://github.com/Tencent/tdesign/blob/main/docs/contributing.md)，填写以下 pull request 的信息。
PR 在维护者审核通过后会合并，谢谢！
-->

### 🤔 这个 PR 的性质是？

- [ ] 日常 bug 修复
- [ ] 新特性提交
- [ ] 文档改进
- [ ] 演示代码改进
- [ ] 组件样式/交互改进
- [ ] CI/CD 改进
- [ ] 重构
- [ ] 代码风格优化
- [ ] 测试用例
- [ ] 分支合并
- [ ] 其他

### 🔗 相关 Issue

<!--
1. 描述相关需求的来源，如相关的 issue 讨论链接。
-->

### 💡 需求背景和解决方案

<!--
1. 要解决的具体问题。
2. 列出最终的 API 实现和用法。
3. 涉及UI/交互变动需要有截图或 GIF。
-->

### 📝 更新日志

<!--
从用户角度描述具体变化，以及可能的 breaking change 和其他风险。
-->

- fix(组件名称): 处理问题或特性描述 ...

- [ ] 本条 PR 不需要纳入 Changelog

### ☑️ 请求合并前的自查清单

⚠️ 请自检并全部**勾选全部选项**。⚠️

- [ ] 文档已补充或无须补充
- [ ] 代码演示已提供或无须提供
- [ ] TypeScript 定义已补充或无须补充
- [ ] Changelog 已提供或无须提供


github-actions[bot]: [<img height="96" alt="失败" src="https://user-images.githubusercontent.com/5378891/75333447-1e63a280-58c1-11ea-975d-235367fd1522.png">](https://github.com/Tencent/tdesign-mobile-vue/actions/runs/5385842468)
<!-- AUTO_PREVIEW_HOOK -->
github-actions[bot]: **Size Change:** -42 B (0%) 

**Total Size:** 473 kB

| Filename | Size | Change |
| :--- | :---: | :---: |
| `./dist/tdesign.js` | 276 kB | -25 B (0%) |
| `./dist/tdesign.min.js` | 133 kB | -17 B (0%) |

<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size |
| :--- | :---: |
| `./dist/reset.css` | 672 B |
| `./dist/tdesign.css` | 36.4 kB |
| `./dist/tdesign.min.css` | 26.3 kB |

</details>


github-actions[bot]: **Size Change:** -42 B (0%) 

**Total Size:** 473 kB

| Filename | Size | Change |
| :--- | :---: | :---: |
| `./dist/tdesign.js` | 276 kB | -25 B (0%) |
| `./dist/tdesign.min.js` | 133 kB | -17 B (0%) |

<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size |
| :--- | :---: |
| `./dist/reset.css` | 672 B |
| `./dist/tdesign.css` | 36.4 kB |
| `./dist/tdesign.min.css` | 26.3 kB |

</details>


github-actions[bot]: **Size Change:** -15 B (0%) 

**Total Size:** 473 kB

| Filename | Size | Change |
| :--- | :---: | :---: |
| `./dist/tdesign.js` | 276 kB | -12 B (0%) |
| `./dist/tdesign.min.js` | 133 kB | -3 B (0%) |

<details><summary>ℹ️ <strong>View Unchanged</strong></summary>

| Filename | Size |
| :--- | :---: |
| `./dist/reset.css` | 672 B |
| `./dist/tdesign.css` | 36.4 kB |
| `./dist/tdesign.min.css` | 26.3 kB |

</details>



Patch:
diff --git a/src/link/link.vue b/src/link/link.vue
index f527949f..be8ce71b 100644
--- a/src/link/link.vue
+++ b/src/link/link.vue
@@ -6,13 +6,13 @@
     :aria-disabled="disabled"
     @click="handleClick"
   >
-    <span v-if="prefixContent" :class="`${baseClass}__prefix-icon ${prefix}-class-prefix-icon`">
+    <span v-if="prefixContent" :class="`${name}__prefix-icon ${prefix}-class-prefix-icon`">
       <t-node :content="prefixContent"></t-node>
     </span>
-    <span :class="`${baseClass}__content`">
+    <span :class="`${name}__content`">
       <t-node :content="linkContent"></t-node>
     </span>
-    <span v-if="suffixContent" :class="`${baseClass}__suffix-icon ${prefix}-class-suffix-icon`">
+    <span v-if="suffixContent" :class="`${name}__suffix-icon ${prefix}-class-suffix-icon`">
       <t-node :content="suffixContent"></t-node>
     </span>
   </a>
@@ -34,7 +34,6 @@ export default defineComponent({
   },
   props: LinkProps,
   setup(props, context) {
-    const baseClass = name;
     const emitEvent = useEmitEvent(props, context.emit);
     const _this = getCurrentInstance();
     const linkContent = computed(() => renderContent(_this, 'default', 'content'));
@@ -46,21 +45,21 @@ export default defineComponent({
       emitEvent('click', e);
     };
 
-    const linkClass = [
-      baseClass,
-      `${baseClass}--${props.theme}`,
-      `${name}--${props.size}`,
+    const linkClass = computed(() => [
+      name,
+      `${name}--${props.theme || 'default'}`,
+      `${name}--${props.size || 'medium'}`,
       {
         [`${name}--disabled`]: props.disabled,
         [`${name}--underline`]: props.underline,
         [`${name}--hover`]: props.hover && !props.disabled,
       },
-    ];
+    ]);
 
     return {
       prefix,
       linkClass,
-      baseClass,
+      name,
       handleClick,
       linkContent,
       prefixContent,
diff --git a/src/result/result.vue b/src/result/result.vue
index ac41274c..c5864864 100644
--- a/src/result/result.vue
+++ b/src/result/result.vue
@@ -46,7 +46,7 @@ export default defineComponent({
     const titleContent = computed(() => renderTNode(internalInstance, 'title'));
     const descriptionContent = computed(() => renderTNode(internalInstance, 'description'));
 
-    const classes = computed(() => [`${name}`, `${name}--theme-${props.theme}`]);
+    const classes = computed(() => [`${name}`, `${name}--theme-${props.theme || 'default'}`]);
 
     let iconContent: any;
     if (props?.theme) {


Test patch:
diff --git a/src/avatar/__test__/index.test.jsx b/src/avatar/__test__/index.test.jsx
index c7a1b57e..a10f4f8e 100644
--- a/src/avatar/__test__/index.test.jsx
+++ b/src/avatar/__test__/index.test.jsx
@@ -110,7 +110,7 @@ describe('avatar-group', async () => {
   it(': cascading', async () => {
     sizeList.forEach((s) => {
       const wrapper = mount(() => (
-        <AvatarGroup cascading="" size={s}>
+        <AvatarGroup cascading={''} size={s}>
           <Avatar image={IMAGE}></Avatar>
           <Avatar image={IMAGE}></Avatar>
         </AvatarGroup>
diff --git a/src/link/__test__/index.test.jsx b/src/link/__test__/index.test.jsx
index 7670afcc..e32bf68e 100644
--- a/src/link/__test__/index.test.jsx
+++ b/src/link/__test__/index.test.jsx
@@ -18,10 +18,10 @@ describe('Link', () => {
       expect(wrapper.find('.t-link--large').exists()).toBeTruthy();
       const wrapperDefault = mount({
         render() {
-          return <Link size=''>text</Link>;
+          return <Link size={''}>text</Link>;
         },
       });
-      expect(wrapperDefault.find('.t-link--').exists()).toBeTruthy();
+      expect(wrapperDefault.find('.t-link--medium').exists()).toBeTruthy();
     });
     it(':theme', () => {
       const wrapper = mount({
@@ -32,10 +32,10 @@ describe('Link', () => {
       expect(wrapper.find('.t-link--primary').exists()).toBeTruthy();
       const wrapperDefault = mount({
         render() {
-          return <Link theme=''>text</Link>;
+          return <Link theme={''}>text</Link>;
         },
       });
-      expect(wrapperDefault.find('.t-link--').exists()).toBeTruthy();
+      expect(wrapperDefault.find('.t-link--default').exists()).toBeTruthy();
     });
     it(':hover', () => {
       const wrapper = mount({
diff --git a/src/result/__test__/index.test.jsx b/src/result/__test__/index.test.jsx
index cac18d75..80bb5837 100644
--- a/src/result/__test__/index.test.jsx
+++ b/src/result/__test__/index.test.jsx
@@ -49,7 +49,8 @@ describe('Result.vue', () => {
     const wrapper1 = mount(() => <Result theme="success"></Result>);
     const wrapper2 = mount(() => <Result theme="warning"></Result>);
     const wrapper3 = mount(() => <Result theme="error"></Result>);
-    const wrapper4 = mount(() => <Result theme=""></Result>);
+    const wrapper4 = mount(() => <Result theme={''}></Result>);
+
 
     expect(wrapper1.classes()).toContain('t-result--theme-success');
     expect(wrapper1.findComponent(CheckCircleIcon).exists()).toBeTruthy();
@@ -58,6 +59,6 @@ describe('Result.vue', () => {
     expect(wrapper3.classes()).toContain('t-result--theme-error');
     expect(wrapper3.findComponent(CloseCircleIcon).exists()).toBeTruthy();
 
-    expect(wrapper4.classes()).toContain('t-result--theme-');
+    expect(wrapper4.classes()).toContain('t-result--theme-default');
   });
 });