Skip to content

Commit 71c2c0a

Browse files
authored
test(reactivity): should not observe well-known symbol keyed properties in has operation (#9174)
1 parent 8d606c4 commit 71c2c0a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/reactivity/__tests__/effect.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,22 @@ describe('reactivity/effect', () => {
252252
expect(dummy).toBe(undefined)
253253
})
254254

255+
it('should not observe well-known symbol keyed properties in has operation', () => {
256+
const key = Symbol.isConcatSpreadable
257+
const obj = reactive({
258+
[key]: true,
259+
}) as any
260+
261+
const spy = vi.fn(() => {
262+
key in obj
263+
})
264+
effect(spy)
265+
expect(spy).toHaveBeenCalledTimes(1)
266+
267+
obj[key] = false
268+
expect(spy).toHaveBeenCalledTimes(1)
269+
})
270+
255271
it('should support manipulating an array while observing symbol keyed properties', () => {
256272
const key = Symbol()
257273
let dummy

0 commit comments

Comments
 (0)