From bee7cb0ddc159159e8c5a30b7407b434ad38dafd Mon Sep 17 00:00:00 2001 From: 38elements <38elements@users.noreply.github.com> Date: Sun, 5 Aug 2018 18:36:07 +0900 Subject: [PATCH] test: use WrapperArray class in wrapper-array.spec.js (#902) --- test/specs/wrapper-array.spec.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/specs/wrapper-array.spec.js b/test/specs/wrapper-array.spec.js index 590210a6d..8e816c020 100644 --- a/test/specs/wrapper-array.spec.js +++ b/test/specs/wrapper-array.spec.js @@ -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('

1

2

3

') - 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 => { @@ -60,10 +63,13 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => { 'isVueInstance', 'name', 'props', + 'setChecked', 'setComputed', 'setMethods', 'setData', 'setProps', + 'setSelected', + 'setValue', 'trigger', 'update', 'destroy' @@ -93,10 +99,12 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => { 'isEmpty', 'isVisible', 'isVueInstance', + 'setChecked', 'setComputed', 'setMethods', 'setData', 'setProps', + 'setValue', 'trigger', 'update', 'destroy'