|
@@ -286,6 +286,23 @@ describe('Watcher', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it('deep watch with circular references', function (done) {
|
|
|
|
|
+ new Watcher(vm, 'b', spy, {
|
|
|
|
|
+ deep: true
|
|
|
|
|
+ })
|
|
|
|
|
+ Vue.set(vm.b, '_', vm.b)
|
|
|
|
|
+ nextTick(function () {
|
|
|
|
|
+ expect(spy).toHaveBeenCalledWith(vm.b, vm.b)
|
|
|
|
|
+ expect(spy.calls.count()).toBe(1)
|
|
|
|
|
+ vm.b._.c = 1
|
|
|
|
|
+ nextTick(function () {
|
|
|
|
|
+ expect(spy).toHaveBeenCalledWith(vm.b, vm.b)
|
|
|
|
|
+ expect(spy.calls.count()).toBe(2)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it('fire change for prop addition/deletion in non-deep mode', function (done) {
|
|
it('fire change for prop addition/deletion in non-deep mode', function (done) {
|
|
|
new Watcher(vm, 'b', spy)
|
|
new Watcher(vm, 'b', spy)
|
|
|
Vue.set(vm.b, 'e', 123)
|
|
Vue.set(vm.b, 'e', 123)
|