🌐 AI搜索 & 代理 主页
Skip to content
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
42 changes: 22 additions & 20 deletions docs/api/wrapper-array/setChecked.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@ wrapperArray.wrappers.forEach(wrapper => wrapper.setChecked(checked))
```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>`
test('setChecked demo', async () => {
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).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
```
10 changes: 6 additions & 4 deletions docs/api/wrapper-array/setData.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setData demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
10 changes: 6 additions & 4 deletions docs/api/wrapper-array/setProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setProps demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
14 changes: 8 additions & 6 deletions docs/api/wrapper-array/setValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const wrapper = mount({
</div>`
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
test('setValue demo', async () => {
const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
})
```
16 changes: 9 additions & 7 deletions docs/api/wrapper-array/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import { mount } from '@vue/test-utils'
import sinon from 'sinon'
import Foo from './Foo.vue'

const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
test('trigger demo', async () => {
const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})

const divArray = wrapper.findAll('div')
await divArray.trigger('click')
expect(clickHandler.called).toBe(true)
})

const divArray = wrapper.findAll('div')
divArray.trigger('click')
expect(clickHandler.called).toBe(true)
```
42 changes: 22 additions & 20 deletions docs/ja/api/wrapper-array/setChecked.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@ wrapperArray.wrappers.forEach(wrapper => wrapper.setChecked(checked))
```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>`
test('setChecked demo', async () => {
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).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
```
10 changes: 6 additions & 4 deletions docs/ja/api/wrapper-array/setData.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setData demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
10 changes: 6 additions & 4 deletions docs/ja/api/wrapper-array/setProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setProps demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
14 changes: 8 additions & 6 deletions docs/ja/api/wrapper-array/setValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const wrapper = mount({
</div>`
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
test('setValue demo', async () => {
const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
})
```
16 changes: 9 additions & 7 deletions docs/ja/api/wrapper-array/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import { mount } from '@vue/test-utils'
import sinon from 'sinon'
import Foo from './Foo.vue'

const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})
test('trigger demo', async () => {
const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})

const divArray = wrapper.findAll('div')
divArray.trigger('click')
expect(clickHandler.called).toBe(true)
const divArray = wrapper.findAll('div')
await divArray.trigger('click')
expect(clickHandler.called).toBe(true)
})
```
24 changes: 15 additions & 9 deletions docs/ja/api/wrapper/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ import { mount } from '@vue/test-utils'
import sinon from 'sinon'
import Foo from './Foo'

const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})
test('trigger demo', async () => {
const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})

wrapper.trigger('click')
await wrapper.trigger('click')

wrapper.trigger('click', {
button: 0
})
await wrapper.trigger('click', {
button: 0
})

expect(clickHandler.called).toBe(true)
await wrapper.trigger('click', {
ctrlKey: true
})

expect(clickHandler.called).toBe(true)
})
```

- **イベントターゲットの設定:**
Expand Down
42 changes: 22 additions & 20 deletions docs/ru/api/wrapper-array/setChecked.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@ wrapperArray.wrappers.forEach(wrapper => wrapper.setChecked(checked))
```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>`
test('setChecked demo', async () => {
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).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual(false)
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setChecked()
expect(wrapper.vm.t1).toEqual(true)
expect(wrapper.vm.t2).toEqual('foo')
```
10 changes: 6 additions & 4 deletions docs/ru/api/wrapper-array/setData.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setData demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setData({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
10 changes: 6 additions & 4 deletions docs/ru/api/wrapper-array/setProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
test('setProps demo', async () => {
const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
await barArray.setProps({ foo: 'bar' })
expect(barArray.at(0).vm.foo).toBe('bar')
})
```
14 changes: 8 additions & 6 deletions docs/ru/api/wrapper-array/setValue.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const wrapper = mount({
</div>`
})

const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
test('setValue demo', async () => {
const wrapperArray = wrapper.findAll('.foo')
expect(wrapper.vm.t1).toEqual('')
expect(wrapper.vm.t2).toEqual('')
await wrapperArray.setValue('foo')
expect(wrapper.vm.t1).toEqual('foo')
expect(wrapper.vm.t2).toEqual('foo')
})
```
16 changes: 9 additions & 7 deletions docs/ru/api/wrapper-array/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import { mount } from '@vue/test-utils'
import sinon from 'sinon'
import Foo from './Foo.vue'

const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
test('trigger demo', async () => {
const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
propsData: { clickHandler }
})

const divArray = wrapper.findAll('div')
await divArray.trigger('click')
expect(clickHandler.called).toBe(true)
})

const divArray = wrapper.findAll('div')
divArray.trigger('click')
expect(clickHandler.called).toBe(true)
```
Loading