Skip to content

Commit bfe0184

Browse files
committed
Test priorities.
Prevent error like vuejs#2573 from happening again.
1 parent 59d9979 commit bfe0184

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,28 @@ describe('v-for', function () {
107107
expect(el.innerHTML).toBe('<div>aaa a</div><div>bbb b</div>')
108108
})
109109

110+
it('check priorities: v-if before v-for', function () {
111+
new Vue({
112+
el: el,
113+
data: {
114+
items: [1, 2, 3]
115+
},
116+
template: '<div v-if="item < 3" v-for="item in items">{{item}}</div>'
117+
})
118+
expect(el.textContent).toBe('12')
119+
})
120+
121+
it('check priorities: v-if after v-for', function () {
122+
new Vue({
123+
el: el,
124+
data: {
125+
items: [1, 2, 3]
126+
},
127+
template: '<div v-for="item in items" v-if="item < 3">{{item}}</div>'
128+
})
129+
expect(el.textContent).toBe('12')
130+
})
131+
110132
it('component', function (done) {
111133
var vm = new Vue({
112134
el: el,

0 commit comments

Comments
 (0)