mirror of https://github.com/vuejs/vue.git
fix tests
This commit is contained in:
parent
aacf90a13f
commit
2268c51936
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ import {
|
|||
remove,
|
||||
replace,
|
||||
createAnchor,
|
||||
warn,
|
||||
findVmFromFrag
|
||||
warn
|
||||
} from '../../util/index'
|
||||
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -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__
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>',
|
||||
|
|
|
|||
Loading…
Reference in New Issue