fix(reactivity): ensure that shallow and normal proxies are tracked seperately (close #2843) (#2851)
fix #2843
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isReactive, isReadonly, shallowReadonly } from '../src'
|
||||
import { isReactive, isReadonly, readonly, shallowReadonly } from '../src'
|
||||
|
||||
describe('reactivity/shallowReadonly', () => {
|
||||
test('should not make non-reactive properties reactive', () => {
|
||||
@@ -27,6 +27,16 @@ describe('reactivity/shallowReadonly', () => {
|
||||
).not.toHaveBeenWarned()
|
||||
})
|
||||
|
||||
// #2843
|
||||
test('should differentiate from normal readonly calls', async () => {
|
||||
const original = { foo: {} }
|
||||
const shallowProxy = shallowReadonly(original)
|
||||
const reactiveProxy = readonly(original)
|
||||
expect(shallowProxy).not.toBe(reactiveProxy)
|
||||
expect(isReadonly(shallowProxy.foo)).toBe(false)
|
||||
expect(isReadonly(reactiveProxy.foo)).toBe(true)
|
||||
})
|
||||
|
||||
describe('collection/Map', () => {
|
||||
;[Map, WeakMap].forEach(Collection => {
|
||||
test('should make the map/weak-map readonly', () => {
|
||||
|
||||
Reference in New Issue
Block a user