Skip to content

Commit 2268c51

Browse files
committed
fix tests
1 parent aacf90a commit 2268c51

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

src/directives/public/for.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ import {
1616
def,
1717
cancellable,
1818
isArray,
19-
isPlainObject,
20-
findVmFromFrag
19+
isPlainObject
2120
} from '../../util/index'
2221

2322
let uid = 0
@@ -658,4 +657,22 @@ if (process.env.NODE_ENV !== 'production') {
658657
}
659658
}
660659

660+
/**
661+
* Find a vm from a fragment.
662+
*
663+
* @param {Fragment} frag
664+
* @return {Vue|undefined}
665+
*/
666+
667+
function findVmFromFrag (frag) {
668+
let node = frag.node
669+
// handle multi-node frag
670+
if (frag.end) {
671+
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
672+
node = node.nextSibling
673+
}
674+
}
675+
return node.__vue__
676+
}
677+
661678
export default vFor

src/directives/public/if.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
remove,
66
replace,
77
createAnchor,
8-
warn,
9-
findVmFromFrag
8+
warn
109
} from '../../util/index'
1110

1211
export default {

src/util/dom.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -449,21 +449,3 @@ export function getOuterHTML (el) {
449449
return container.innerHTML
450450
}
451451
}
452-
453-
/**
454-
* Find a vm from a fragment.
455-
*
456-
* @param {Fragment} frag
457-
* @return {Vue|undefined}
458-
*/
459-
460-
export function findVmFromFrag (frag) {
461-
let node = frag.node
462-
// handle multi-node frag
463-
if (frag.end) {
464-
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
465-
node = node.nextSibling
466-
}
467-
}
468-
return node.__vue__
469-
}

test/unit/specs/directives/public/for/for_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ describe('v-for', function () {
10021002
expect('Frozen v-for objects cannot be automatically tracked').toHaveBeenWarned()
10031003
})
10041004

1005-
it('warn v-if and v-for mixed usage', () => {
1005+
it('warn v-if and v-for mixed usage', function () {
10061006
new Vue({
10071007
el: document.createElement('div'),
10081008
template: '<div v-for="item in items" v-if="ok"></div>',

0 commit comments

Comments
 (0)