]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(reactivity): should not observe well-known symbol keyed properties in has operat...
authorchenfan <83797583+chenfan0@users.noreply.github.com>
Thu, 6 Jun 2024 09:41:15 +0000 (17:41 +0800)
committerGitHub <noreply@github.com>
Thu, 6 Jun 2024 09:41:15 +0000 (17:41 +0800)
packages/reactivity/__tests__/effect.spec.ts

index bd26934f1cee760fac7a4a2c491703a580df4e12..422852fd5ee544382dbf55fa0d6936545b3616d1 100644 (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