Skip to content

Commit eb483c2

Browse files
authored
docs(zh): review migration (#2623)
* docs(zh): review migration * docs(zh): review migration * docs(zh): remove reviewing labels * docs(zh): unifiy stub translation * Update zh.mts
1 parent 42f5cc9 commit eb483c2

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

docs/.vitepress/config/index.mts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default defineConfig({
1010
locales: {
1111
root: { label: 'English', lang: 'en-US', link: '/', ...enConfig },
1212
fr: { label: 'Français', lang: 'fr-FR', link: '/fr/', ...frConfig },
13-
zh: { label: '简体中文 (校对中)', lang: 'zh-CN', link: '/zh/', ...zhConfig }
13+
zh: { label: '简体中文', lang: 'zh-CN', link: '/zh/', ...zhConfig }
1414
}
1515
})

docs/.vitepress/config/zh.mts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
114114
link: '/zh/guide/advanced/teleport'
115115
},
116116
{
117-
text: 'Stubs 和浅挂载',
117+
text: '测试替身 (stub) 和浅挂载',
118118
link: '/zh/guide/advanced/stubs-shallow-mount'
119119
},
120120
{

docs/.vitepress/theme/index.mts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import status from '../translation-status.json'
55
import './custom.css'
66
const i18nLabels = {
77
fr: 'La traduction est synchronisée avec les docs du ${date} dont le hash du commit est <code>${hash}</code>.',
8-
zh: '该翻译已同步到了 ${date} 的版本,其对应的 commit hash 是 <code>${hash}</code>。<br /><mark>同时该文档仍处于校对中,如有任何疑问或想参与校对工作,请<a href="https://github.com/vuejs/test-utils/issues/2561" target="_blank" style="font-weight: bold; text-decoration: underline;">移步这里</a>了解更多。</mark>'
8+
zh: '该翻译已同步到了 ${date} 的版本,其对应的 commit hash 是 <code>${hash}</code>。'
99
}
1010

1111

docs/zh/api/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ test('global.renderStubDefaultSlot', () => {
716716

717717
#### global.stubs
718718

719-
在挂载的组件上使用全局替代组件 (stub)。
719+
在挂载的组件上使用全局测试替身 (stub)。
720720

721721
**签名:**
722722

@@ -726,7 +726,7 @@ stubs?: Record<any, any>
726726

727727
**详细信息:**
728728

729-
默认情况下,`Transition``TransitionGroup` 组件会被自动 stub
729+
默认情况下,`Transition``TransitionGroup` 组件会被自动创建测试替身
730730

731731
`Component.vue`:
732732

@@ -788,7 +788,7 @@ test('global.stubs using a custom component', () => {
788788

789789
### shallow
790790

791-
组件的所有子组件替换为 stub
791+
组件的所有子组件替换为测试替身
792792

793793
**签名:**
794794

@@ -1893,7 +1893,7 @@ function shallowMount(Component, options?: MountingOptions): VueWrapper
18931893

18941894
**详细信息:**
18951895

1896-
`shallowMount` 的行为与 `mount` 完全相同,但它默认会 stub (替代) 所有的子组件。实际上,`shallowMount(Component)``mount(Component, { shallow: true })` 的别名。
1896+
`shallowMount` 的行为与 `mount` 完全相同,但它默认为所有的子组件创建测试替身。实际上,`shallowMount(Component)``mount(Component, { shallow: true })` 的别名。
18971897

18981898
## enableAutoUnmount
18991899

docs/zh/guide/advanced/stubs-shallow-mount.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test('stubs component', () => {
8484
这将为整个渲染树中的*所有* `<FetchDataFromApi />` 组件创建测试替身,而不管它们出现在哪个层级。这就是为什么它在 `global` 挂载选项中的原因。
8585

8686
::: tip
87-
要桩化组件,你可以使用 `components` 中的键或组件的名称。如果在 `global.stubs` 中同时给出这两者,将优先使用键。
87+
要为组件创建测试替身,你可以使用 `components` 中的键或组件的名称。如果在 `global.stubs` 中同时给出这两者,将优先使用键。
8888
:::
8989

9090
## 为所有子组件创建测试替身

docs/zh/guide/advanced/transitions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
</style>
4141
```
4242

43-
由于 Vue Test Utils 会模拟内置的过渡效果,你可以像测试其他组件一样测试上述组件:
43+
由于 Vue Test Utils 会为内置的 transition 组件创建测试替身,你可以像测试其他组件一样测试上述组件:
4444

4545
```js
4646
import Component from './Component.vue'
@@ -60,11 +60,11 @@ test('works with transitions', async () => {
6060

6161
## 部分支持
6262

63-
Vue Test Utils 内置的过渡效果模拟比较简单,并不涵盖 Vue 所有的[过渡特性](https://vuejs.org/guide/built-ins/transition)。例如它不支持 [JavaScript 钩子](https://vuejs.org/guide/built-ins/transition#javascript-hooks)。这一限制可能会导致 Vue 发出警告。
63+
Vue Test Utils 内置的 transition 组件的测试替身比较简单,并不涵盖 Vue 所有的[过渡特性](https://vuejs.org/guide/built-ins/transition)。例如它不支持 [JavaScript 钩子](https://vuejs.org/guide/built-ins/transition#javascript-hooks)。这一限制可能会导致 Vue 发出警告。
6464

6565
::: tip
6666
潜在解决方案:
67-
- 你可以通过将 [global stubs transition](../../api/#global-stubs) 设置为 false 来关闭自动模拟
68-
- 如果需要,你可以自行模拟过渡效果,以处理这些钩子。
67+
- 你可以通过将[全局 transition 测试替身](../../api/#global-stubs) 设置为 false 来停止自从创建测试替身
68+
- 如果需要,你可以自行创建 transition 的测试替身,以处理这些钩子。
6969
- 你可以在测试中捕获警告以消除它。
7070
:::

docs/zh/guide/faq/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ TypeError: Cannot set property prefix of #<Element> which has only a getter
2626

2727
**可能的解决方案**
2828

29-
1. 使用 `mount` 而不是 `shallowMount` 进行不带存根的渲染
29+
1. 使用 `mount` 而不是 `shallowMount` 进行不带测试替身的渲染
3030
2. 通过模拟 `console.warn` 来忽略警告
3131
3. 重命名 prop,以避免与 `Element` 属性冲突

0 commit comments

Comments
 (0)