Skip to content

Commit

Permalink
test(reactivity): should not observe well-known symbol keyed properti…
Browse files Browse the repository at this point in the history
…es in has operation (#9174)
  • Loading branch information
chenfan0 authored Jun 6, 2024
1 parent 8d606c4 commit 71c2c0a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/reactivity/__tests__/effect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 71c2c0a

Please sign in to comment.