Skip to content

Commit 8fc44cb

Browse files
Jinjiangeddyerburgh
authored andcommitted
docs(zh): updated to #1576284 (#1006)
1 parent 3653c60 commit 8fc44cb

4 files changed

+30
-27
lines changed

docs/zh/guides/dom-events.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@ wrapper.trigger('click', { button: 0 })
3737

3838
```html
3939
<template>
40-
<div>
41-
<button class="yes" @click="callYes">Yes</button>
42-
<button class="no" @click="callNo">No</button>
43-
</div>
40+
<div>
41+
<button class="yes" @click="callYes">Yes</button>
42+
<button class="no" @click="callNo">No</button>
43+
</div>
4444
</template>
45+
4546
<script>
4647
export default {
4748
name: 'YesNoComponent',
49+
4850
props: {
4951
callMe: {
5052
type: Function
5153
}
5254
},
55+
5356
methods: {
5457
callYes() {
5558
this.callMe('yes')
@@ -60,7 +63,6 @@ export default {
6063
}
6164
}
6265
</script>
63-
6466
```
6567

6668
**测试**
@@ -93,8 +95,9 @@ describe('点击事件', () => {
9395

9496
```html
9597
<template>
96-
<input type="text" @keydown.prevent="onKeydown" v-model="quantity" />
98+
<input type="text" @keydown.prevent="onKeydown" v-model="quantity" />
9799
</template>
100+
98101
<script>
99102
const KEY_DOWN = 40
100103
const KEY_UP = 38
@@ -107,6 +110,7 @@ export default {
107110
quantity: 0
108111
}
109112
},
113+
110114
methods: {
111115
increment() {
112116
this.quantity += 1
@@ -132,14 +136,14 @@ export default {
132136
}
133137
}
134138
},
139+
135140
watch: {
136141
quantity: function (newValue) {
137142
this.$emit('input', newValue)
138143
}
139144
}
140145
}
141146
</script>
142-
143147
```
144148

145149
**Test**
@@ -182,7 +186,6 @@ describe('键盘事件测试', () => {
182186
expect(wrapper.vm.quantity).toBe(13)
183187
})
184188
})
185-
186189
```
187190

188191
**限制**

docs/zh/guides/testing-async-components.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ export default {
2020
</template>
2121

2222
<script>
23-
import axios from 'axios'
24-
25-
export default {
26-
data () {
27-
return {
28-
value: null
29-
}
30-
},
31-
32-
methods: {
33-
async fetchResults () {
34-
const response = await axios.get('mock/service')
35-
this.value = response.data
36-
}
23+
import axios from 'axios'
24+
25+
export default {
26+
data () {
27+
return {
28+
value: null
29+
}
30+
},
31+
32+
methods: {
33+
async fetchResults () {
34+
const response = await axios.get('mock/service')
35+
this.value = response.data
3736
}
3837
}
38+
}
3939
</script>
4040
```
4141

docs/zh/guides/testing-single-file-components-with-karma.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Woohoo,我们的测试跑起来了!
138138
npm install --save-dev karma-coverage cross-env
139139
```
140140

141-
我们会使用 `cross-env` 来设置一个 `BABEL_ENV` 环境变量。这样我们就可以在编译测试的时候使用 `babel-plugin-istanbul`——因为我们不想在生产环境下引入 `babel-plugin-istnabul`
141+
我们会使用 `cross-env` 来设置一个 `BABEL_ENV` 环境变量。这样我们就可以在编译测试的时候使用 `babel-plugin-istanbul`——因为我们不想在生产环境下引入 `babel-plugin-istanbul`
142142

143143
```
144144
npm install --save-dev babel-plugin-istanbul

docs/zh/guides/testing-single-file-components-with-mocha-webpack.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ global.expect = require('expect')
124124

125125
``` html
126126
<template>
127-
<div>
128-
{{ count }}
129-
<button @click="increment">自增</button>
130-
</div>
127+
<div>
128+
{{ count }}
129+
<button @click="increment">自增</button>
130+
</div>
131131
</template>
132132

133133
<script>

0 commit comments

Comments
 (0)