feat(reactivity): add isShallow api

This commit is contained in:
Evan You
2022-01-18 09:17:22 +08:00
parent 0c06c748a5
commit 9fda9411ec
9 changed files with 39 additions and 15 deletions

View File

@@ -1,4 +1,10 @@
import { isReactive, reactive, shallowReactive } from '../src/reactive'
import {
isReactive,
isShallow,
reactive,
shallowReactive,
shallowReadonly
} from '../src/reactive'
import { effect } from '../src/effect'
@@ -24,6 +30,11 @@ describe('shallowReactive', () => {
expect(isReactive(reactiveProxy.foo)).toBe(true)
})
test('isShallow', () => {
expect(isShallow(shallowReactive({}))).toBe(true)
expect(isShallow(shallowReadonly({}))).toBe(true)
})
describe('collections', () => {
test('should be reactive', () => {
const shallowSet = shallowReactive(new Set())