Skip to content

Add api document in docs/ja #194

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 2 commits into from
Nov 21, 2017
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
24 changes: 21 additions & 3 deletions docs/ja/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@
* [Vue Router と一緒に使う](guides/using-with-vue-router.md)
* [Vuex と一緒に使う](guides/using-with-vuex.md)
* [API](api/README.md)
* [createLocalVue](api/createLocalVue.md)
* [mount](api/mount.md)
* [shallow](api/shallow.md)
* [マウンティングオプション](api/options.md)
- [context](api/options.md#context)
- [slots](api/options.md#slots)
- [stubs](api/options.md#stubs)
- [mocks](api/options.md#mocks)
- [localVue](api/options.md#localvue)
- [attachToDocument](api/options.md#attachtodocument)
- [attrs](api/options.md#attrs)
- [listeners](api/options.md#listeners)
- [clone](api/options.md#clone)
* [Wrapper](api/wrapper/README.md)
* [contains](api/wrapper/contains.md)
* [emitted](api/wrapper/emitted.md)
* [emittedByOrder](api/wrapper/emittedByOrder.md)
* [find](api/wrapper/find.md)
* [findAll](api/wrapper/findAll.md)
* [hasAttribute](api/wrapper/hasAttribute.md)
* [hasClass](api/wrapper/hasClass.md)
* [hasProp](api/wrapper/hasProp.md)
Expand All @@ -27,11 +38,14 @@
* [isEmpty](api/wrapper/isEmpty.md)
* [isVueInstance](api/wrapper/isVueInstance.md)
* [name](api/wrapper/name.md)
* [update](api/wrapper/update.md)
* [setComputed](api/wrapper/setComputed.md)
* [setData](api/wrapper/setData.md)
* [setMethods](api/wrapper/setMethods.md)
* [setProps](api/wrapper/setProps.md)
* [text](api/wrapper/text.md)
* [trigger](api/wrapper/trigger.md)
* [update](api/wrapper/update.md)
* [destroy](api/wrapper/destroy.md)
* [WrapperArray](api/wrapper-array/README.md)
* [at](api/wrapper-array/at.md)
* [contains](api/wrapper-array/contains.md)
Expand All @@ -42,8 +56,12 @@
* [is](api/wrapper-array/is.md)
* [isEmpty](api/wrapper-array/isEmpty.md)
* [isVueInstance](api/wrapper-array/isVueInstance.md)
* [update](api/wrapper-array/update.md)
* [setComputed](api/wrapper-array/setComputed.md)
* [setData](api/wrapper-array/setData.md)
* [setMethods](api/wrapper-array/setMethods.md)
* [setProps](api/wrapper-array/setProps.md)
* [trigger](api/wrapper-array/trigger.md)
* [update](api/wrapper-array/update.md)
* [destroy](api/wrapper-array/destroy.md)
* [セレクタ](api/selectors.md)
* [createLocalVue](api/createLocalVue.md)
13 changes: 10 additions & 3 deletions docs/ja/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* [emitted](./wrapper/emitted.md)
* [emittedByOrder](./wrapper/emittedByOrder.md)
* [find](./wrapper/find.md)
* [findAll](./wrapper/findAll.md)
* [hasAttribute](./wrapper/hasAttribute.md)
* [hasClass](./wrapper/hasClass.md)
* [hasProp](./wrapper/hasProp.md)
Expand All @@ -26,11 +27,14 @@
* [isEmpty](./wrapper/isEmpty.md)
* [isVueInstance](./wrapper/isVueInstance.md)
* [name](./wrapper/name.md)
* [update](./wrapper/update.md)
* [setComputed](./wrapper/setComputed.md)
* [setData](./wrapper/setData.md)
* [setMethods](./wrapper/setMethods.md)
* [setProps](./wrapper/setProps.md)
* [text](./wrapper/text.md)
* [trigger](./wrapper/trigger.md)
* [update](./wrapper/update.md)
* [destroy](./wrapper/destroy.md)
* [WrapperArray](./wrapper-array/README.md)
* [at](./wrapper-array/at.md)
* [contains](./wrapper-array/contains.md)
Expand All @@ -41,9 +45,12 @@
* [is](./wrapper-array/is.md)
* [isEmpty](./wrapper-array/isEmpty.md)
* [isVueInstance](./wrapper-array/isVueInstance.md)
* [update](./wrapper-array/update.md)
* [setComputed](./wrapper-array/setComputed.md)
* [setData](./wrapper-array/setData.md)
* [setMethods](./wrapper-array/setMethods.md)
* [setProps](./wrapper-array/setProps.md)
* [trigger](./wrapper-array/trigger.md)
* [update](./wrapper-array/update.md)
* [destroy](./wrapper-array/destroy.md)
* [createLocalVue](./createLocalVue.md)
* [Selectors](./selectors.md)
* [セレクタ](./selectors.md)
17 changes: 17 additions & 0 deletions docs/ja/api/wrapper-array/destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# destroy()

`WrapperArray` のすべての Vue コンポーネントインスタンスを破棄します。

- **例:**

```js
import { mount } from 'vue-test-utils'
import { expect } from 'chai'
import Foo from './Foo.vue'

const wrapper = mount(Foo)
const divArray = wrapper.findAll('div')
expect(divArray.contains('p')).toBe(true)
divArray.destroy()
expect(divArray.contains('p')).toBe(false)
```
25 changes: 25 additions & 0 deletions docs/ja/api/wrapper-array/setComputed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# setComputed(computedObjects)

`WrapperArray` の `Wrapper` ごとに `Wrapper` `vm` の computed プロパティを設定し、更新を強制します。

**すべての Wrapper には Vue インスタンスを含む必要があることに注意してください**
**`setComputed` に渡す computed プロパティはすべての Vue インスタンスに存在する必要があることに注意してください**

- **引数:**
- `{Object} computed properties`

- **例:**

```js
import { mount } from 'vue-test-utils'
import Foo from './Foo.vue'
import Bar from './Bar.vue'

const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)

barArray.setComputed({
computed1: 'new-computed1',
computed2: 'new-computed2'
})
```
20 changes: 20 additions & 0 deletions docs/ja/api/wrapper/destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# destroy()

Vue コンポーネントインスタンスを破棄します。

- **例:**

```js
import { mount } from 'vue-test-utils'
import { expect } from 'chai'
import sinon from 'sinon'

const spy = sinon.stub()
mount({
render: null,
destroyed () {
spy()
}
}).destroy()
expect(spy.calledOnce).to.equal(true)
```
43 changes: 43 additions & 0 deletions docs/ja/api/wrapper/setComputed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# setComputed(computedProperties)

`Wrapper` `vm` の computed プロパティを設定し、更新を強制します。

**Wrapper には Vue インスタンスを含む必要があることに注意してください**
**`setComputed`に渡す computed プロパティは Vue インスタンスに存在する必要があることに注意してください**


- **引数:**
- `{Object} computed プロパティ`

- **例:**

```js
import { mount } from 'vue-test-utils'
import { expect } from 'chai'

const wrapper = mount({
template: '<div>{{ computed1 }} {{ computed2 }}</div>',
data () {
return {
initial: 'initial'
}
},
computed: {
computed1 () {
return this.initial
},
computed2 () {
return this.initial
}
}
})

expect(wrapper.html()).toBe('<div>initial initial</div>')

wrapper.setComputed({
computed1: 'new-computed1',
computed2: 'new-computed2'
})

expect(wrapper.html()).toBe('<div>new-computed1 new-computed2</div>')
```