test(reactivity): test for ref without init value (#746)

This commit is contained in:
hareku 2020-02-21 22:44:41 +09:00 committed by GitHub
parent 9547c2b93d
commit 014acc13e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,17 @@ describe('reactivity/ref', () => {
expect(dummy).toBe(2) expect(dummy).toBe(2)
}) })
it('should work without initial value', () => {
const a = ref()
let dummy
effect(() => {
dummy = a.value
})
expect(dummy).toBe(undefined)
a.value = 2
expect(dummy).toBe(2)
})
it('should work like a normal property when nested in a reactive object', () => { it('should work like a normal property when nested in a reactive object', () => {
const a = ref(1) const a = ref(1)
const obj = reactive({ const obj = reactive({