Skip to content

Commit 1f8f4f4

Browse files
committed
Test case for vuejs#6826
1 parent 9caed00 commit 1f8f4f4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: test/unit/features/directives/once.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ describe('Directive v-once', () => {
1313
}).then(done)
1414
})
1515

16+
it('should correctly render list items', done => {
17+
const list = ['foo', 'bar']
18+
const MyComponent = Vue.extend({
19+
props: ['item'],
20+
template: '<div v-once>{{ item }}</div>',
21+
})
22+
const vm = new Vue({
23+
components: {
24+
MyComponent
25+
},
26+
template: '<ul><my-component v-for="item, index in list" :key="index" :item="item"></my-component></ul>',
27+
data: { list }
28+
}).$mount()
29+
list.forEach((item, index) => expect(vm.$el.children[index].innerHTML).toBe(item))
30+
vm.list = ['quz', 'qux']
31+
waitForUpdate(() => {
32+
list.forEach((item, index) => expect(vm.$el.children[index].innerHTML).toBe(item))
33+
}).then(done)
34+
})
35+
1636
it('should not rerender self and child component', done => {
1737
const vm = new Vue({
1838
template: `

0 commit comments

Comments
 (0)