test(reactive): add test case of mutation in original reflecting in observed value (#2118)
This commit is contained in:
parent
05df696a2b
commit
848ccf56fb
@ -113,6 +113,19 @@ describe('reactivity/reactive', () => {
|
||||
expect('foo' in original).toBe(false)
|
||||
})
|
||||
|
||||
test('original value change should reflect in observed value (Object)', () => {
|
||||
const original: any = { foo: 1 }
|
||||
const observed = reactive(original)
|
||||
// set
|
||||
original.bar = 1
|
||||
expect(original.bar).toBe(1)
|
||||
expect(observed.bar).toBe(1)
|
||||
// delete
|
||||
delete original.foo
|
||||
expect('foo' in original).toBe(false)
|
||||
expect('foo' in observed).toBe(false)
|
||||
})
|
||||
|
||||
test('setting a property with an unobserved value should wrap with reactive', () => {
|
||||
const observed = reactive<{ foo?: object }>({})
|
||||
const raw = {}
|
||||
|
Loading…
Reference in New Issue
Block a user