test(reactivity): test for ref without init value (#746)
This commit is contained in:
parent
9547c2b93d
commit
014acc13e9
@ -33,6 +33,17 @@ describe('reactivity/ref', () => {
|
|||||||
expect(dummy).toBe(2)
|
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', () => {
|
it('should work like a normal property when nested in a reactive object', () => {
|
||||||
const a = ref(1)
|
const a = ref(1)
|
||||||
const obj = reactive({
|
const obj = reactive({
|
||||||
|
Loading…
Reference in New Issue
Block a user