test(reactivity): should not observe well-known symbol keyed properties in has operation (#9174)

This commit is contained in:
chenfan 2024-06-06 17:41:15 +08:00 committed by GitHub
parent 8d606c44ec
commit 71c2c0af74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -252,6 +252,22 @@ describe('reactivity/effect', () => {
expect(dummy).toBe(undefined)
})
it('should not observe well-known symbol keyed properties in has operation', () => {
const key = Symbol.isConcatSpreadable
const obj = reactive({
[key]: true,
}) as any
const spy = vi.fn(() => {
key in obj
})
effect(spy)
expect(spy).toHaveBeenCalledTimes(1)
obj[key] = false
expect(spy).toHaveBeenCalledTimes(1)
})
it('should support manipulating an array while observing symbol keyed properties', () => {
const key = Symbol()
let dummy