diff --git a/packages/reactivity/__tests__/reactive.spec.ts b/packages/reactivity/__tests__/reactive.spec.ts index 800171ef..cbc8c871 100644 --- a/packages/reactivity/__tests__/reactive.spec.ts +++ b/packages/reactivity/__tests__/reactive.spec.ts @@ -177,4 +177,13 @@ describe('reactivity/reactive', () => { }) expect(isReactive(obj.foo)).toBe(false) }) + + test('should not observe objects with __v_skip', () => { + const original = { + foo: 1, + __v_skip: true + } + const observed = reactive(original) + expect(isReactive(observed)).toBe(false) + }) }) diff --git a/packages/reactivity/__tests__/readonly.spec.ts b/packages/reactivity/__tests__/readonly.spec.ts index 12fb6d08..6e99c589 100644 --- a/packages/reactivity/__tests__/readonly.spec.ts +++ b/packages/reactivity/__tests__/readonly.spec.ts @@ -214,6 +214,7 @@ describe('reactivity/readonly', () => { const key2 = {} const original = new Collection([[key1, {}], [key2, {}]]) const wrapped: any = readonly(original) + expect(wrapped.size).toBe(2) for (const [key, value] of wrapped) { expect(isReadonly(key)).toBe(true) expect(isReadonly(value)).toBe(true) @@ -267,6 +268,7 @@ describe('reactivity/readonly', () => { test('should retrieve readonly values on iteration', () => { const original = new Collection([{}, {}]) const wrapped: any = readonly(original) + expect(wrapped.size).toBe(2) for (const value of wrapped) { expect(isReadonly(value)).toBe(true) } diff --git a/packages/reactivity/__tests__/ref.spec.ts b/packages/reactivity/__tests__/ref.spec.ts index e0929e53..952960ac 100644 --- a/packages/reactivity/__tests__/ref.spec.ts +++ b/packages/reactivity/__tests__/ref.spec.ts @@ -277,6 +277,12 @@ describe('reactivity/ref', () => { expect(dummyY).toBe(5) }) + test('toRefs pass a reactivity object', () => { + console.warn = jest.fn() + const obj = { x: 1 } + toRefs(obj) + expect(console.warn).toBeCalled() + }) test('customRef', () => { let value = 1 let _trigger: () => void