Skip to content

Commit becefa7

Browse files
authored
Update unit-testing.md
1 parent bc3903f commit becefa7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/guide/unit-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ order: 22
66

77
## 配置和工具
88

9-
任何兼容基于模块的构建系统都可以正常使用, 但如果你需要一个具体的建议, 可以使用 [Karma](http://karma-runner.github.io) 进行自动化测试.它有很多社区版的插件, 包括对 [Webpack](https://github.com/webpack/karma-webpack)[Browserify](https://github.com/Nikku/karma-browserify) 的支持. 更多详细的安装步骤, 请参考各项目的安装文档, 通过这些 Karma 配置的例子可以快速帮助你上手( [Webpack](https://github.com/vuejs/vue-loader-example/blob/master/build/karma.conf.js) 插件, [Browserify](https://github.com/vuejs/vueify-example/blob/master/karma.conf.js) 插件)。
9+
任何兼容基于模块的构建系统都可以正常使用但如果你需要一个具体的建议可以使用[Karma](http://karma-runner.github.io)进行自动化测试它有很多社区版的插件包括对[Webpack](https://github.com/webpack/karma-webpack)[Browserify](https://github.com/Nikku/karma-browserify)的支持更多详细的安装步骤请参考各项目的安装文档,通过这些Karma配置的例子可以快速帮助你上手([Webpack](https://github.com/vuejs/vue-loader-example/blob/master/build/karma.conf.js)配置,[Browserify](https://github.com/vuejs/vueify-example/blob/master/karma.conf.js)配置)。
1010

1111
## 简单的断言
1212

@@ -70,7 +70,7 @@ describe('MyComponent', () => {
7070

7171
## 编写可被测试的组件
7272

73-
A lot of components' render output are primarily determined by the props they receive. In fact, if a component's render output solely depends on its props, it becomes quite straightforward to test, similar to asserting the return value of a pure function with different arguments. Take an contrived example:
73+
很多组件的渲染输出由它的prop决定。事实上,如果一个组件的渲染输出完全取决于它的prop,那么它会让测试变得简单, 就好像断言不同参数的纯函数的返回值。看下面这个例子:
7474

7575
``` html
7676
<template>
@@ -84,7 +84,7 @@ A lot of components' render output are primarily determined by the props they re
8484
</script>
8585
```
8686

87-
You can assert its render output with different props using the `propsData` option:
87+
你可以在不同的prop中,通过 `propsData` 选项断言他的渲染输出:
8888

8989
``` js
9090
import Vue from 'vue'
@@ -128,4 +128,4 @@ it('updates the rendered message when vm.message updates', done => {
128128
})
129129
```
130130

131-
We are planning to work on a collection of common test helpers that makes it even simpler to render components with different constraints (e.g. shallow rendering that ignores child components) and assert their output.
131+
我们计划做一个通用的测试工具集,让不同策略的渲染输出(例如忽略子组件的基本渲染)和断言变得更简单。

0 commit comments

Comments
 (0)