Browse Source

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

pull/753/head
hareku 6 years ago
committed by GitHub
parent
commit
014acc13e9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      packages/reactivity/__tests__/ref.spec.ts

11
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({

Loading…
Cancel
Save