From 014acc13e95133ef022ad051683a39e8f15388fb Mon Sep 17 00:00:00 2001 From: hareku Date: Fri, 21 Feb 2020 22:44:41 +0900 Subject: [PATCH] test(reactivity): test for ref without init value (#746) --- packages/reactivity/__tests__/ref.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/reactivity/__tests__/ref.spec.ts b/packages/reactivity/__tests__/ref.spec.ts index b822e801..84f1c8df 100644 --- a/packages/reactivity/__tests__/ref.spec.ts +++ b/packages/reactivity/__tests__/ref.spec.ts @@ -33,6 +33,17 @@ describe('reactivity/ref', () => { 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', () => { const a = ref(1) const obj = reactive({