File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 88
99## 简单示例 - 使用 ` trigger ` 更新
1010
11- 让我们重用来自 [ 事件处理] ( ../essentials/event-handling ) 的 ` <Counter> ` 组件,唯一的变化是我们现在在 ` template ` 中渲染 ` count ` 。
11+ 让我们重用来自[ 事件处理] ( ../essentials/event-handling ) 的 ` <Counter> ` 组件,唯一的变化是我们现在在 ` template ` 中渲染 ` count ` 。
1212
1313``` js
1414const Counter = {
@@ -44,7 +44,7 @@ test('increments by 1', () => {
4444出乎意料的是,这个测试失败了!原因是虽然 ` count ` 增加了,但 Vue 不会在下一个事件循环的 tick 之前更新 DOM。因此,断言 (` expect()... ` ) 会在 Vue 更新 DOM 之前被调用。
4545
4646::: tip
47- 如果你想了解更多关于这个核心 JavaScript 行为的信息,可以阅读 [ 事件循环及其宏任务和微任务] ( https://javascript.info/event-loop#macrotasks-and-microtasks ) 。
47+ 如果你想了解更多关于这个核心 JavaScript 行为的信息,可以阅读[ 事件循环及其宏任务和微任务] ( https://javascript.info/event-loop#macrotasks-and-microtasks ) 。
4848:::
4949
5050抛开实现细节,我们该如何修复这个问题呢?实际上,Vue 提供了一种方法让我们等待 DOM 更新:` nextTick ` 。
@@ -107,7 +107,7 @@ test('uses a mocked axios HTTP client and flushPromises', async () => {
107107```
108108
109109::: tip
110- 如果你想了解更多关于在组件上测试请求的信息,请确保查看 [ 发起 HTTP 请求] ( http-requests.md ) 指南。
110+ 如果你想了解更多关于在组件上测试请求的信息,请确保查看[ 发起 HTTP 请求] ( http-requests.md ) 指南。
111111:::
112112
113113## 测试异步 ` setup `
Original file line number Diff line number Diff line change 11# 测试服务端渲染
22
3- Vue Test Utils provides ` renderToString ` to test Vue applications that use server-side rendering (SSR)。
43Vue Test Utils 提供了 ` renderToString ` 方法,用于测试使用服务器端渲染 (SSR) 的 Vue 应用程序。本指南将带你了解如何测试使用 SSR 的 Vue 应用程序。
54
65## ` renderToString `
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ module.exports = {
329329
330330如果你使用快照测试并且注释节点泄漏到你的快照中,请注意 ` comments` 现在始终[保留](https://vuejs.org/api/application.html#app-config-compileroptions-comments),并仅在生产中删除。你可以通过调整 ` app .config .compilerOptions ` 来覆盖此行为,以便在快照中也删除它们:
331331
332- - 通过 ` vue- jest` [配置](https://github.com/vuejs/vue-jest#compiler-options-in-vue-3)。
332+ - 通过 ` vue- jest` [配置](https://github.com/vuejs/vue-jest#compiler-options-in-vue-3)。
333333 ` ` ` js
334334 // jest.config.js
335335 module .exports = {
@@ -365,7 +365,7 @@ module.exports = {
365365| plugins | 嵌套在 ` global ` 中 |
366366| component | 嵌套在 ` global ` 中 |
367367| directives | 嵌套在 ` global ` 中 |
368- | attachToDocument | 重命名为 ` attachTo` . 参见 [此处](https://github.com/vuejs/vue-test-utils/pull/1492) |
368+ | attachToDocument | 重命名为 ` attachTo` . 参见[此处](https://github.com/vuejs/vue-test-utils/pull/1492) |
369369| scopedSlots | 被移除, ScopedSlots 与 Vue 3 的 ` slots` 合并 |
370370| context | 被移除, 与 Vue 2 不同,已不再有意义 |
371371| localVue | 被移除, 不再需要 - 在 Vue 3 中没有全局 Vue 实例可供修改 |
@@ -385,7 +385,7 @@ module.exports = {
385385| setSelected | 被移除,现在是 ` setValue` 的一部分 |
386386| setChecked | 被移除,现在是 ` setValue` 的一部分 |
387387| is | 被移除 |
388- | isEmpty | 被移除, 使用匹配器 [参考](https://github.com/testing-library/jest-dom#tobeempty) |
388+ | isEmpty | 被移除, 使用匹配器[参考](https://github.com/testing-library/jest-dom#tobeempty) |
389389| isVueInstance | 被移除 |
390390| name | 被移除 |
391391| setMethods | 被移除 |
You can’t perform that action at this time.
0 commit comments