Skip to content

Commit

Permalink
test: use WrapperArray class in wrapper-array.spec.js (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements authored and eddyerburgh committed Aug 5, 2018
1 parent 9e20dc9 commit bee7cb0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/specs/wrapper-array.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { compileToFunctions } from 'vue-template-compiler'
import { Wrapper, WrapperArray } from '~vue/test-utils'
import { describeWithShallowAndMount } from '~resources/utils'

describeWithShallowAndMount('WrapperArray', mountingMethod => {
function getWrapperArray (wrappers) {
const compiled = compileToFunctions('<div><p>1</p><p>2</p><p>3</p></div>')
const wrapper = mountingMethod(compiled)
const wrapperArray = wrapper.findAll('p')
expect(wrapperArray.constructor.name).to.equal('WrapperArray')
return wrappers ? new wrapperArray.constructor(wrappers) : wrapperArray
if (!wrappers) {
wrappers = [1, 2, 3].map((v) => {
const p = document.createElement('p')
p.textContent = v
return new Wrapper(p)
})
}
return new WrapperArray(wrappers)
}

['wrappers', 'length'].forEach(property => {
Expand Down Expand Up @@ -60,10 +63,13 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => {
'isVueInstance',
'name',
'props',
'setChecked',
'setComputed',
'setMethods',
'setData',
'setProps',
'setSelected',
'setValue',
'trigger',
'update',
'destroy'
Expand Down Expand Up @@ -93,10 +99,12 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => {
'isEmpty',
'isVisible',
'isVueInstance',
'setChecked',
'setComputed',
'setMethods',
'setData',
'setProps',
'setValue',
'trigger',
'update',
'destroy'
Expand Down

0 comments on commit bee7cb0

Please sign in to comment.