Skip to content

Commit bee7cb0

Browse files
38elementseddyerburgh
authored andcommitted
test: use WrapperArray class in wrapper-array.spec.js (#902)
1 parent 9e20dc9 commit bee7cb0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Diff for: test/specs/wrapper-array.spec.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import { compileToFunctions } from 'vue-template-compiler'
1+
import { Wrapper, WrapperArray } from '~vue/test-utils'
22
import { describeWithShallowAndMount } from '~resources/utils'
33

44
describeWithShallowAndMount('WrapperArray', mountingMethod => {
55
function getWrapperArray (wrappers) {
6-
const compiled = compileToFunctions('<div><p>1</p><p>2</p><p>3</p></div>')
7-
const wrapper = mountingMethod(compiled)
8-
const wrapperArray = wrapper.findAll('p')
9-
expect(wrapperArray.constructor.name).to.equal('WrapperArray')
10-
return wrappers ? new wrapperArray.constructor(wrappers) : wrapperArray
6+
if (!wrappers) {
7+
wrappers = [1, 2, 3].map((v) => {
8+
const p = document.createElement('p')
9+
p.textContent = v
10+
return new Wrapper(p)
11+
})
12+
}
13+
return new WrapperArray(wrappers)
1114
}
1215

1316
['wrappers', 'length'].forEach(property => {
@@ -60,10 +63,13 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => {
6063
'isVueInstance',
6164
'name',
6265
'props',
66+
'setChecked',
6367
'setComputed',
6468
'setMethods',
6569
'setData',
6670
'setProps',
71+
'setSelected',
72+
'setValue',
6773
'trigger',
6874
'update',
6975
'destroy'
@@ -93,10 +99,12 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => {
9399
'isEmpty',
94100
'isVisible',
95101
'isVueInstance',
102+
'setChecked',
96103
'setComputed',
97104
'setMethods',
98105
'setData',
99106
'setProps',
107+
'setValue',
100108
'trigger',
101109
'update',
102110
'destroy'

0 commit comments

Comments
 (0)