Przeglądaj źródła

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

chenfan 1 rok temu
rodzic
commit
71c2c0af74
1 zmienionych plików z 16 dodań i 0 usunięć
  1. 16 0
      packages/reactivity/__tests__/effect.spec.ts

+ 16 - 0
packages/reactivity/__tests__/effect.spec.ts

@@ -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