test(reactivity): 100% reactivity coverage (#1299)
This commit is contained in:
parent
3fafc3b3ac
commit
426803046f
@ -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)
|
||||
})
|
||||
})
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user