fix(reactivity): should delete observe value (#598)

fix #597
This commit is contained in:
likui
2020-01-14 06:11:49 +08:00
committed by Evan You
parent 30aae0b4df
commit 63a6563106
5 changed files with 60 additions and 0 deletions

View File

@@ -26,6 +26,22 @@ describe('reactivity/collections', () => {
expect(dummy).toBe(undefined)
})
it('should observe mutations with observed value as key', () => {
let dummy
const key = reactive({})
const value = reactive({})
const map = reactive(new Map())
effect(() => {
dummy = map.get(key)
})
expect(dummy).toBe(undefined)
map.set(key, value)
expect(dummy).toBe(value)
map.delete(key)
expect(dummy).toBe(undefined)
})
it('should observe size mutations', () => {
let dummy
const map = reactive(new Map())