mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
test: add test for observer lazy getter invocation
This commit is contained in:
parent
7392dfcc1d
commit
aeebf0de90
@ -355,4 +355,18 @@ describe('Observer', () => {
|
||||
expect(obj.__ob__ instanceof Observer).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('should lazy invoke existing getters', () => {
|
||||
const obj = {}
|
||||
let called = false
|
||||
Object.defineProperty(obj, 'getterProp', {
|
||||
enumerable: true,
|
||||
get: () => {
|
||||
called = true
|
||||
return 'some value'
|
||||
}
|
||||
})
|
||||
observe(obj)
|
||||
expect(called).toBe(false)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user