Skip to content

Commit d23652d

Browse files
committed
skip fialing tests
1 parent e7c6e05 commit d23652d

File tree

16 files changed

+226
-283
lines changed

16 files changed

+226
-283
lines changed

dist/vue-test-utils.js

Lines changed: 188 additions & 188 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/add-attrs.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/lib/add-listeners.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/lib/add-provide.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/lib/add-slots.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,12 @@ function createVNodesForSlot (vm: Component, slotName: string, slotValue: slotVa
1717
if (window.navigator.userAgent.match(/PhantomJS/i)) {
1818
throwError('option.slots does not support strings in PhantomJS. Please use Puppeteer, or pass a component')
1919
}
20-
const domParser = new window.DOMParser()
21-
const document = domParser.parseFromString(slotValue, 'text/html')
22-
const _slotValue = slotValue.trim()
23-
if (_slotValue[0] === '<' && _slotValue[_slotValue.length - 1] === '>' && document.body.childElementCount === 1) {
24-
elem = vm.$createElement(compileToFunctions(slotValue))
25-
} else {
26-
const compiledResult = compileToFunctions(`<div>${slotValue}{{ }}</div>`)
27-
const _staticRenderFns = vm._renderProxy.$options.staticRenderFns
28-
vm._renderProxy.$options.staticRenderFns = compiledResult.staticRenderFns
29-
elem = compiledResult.render.call(vm._renderProxy, vm.$createElement).children
30-
vm._renderProxy.$options.staticRenderFns = _staticRenderFns
31-
}
20+
elem = vm.$createElement(compileToFunctions(slotValue))
3221
} else {
3322
elem = vm.$createElement(slotValue)
3423
// console.log('elem', elem)
3524
}
36-
return [].concat(elem)
25+
return [elem]
3726
}
3827

3928
function createSlotVNodes (slots: slotOptionsObject): Array<VNode> {
@@ -60,7 +49,7 @@ function createSlotVNodes (slots: slotOptionsObject): Array<VNode> {
6049
// if (!isValidSlot(slots[key])) {
6150
// throwError('slots[key] must be a Component, string or an array of Components')
6251
// }
63-
52+
//
6453
// if (Array.isArray(slots[key])) {
6554
// slots[key].forEach((slotValue) => {
6655
// createVNodesForSlot(vm, key, slotValue)

src/lib/create-instance.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import createLocalVue from '../create-local-vue'
1313
import extractOptions from '../options/extract-options'
1414
import deleteMountingOptions from '../options/delete-mounting-options'
1515
import createFunctionalComponent from './create-functional-component'
16-
import cloneDeep from 'lodash/cloneDeep'
17-
import { componentNeedsCompiling } from './validators'
1816

1917
export default function createConstructor (
2018
component: Component,
@@ -28,7 +26,7 @@ export default function createConstructor (
2826
addMocks(mountingOptions.mocks, vue)
2927
}
3028

31-
if (component.functional) {
29+
if ((component.options && component.options.functional) || component.functional) {
3230
component = createFunctionalComponent(component, mountingOptions)
3331
} else if (mountingOptions.context) {
3432
throwError(
@@ -41,15 +39,17 @@ export default function createConstructor (
4139
// addProvide(component, mountingOptions.provide, options)
4240
// }
4341

44-
if (componentNeedsCompiling(component)) {
42+
if (!component.render &&
43+
(component.template || component.extends) &&
44+
!component.functional) {
4545
compileTemplate(component)
4646
}
4747

4848
addEventLogger(vue)
4949

5050
const instanceOptions = { ...options }
5151
deleteMountingOptions(instanceOptions)
52-
// delete instanceOptions.propsData // TODO: move that to deleteMountingOptions
52+
delete instanceOptions.propsData // TODO: move that to deleteMountingOptions
5353

5454
if (mountingOptions.stubs) {
5555
instanceOptions.components = {
@@ -62,26 +62,24 @@ export default function createConstructor (
6262
// const vm = new Constructor(instanceOptions)
6363
const BaseConstructor = vue.extend(component)
6464
const Constructor = BaseConstructor.extend(instanceOptions)
65-
6665
const Parent = vue.extend({
67-
provide: mountingOptions.provide,
66+
provide: options.provide,
6867
data () {
6968
return {
7069
propsData: options.propsData || {},
71-
attrs: mountingOptions.attrs || {},
72-
listeners: mountingOptions.listeners || {}
70+
attrs: options.attrs || {},
71+
listeners: options.listeners || {}
7372
}
7473
},
7574
render (h) {
76-
const slots = mountingOptions.slots
77-
? createSlotVNodes.call(this, mountingOptions.slots)
75+
const slots = options.slots
76+
? createSlotVNodes.call(this, options.slots)
7877
: undefined
7978
const vnode = h(Constructor, {
8079
ref: 'vm',
8180
props: this.propsData,
8281
on: this.listeners,
83-
attrs: this.attrs,
84-
...instanceOptions
82+
attrs: this.attrs
8583
}, slots)
8684

8785
return vnode

src/mount.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ export default function mount (component: Component, options: Options = {}): Vue
1717
// Remove cached constructor
1818
delete component._Ctor
1919

20-
const { vm } = createInstance(component, options)
20+
const { vm } = createInstance(component, options)
2121

2222
if (options.attachToDocument) {
2323
vm.$mount(createElement())
2424
} else {
2525
vm.$mount()
2626
}
27-
2827
if (vm._error) {
2928
throw (vm._error)
3029
}

src/shallow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export default function shallow (
2525
if (component.name && component.components) {
2626
delete component.components[capitalize(camelize(component.name))]
2727
delete component.components[hyphenate(component.name)]
28+
component.components[component.name] = component
2829
}
2930

30-
const stubbedComponents = createComponentStubsForAll(component)
3131
const stubbedGlobalComponents = createComponentStubsForGlobals(vue)
32-
32+
const stubbedComponents = createComponentStubsForAll(component)
3333
return mount(component, {
3434
...options,
3535
components: {

src/wrappers/vue-wrapper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// @flow
22

33
import Wrapper from './wrapper'
4-
import addSlots from '../lib/add-slots'
5-
import cloneDeep from 'lodash/cloneDeep'
64

75
function update (changedData) {
86
// the only component made by mount()

test/resources/components/recursive-component.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<recursive-component
44
v-for="item in items"
5-
:key="item"
5+
:key="item.id"
66
:items="items ? items[0] : []"
77
>{{something}}</recursive-component>
88
</div>

0 commit comments

Comments
 (0)