test: test case for #12597

This commit is contained in:
Evan You 2022-07-04 10:39:36 +08:00
parent ff5acb12cf
commit bcb62d1a00

View File

@ -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