fix: shallowReadonly should keep reactive properties reactive

ref #552
This commit is contained in:
Evan You
2019-12-20 11:14:07 -05:00
parent 2dcdbca6e2
commit 0a4f306492
2 changed files with 70 additions and 56 deletions

View File

@@ -470,5 +470,13 @@ describe('reactivity/readonly', () => {
`Set operation on key "foo" failed: target is readonly.`
).not.toHaveBeenWarned()
})
test('should keep reactive properties reactive', () => {
const props: any = shallowReadonly({ n: reactive({ foo: 1 }) })
unlock()
props.n = reactive({ foo: 2 })
lock()
expect(isReactive(props.n)).toBe(true)
})
})
})