Skip to content

Commit 014acc1

Browse files
authored
test(reactivity): test for ref without init value (#746)
1 parent 9547c2b commit 014acc1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/reactivity/__tests__/ref.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ describe('reactivity/ref', () => {
3333
expect(dummy).toBe(2)
3434
})
3535

36+
it('should work without initial value', () => {
37+
const a = ref()
38+
let dummy
39+
effect(() => {
40+
dummy = a.value
41+
})
42+
expect(dummy).toBe(undefined)
43+
a.value = 2
44+
expect(dummy).toBe(2)
45+
})
46+
3647
it('should work like a normal property when nested in a reactive object', () => {
3748
const a = ref(1)
3849
const obj = reactive({

0 commit comments

Comments
 (0)