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
  249ce4cf_5552_e483_b672_2f867fd73ae2["apiWatch.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  249ce4cf_5552_e483_b672_2f867fd73ae2 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  d970b406_3424_b00e_55dd_82e98ab5aac2["v3"]
  249ce4cf_5552_e483_b672_2f867fd73ae2 --> d970b406_3424_b00e_55dd_82e98ab5aac2
  6d8f8976_7066_720b_0d45_45fe42921eaf["util"]
  249ce4cf_5552_e483_b672_2f867fd73ae2 --> 6d8f8976_7066_720b_0d45_45fe42921eaf
  eb7174f6_f021_7b84_3862_bd9a0db1b30a["observer"]
  249ce4cf_5552_e483_b672_2f867fd73ae2 --> eb7174f6_f021_7b84_3862_bd9a0db1b30a
  64c87498_c46a_6944_ab9d_8e45519852a8["component"]
  249ce4cf_5552_e483_b672_2f867fd73ae2 --> 64c87498_c46a_6944_ab9d_8e45519852a8
  style 249ce4cf_5552_e483_b672_2f867fd73ae2 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