Skip to content

docs: update docs/ja #841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/ja/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@
* [is](api/wrapper-array/is.md)
* [isEmpty](api/wrapper-array/isEmpty.md)
* [isVueInstance](api/wrapper-array/isVueInstance.md)
* [setChecked](api/wrapper-array/setChecked.md)
* [setData](api/wrapper-array/setData.md)
* [setMethods](api/wrapper-array/setMethods.md)
* [setProps](api/wrapper-array/setProps.md)
* [setValue](api/wrapper-array/setValue.md)
* [trigger](api/wrapper-array/trigger.md)
* [isVisible](api/wrapper-array/isVisible.md)
* [コンポーネント](api/components/)
Expand Down
4 changes: 2 additions & 2 deletions docs/ja/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ vue-test-utils にはオプションを定義するための `config` オプシ

#### `stubs`

- 型: `Object`
- 型: `{ [name: string]: Component | boolean | string }`
- デフォルト: `{
transition: TransitionStub,
'transition-group': TransitionGroupStub
Expand Down Expand Up @@ -45,7 +45,7 @@ VueTestUtils.config.mocks['$store'] = {

#### `methods`

- 型: `Object`
- 型: `{ [name: string]: Function }`
- デフォルト: `{}`

`config` オブジェクトを使用してデフォルトのメソッドを設定することができます。これは [VeeValidate](https://vee-validate.logaretm.com/) のようなコンポーネントにメソッドを注入するプラグインに役立ちます。`config` にセットした methods はマウンティングオプションに `methods` を渡すことで上書きすることができます。
Expand Down
2 changes: 2 additions & 0 deletions docs/ja/api/wrapper-array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
!!!include(docs/ja/api/wrapper-array/is.md)!!!
!!!include(docs/ja/api/wrapper-array/isEmpty.md)!!!
!!!include(docs/ja/api/wrapper-array/isVueInstance.md)!!!
!!!include(docs/ja/api/wrapper-array/setChecked.md)!!!
!!!include(docs/ja/api/wrapper-array/setData.md)!!!
!!!include(docs/ja/api/wrapper-array/setMethods.md)!!!
!!!include(docs/ja/api/wrapper-array/setProps.md)!!!
!!!include(docs/ja/api/wrapper-array/setValue.md)!!!
!!!include(docs/ja/api/wrapper-array/trigger.md)!!!
38 changes: 38 additions & 0 deletions docs/ja/api/wrapper-array/setChecked.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## setChecked(checked)

このメソッドは以下のコードのエイリアスです。

```js
wrapperArray.wrappers.forEach(wrapper => wrapper.setChecked(checked))
```

- **引数:**
- `{Boolean} checked (デフォルト: true)`

- **例:**

```js
import { mount } from '@vue/test-utils'

const wrapper = mount({
data () {
return {
t1: false,
t2: ''
}
},
template: `
<div>
<input type="checkbox" name="t1" class="foo" v-model="t1" />
<input type="radio" name="t2" class="foo" value="foo" v-model="t2"/>
<input type="radio" name="t2" class="bar" value="bar" v-model="t2"/>
</div>`
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).to.equal(false)
expect(wrapper.vm.t2).to.equal('')
wrapperArray.setChecked()
expect(wrapper.vm.t1).to.equal(true)
expect(wrapper.vm.t2).to.equal('foo')
```
37 changes: 37 additions & 0 deletions docs/ja/api/wrapper-array/setValue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## setValue(value)

このメソッドは以下のコードのエイリアスです。

```js
wrapperArray.wrappers.forEach(wrapper => wrapper.setValue(value))
```

- **引数:**
- `{any} value`

- **例:**

```js
import { mount } from '@vue/test-utils'

const wrapper = mount({
data () {
return {
t1: '',
t2: ''
}
},
template: `
<div>
<input type="text" name="t1" class="foo" v-model="t1" />
<input type="text" name="t2" class="foo" v-model="t2"/>
</div>`
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).to.equal('')
expect(wrapper.vm.t2).to.equal('')
wrapperArray.setValue('foo')
expect(wrapper.vm.t1).to.equal('foo')
expect(wrapper.vm.t2).to.equal('foo')
```
2 changes: 1 addition & 1 deletion docs/ja/api/wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vue-test-utils はラッパベースの API です。

### `vm`

`Component` (読み込み専用):これは vue のインスタンスです。`wrapper.vm` を使って [vm のプロパティとインスタンスメソッド](https://jp.vuejs.org/v2/api/#インスタンスプロパティ)にアクセスできます。これは、Vue コンポーネントラッパにのみ存在します
`Component` (読み込み専用):これは vue のインスタンスです。`wrapper.vm` を使って [vm のプロパティとインスタンスメソッド](https://jp.vuejs.org/v2/api/#インスタンスプロパティ)にアクセスできます。これは、Vue コンポーネントのラッパもしくは Vue コンポーネントをバインディングしている HTMLElement のラッパにのみ存在します

### `element`

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/api/wrapper/setValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
text コントロールの input 要素の 値をセットします。そして、 `v-model` に束縛されているデータを更新します。

- **引数:**
- `{String} value`
- `{any} value`

- **例:**

Expand Down