From: chenfan <83797583+chenfan0@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:41:15 +0000 (+0800) Subject: test(reactivity): should not observe well-known symbol keyed properties in has operat... X-Git-Tag: v3.4.28~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71c2c0af74090639d112b2f74e10baad232983e2;p=thirdparty%2Fvuejs%2Fcore.git test(reactivity): should not observe well-known symbol keyed properties in has operation (#9174) --- diff --git a/packages/reactivity/__tests__/effect.spec.ts b/packages/reactivity/__tests__/effect.spec.ts index bd26934f1c..422852fd5e 100644 --- a/packages/reactivity/__tests__/effect.spec.ts +++ b/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