]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(reactivity): test for ref without init value (#746)
authorhareku <hareku908@gmail.com>
Fri, 21 Feb 2020 13:44:41 +0000 (22:44 +0900)
committerGitHub <noreply@github.com>
Fri, 21 Feb 2020 13:44:41 +0000 (14:44 +0100)
packages/reactivity/__tests__/ref.spec.ts

index b822e801bbf18db3a481a17e829131eb3e58ffdd..84f1c8dff5aa08b0f1fec3abbf8a57f8a0c580ae 100644 (file)
@@ -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({