Home / File/ ref.spec.ts — vue Source File

ref.spec.ts — vue Source File

Architecture documentation for ref.spec.ts, a typescript file in the vue codebase. 2 imports, 0 dependents.

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  f49bf6d1_8860_df3f_544a_a2aa32229d62["ref.spec.ts"]
  6a13c450_be5a_326d_7e2d_c1d429be7e83["v3"]
  f49bf6d1_8860_df3f_544a_a2aa32229d62 --> 6a13c450_be5a_326d_7e2d_c1d429be7e83
  3a63aff0_8a8f_7988_aef0_ae98d03fcf43["effect"]
  f49bf6d1_8860_df3f_544a_a2aa32229d62 --> 3a63aff0_8a8f_7988_aef0_ae98d03fcf43
  style f49bf6d1_8860_df3f_544a_a2aa32229d62 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
  ref,
  isRef,
  shallowRef,
  unref,
  triggerRef,
  toRef,
  toRefs,
  customRef,
  Ref,
  isReactive,
  isShallow,
  reactive,
  computed,
  readonly
} from 'v3'
import { effect } from 'v3/reactivity/effect'

describe('reactivity/ref', () => {
  it('should hold a value', () => {
    const a = ref(1)
    expect(a.value).toBe(1)
    a.value = 2
    expect(a.value).toBe(2)
  })

  it('should be reactive', () => {
    const a = ref(1)
    let dummy
    let calls = 0
    effect(() => {
      calls++
      dummy = a.value
    })
    expect(calls).toBe(1)
    expect(dummy).toBe(1)
    a.value = 2
    expect(calls).toBe(2)
    expect(dummy).toBe(2)
    // same value should not trigger
    a.value = 2
    expect(calls).toBe(2)
  })

  it('should make nested properties reactive', () => {
    const a = ref({
      count: 1
    })
    let dummy
    effect(() => {
      dummy = a.value.count
    })
    expect(dummy).toBe(1)
    a.value.count = 2
    expect(dummy).toBe(2)
  })

  it('should work without initial value', () => {
    const a = ref()
    let dummy
// ... (362 more lines)

Dependencies

  • effect
  • v3

Frequently Asked Questions

What does ref.spec.ts do?
ref.spec.ts is a source file in the vue codebase, written in typescript.
What does ref.spec.ts depend on?
ref.spec.ts imports 2 module(s): effect, v3.
Where is ref.spec.ts in the architecture?
ref.spec.ts is located at test/unit/features/v3/reactivity/ref.spec.ts (directory: test/unit/features/v3/reactivity).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free