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

apiWatch.spec.ts — vue Source File

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

File typescript 5 imports

Entity Profile

Dependency Diagram

graph LR
  f4f3b946_8c55_ee53_6a9f_d4f966892144["apiWatch.spec.ts"]
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  f4f3b946_8c55_ee53_6a9f_d4f966892144 --> c5601857_7faf_30c6_efca_20de90db006c
  6a13c450_be5a_326d_7e2d_c1d429be7e83["v3"]
  f4f3b946_8c55_ee53_6a9f_d4f966892144 --> 6a13c450_be5a_326d_7e2d_c1d429be7e83
  8a5fb776_a8f4_ce8a_8549_67af07f2e1e9["util"]
  f4f3b946_8c55_ee53_6a9f_d4f966892144 --> 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9
  cf1af910_0651_68a5_bdd0_87db5433e4bf["observer"]
  f4f3b946_8c55_ee53_6a9f_d4f966892144 --> cf1af910_0651_68a5_bdd0_87db5433e4bf
  907f4994_ea28_43b1_7976_0db9f0e97637["component"]
  f4f3b946_8c55_ee53_6a9f_d4f966892144 --> 907f4994_ea28_43b1_7976_0db9f0e97637
  style f4f3b946_8c55_ee53_6a9f_d4f966892144 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import {
  watch,
  watchEffect,
  watchPostEffect,
  watchSyncEffect,
  reactive,
  computed,
  ref,
  triggerRef,
  shallowRef,
  h,
  onMounted,
  getCurrentInstance,
  effectScope,
  TrackOpTypes,
  TriggerOpTypes,
  DebuggerEvent
} from 'v3'
import { nextTick } from 'core/util'
import { set } from 'core/observer'
import { Component } from 'types/component'

// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch

describe('api: watch', () => {
  it('effect', async () => {
    const state = reactive({ count: 0 })
    let dummy
    watchEffect(() => {
      dummy = state.count
    })
    expect(dummy).toBe(0)

    state.count++
    await nextTick()
    expect(dummy).toBe(1)
  })

  it('watching single source: getter', async () => {
    const state = reactive({ count: 0 })
    let dummy
    watch(
      () => state.count,
      (count, prevCount) => {
        dummy = [count, prevCount]
        // assert types
        count + 1
        if (prevCount) {
          prevCount + 1
        }
      }
    )
    state.count++
    await nextTick()
    expect(dummy).toMatchObject([1, 0])
  })

  it('watching single source: ref', async () => {
    const count = ref(0)
// ... (1175 more lines)

Dependencies

  • component
  • observer
  • util
  • v3
  • vue

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free