From e292a801a492f98074dbd26b2764a5a0c7de4c08 Mon Sep 17 00:00:00 2001 From: 38elements Date: Sun, 5 Aug 2018 16:18:20 +0900 Subject: [PATCH 1/2] test: use WrapperArray class in wrapper-array.spec.js --- test/specs/wrapper-array.spec.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/specs/wrapper-array.spec.js b/test/specs/wrapper-array.spec.js index 590210a6d..dec53d3c9 100644 --- a/test/specs/wrapper-array.spec.js +++ b/test/specs/wrapper-array.spec.js @@ -1,13 +1,17 @@ +import { Wrapper, WrapperArray } from '~vue/test-utils' import { compileToFunctions } from 'vue-template-compiler' 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 +64,13 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => { 'isVueInstance', 'name', 'props', + 'setChecked', 'setComputed', 'setMethods', 'setData', 'setProps', + 'setSelected', + 'setValue', 'trigger', 'update', 'destroy' @@ -93,10 +100,12 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => { 'isEmpty', 'isVisible', 'isVueInstance', + 'setChecked', 'setComputed', 'setMethods', 'setData', 'setProps', + 'setValue', 'trigger', 'update', 'destroy' From 96cc59e164179b9d150141544fa071014949dd5d Mon Sep 17 00:00:00 2001 From: 38elements Date: Sun, 5 Aug 2018 16:38:32 +0900 Subject: [PATCH 2/2] fix: lint --- test/specs/wrapper-array.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/specs/wrapper-array.spec.js b/test/specs/wrapper-array.spec.js index dec53d3c9..8e816c020 100644 --- a/test/specs/wrapper-array.spec.js +++ b/test/specs/wrapper-array.spec.js @@ -1,5 +1,4 @@ import { Wrapper, WrapperArray } from '~vue/test-utils' -import { compileToFunctions } from 'vue-template-compiler' import { describeWithShallowAndMount } from '~resources/utils' describeWithShallowAndMount('WrapperArray', mountingMethod => {