fix tests

This commit is contained in:
Evan You 2016-09-27 15:45:13 -04:00
parent aacf90a13f
commit 2268c51936
4 changed files with 21 additions and 23 deletions

View File

@ -16,8 +16,7 @@ import {
def,
cancellable,
isArray,
isPlainObject,
findVmFromFrag
isPlainObject
} from '../../util/index'
let uid = 0
@ -658,4 +657,22 @@ if (process.env.NODE_ENV !== 'production') {
}
}
/**
* Find a vm from a fragment.
*
* @param {Fragment} frag
* @return {Vue|undefined}
*/
function findVmFromFrag (frag) {
let node = frag.node
// handle multi-node frag
if (frag.end) {
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
node = node.nextSibling
}
}
return node.__vue__
}
export default vFor

View File

@ -5,8 +5,7 @@ import {
remove,
replace,
createAnchor,
warn,
findVmFromFrag
warn
} from '../../util/index'
export default {

View File

@ -449,21 +449,3 @@ export function getOuterHTML (el) {
return container.innerHTML
}
}
/**
* Find a vm from a fragment.
*
* @param {Fragment} frag
* @return {Vue|undefined}
*/
export function findVmFromFrag (frag) {
let node = frag.node
// handle multi-node frag
if (frag.end) {
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
node = node.nextSibling
}
}
return node.__vue__
}

View File

@ -1002,7 +1002,7 @@ describe('v-for', function () {
expect('Frozen v-for objects cannot be automatically tracked').toHaveBeenWarned()
})
it('warn v-if and v-for mixed usage', () => {
it('warn v-if and v-for mixed usage', function () {
new Vue({
el: document.createElement('div'),
template: '<div v-for="item in items" v-if="ok"></div>',