From: hareku Date: Fri, 21 Feb 2020 13:44:41 +0000 (+0900) Subject: test(reactivity): test for ref without init value (#746) X-Git-Tag: v3.0.0-alpha.6~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=014acc13e95133ef022ad051683a39e8f15388fb;p=thirdparty%2Fvuejs%2Fcore.git test(reactivity): test for ref without init value (#746) --- diff --git a/packages/reactivity/__tests__/ref.spec.ts b/packages/reactivity/__tests__/ref.spec.ts index b822e801bb..84f1c8dff5 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({