fix(reactivity): Map/Set identity methods should work even if raw value contains reactive entries

fix #799
This commit is contained in:
Evan You
2020-03-06 11:10:02 -05:00
parent 16f9e63951
commit cc69fd72e3
5 changed files with 63 additions and 13 deletions

View File

@@ -348,5 +348,19 @@ describe('reactivity/collections', () => {
map.set('foo', NaN)
expect(mapSpy).toHaveBeenCalledTimes(1)
})
it('should work with reactive keys in raw map', () => {
const raw = new Map()
const key = reactive({})
raw.set(key, 1)
const map = reactive(raw)
expect(map.has(key)).toBe(true)
expect(map.get(key)).toBe(1)
expect(map.delete(key)).toBe(true)
expect(map.has(key)).toBe(false)
expect(map.get(key)).toBeUndefined()
})
})
})