MCPcopy
hub / github.com/vuejs/core / assertTriggerRef

Function assertTriggerRef

packages/reactivity/__tests__/ref.spec.ts:392–402  ·  view source on GitHub ↗
(key: unknown)

Source from the content-addressed store, hash-verified

390
391 test('triggerRef on toRef created from array coerces property keys', () => {
392 const assertTriggerRef = (key: unknown) => {
393 const array = reactive(['a'])
394 const first = toRef(array as any, key as any)
395 const fn = vi.fn()
396
397 effect(() => fn(first.value))
398 expect(fn).toHaveBeenCalledTimes(1)
399
400 triggerRef(first)
401 expect(fn).toHaveBeenCalledTimes(2)
402 }
403
404 assertTriggerRef(0)
405 // JS coerces non-symbol property keys like [0] to the string "0".

Callers 1

ref.spec.tsFile · 0.85

Calls 5

triggerRefFunction · 0.90
reactiveFunction · 0.85
toRefFunction · 0.85
effectFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected