Skip to content

Commit 159971d

Browse files
committed
docs(setprops): update setProps docs to reflect async mode
1 parent e7e410d commit 159971d

File tree

8 files changed

+36
-20
lines changed

8 files changed

+36
-20
lines changed

docs/api/wrapper/setProps.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ Sets `Wrapper` `vm` props and forces update.
1414
import { mount } from '@vue/test-utils'
1515
import Foo from './Foo.vue'
1616

17-
const wrapper = mount(Foo)
18-
wrapper.setProps({ foo: 'bar' })
19-
expect(wrapper.vm.foo).toBe('bar')
17+
test('setProps demo', async () => {
18+
const wrapper = mount(Foo)
19+
await wrapper.setProps({ foo: 'bar' })
20+
expect(wrapper.vm.foo).toBe('bar')
21+
})
2022
```
2123

2224
You can also pass a `propsData` object, which will initialize the Vue instance with passed values.

docs/guides/common-tips.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ describe('ParentComponent', () => {
153153
You can directly manipulate the state of the component using the `setData` or `setProps` method on the wrapper:
154154

155155
```js
156-
wrapper.setData({ count: 10 })
156+
it('manipulates state', async () => {
157+
await wrapper.setData({ count: 10 })
157158

158-
wrapper.setProps({ foo: 'bar' })
159+
await wrapper.setProps({ foo: 'bar' })
160+
})
159161
```
160162

161163
### Mocking Props

docs/ja/api/wrapper/setProps.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import { mount } from '@vue/test-utils'
1515
import Foo from './Foo.vue'
1616

17-
const wrapper = mount(Foo)
18-
wrapper.setProps({ foo: 'bar' })
19-
expect(wrapper.vm.foo).toBe('bar')
17+
test('setProps demo', async () => {
18+
const wrapper = mount(Foo)
19+
await wrapper.setProps({ foo: 'bar' })
20+
expect(wrapper.vm.foo).toBe('bar')
21+
})
2022
```
2123

2224
渡された値で Vue インスタンス を初期化する `propsData` オブジェクトを渡すことができます。

docs/ja/guides/common-tips.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ expect(wrapper.emitted().foo[1]).toEqual([123])
6363
ラッパの `setData` メソッドまたは `setProps` メソッドを使って、コンポーネントの状態を直接操作することができます。:
6464

6565
```js
66-
wrapper.setData({ count: 10 })
66+
it('manipulates state', async () => {
67+
await wrapper.setData({ count: 10 })
6768

68-
wrapper.setProps({ foo: 'bar' })
69+
await wrapper.setProps({ foo: 'bar' })
70+
})
6971
```
7072

7173
### プロパティをモックする

docs/ru/api/wrapper/setProps.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import { mount } from '@vue/test-utils'
1515
import Foo from './Foo.vue'
1616

17-
const wrapper = mount(Foo)
18-
wrapper.setProps({ foo: 'bar' })
19-
expect(wrapper.vm.foo).toBe('bar')
17+
test('setProps demo', async () => {
18+
const wrapper = mount(Foo)
19+
await wrapper.setProps({ foo: 'bar' })
20+
expect(wrapper.vm.foo).toBe('bar')
21+
})
2022
```
2123

2224
Вы также можете передать объект `propsData`, который инициализирует экземпляр Vue с переданными значениями.

docs/ru/guides/common-tips.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,11 @@ describe('ParentComponent', () => {
113113
Вы можете напрямую манипулировать состоянием компонента с помощью методов `setData` или `setProps` на обёртке:
114114

115115
```js
116-
wrapper.setData({ count: 10 })
116+
it('manipulates state', async () => {
117+
await wrapper.setData({ count: 10 })
117118

118-
wrapper.setProps({ foo: 'bar' })
119+
await wrapper.setProps({ foo: 'bar' })
120+
})
119121
```
120122

121123
### Моки входных параметров

docs/zh/api/wrapper/setProps.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
import { mount } from '@vue/test-utils'
1515
import Foo from './Foo.vue'
1616

17-
const wrapper = mount(Foo)
18-
wrapper.setProps({ foo: 'bar' })
19-
expect(wrapper.vm.foo).toBe('bar')
17+
test('setProps demo', async () => {
18+
const wrapper = mount(Foo)
19+
await wrapper.setProps({ foo: 'bar' })
20+
expect(wrapper.vm.foo).toBe('bar')
21+
})
2022
```
2123

2224
你也可以传递一个 `propsData` 对象,这会用该对象来初始化 Vue 示例。

docs/zh/guides/common-tips.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ describe('ParentComponent', () => {
151151
你可以在包裹器上用 `setData``setProps` 方法直接操作组件状态:
152152

153153
```js
154-
wrapper.setData({ count: 10 })
154+
it('manipulates state', async () => {
155+
await wrapper.setData({ count: 10 })
155156

156-
wrapper.setProps({ foo: 'bar' })
157+
await wrapper.setProps({ foo: 'bar' })
158+
})
157159
```
158160

159161
### 仿造 Prop

0 commit comments

Comments
 (0)