From bcb62d1a001125bfac91c1dd4f8bd51ac42b5a0f Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 4 Jul 2022 10:39:36 +0800 Subject: [PATCH] test: test case for #12597 --- .../features/v3/reactivity/shallowReactive.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/features/v3/reactivity/shallowReactive.spec.ts b/test/unit/features/v3/reactivity/shallowReactive.spec.ts index 5d86bb85d82..1e2a0cbf808 100644 --- a/test/unit/features/v3/reactivity/shallowReactive.spec.ts +++ b/test/unit/features/v3/reactivity/shallowReactive.spec.ts @@ -1,7 +1,9 @@ import { isReactive, + isRef, isShallow, reactive, + ref, shallowReactive, shallowReadonly } from 'v3' @@ -34,6 +36,15 @@ describe('shallowReactive', () => { expect(isReactive(r.foo.bar)).toBe(false) }) + // #12597 + test('should not unwrap refs', () => { + const foo = shallowReactive({ + bar: ref(123) + }) + expect(isRef(foo.bar)).toBe(true) + expect(foo.bar.value).toBe(123) + }) + // @discrepancy no shallow/non-shallow versions from the same source - // cannot support this without real proxies // #2843