Skip to content

Commit 15592f0

Browse files
committed
test for v-with two way binding
1 parent 47107c1 commit 15592f0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/unit/specs/directives/with_spec.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if (_.inBrowser) {
5353
a: 'A'
5454
}
5555
},
56-
template: '<div v-component="test" v-with="testt:test,bb:b"></div>',
56+
template: '<div v-component="test" v-with="testt:test,bb:b" v-ref="child"></div>',
5757
components: {
5858
test: {
5959
template: '{{testt.a}} {{bb}}'
@@ -76,7 +76,16 @@ if (_.inBrowser) {
7676
}
7777
_.nextTick(function () {
7878
expect(el.firstChild.textContent).toBe('AAAA BBB')
79-
done()
79+
// test two-way
80+
vm.$.child.bb = 'B'
81+
vm.$.child.testt = { a: 'A' }
82+
_.nextTick(function () {
83+
expect(el.firstChild.textContent).toBe('A B')
84+
expect(vm.test.a).toBe('A')
85+
expect(vm.test).toBe(vm.$.child.testt)
86+
expect(vm.b).toBe('B')
87+
done()
88+
})
8089
})
8190
})
8291
})

0 commit comments

Comments
 (0)