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

watch.spec.ts — vue Source File

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

Entity Profile

Dependency Diagram

graph LR
  22a524f6_2fb1_68ba_94b1_d743c176e408["watch.spec.ts"]
  4ef3cec1_7e9c_23bb_5e9b_f118e8ebdf99["test-object-option.ts"]
  22a524f6_2fb1_68ba_94b1_d743c176e408 --> 4ef3cec1_7e9c_23bb_5e9b_f118e8ebdf99
  830d85be_ea2f_f50c_75f1_dd6812fb608f["testObjectOption"]
  22a524f6_2fb1_68ba_94b1_d743c176e408 --> 830d85be_ea2f_f50c_75f1_dd6812fb608f
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  22a524f6_2fb1_68ba_94b1_d743c176e408 --> c5601857_7faf_30c6_efca_20de90db006c
  style 22a524f6_2fb1_68ba_94b1_d743c176e408 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import testObjectOption from '../../../helpers/test-object-option'

describe('Options watch', () => {
  let spy
  beforeEach(() => {
    spy = vi.fn()
  })

  testObjectOption('watch')

  it('basic usage', done => {
    const vm = new Vue({
      data: {
        a: 1
      },
      watch: {
        a: spy
      }
    })
    expect(spy).not.toHaveBeenCalled()
    vm.a = 2
    expect(spy).not.toHaveBeenCalled()
    waitForUpdate(() => {
      expect(spy).toHaveBeenCalledWith(2, 1)
    }).then(done)
  })

  it('string method name', done => {
    const vm = new Vue({
      data: {
        a: 1
      },
      watch: {
        a: 'onChange'
      },
      methods: {
        onChange: spy
      }
    })
    expect(spy).not.toHaveBeenCalled()
    vm.a = 2
    expect(spy).not.toHaveBeenCalled()
    waitForUpdate(() => {
      expect(spy).toHaveBeenCalledWith(2, 1)
    }).then(done)
  })

  it('multiple cbs (after option merge)', done => {
    const spy1 = vi.fn()
    const Test = Vue.extend({
      watch: {
        a: spy1
      }
    })
    const vm = new Test({
      data: { a: 1 },
      watch: {
        a: spy
      }
// ... (120 more lines)

Domain

Frequently Asked Questions

What does watch.spec.ts do?
watch.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the CompilerSFC domain.
What does watch.spec.ts depend on?
watch.spec.ts imports 3 module(s): test-object-option.ts, testObjectOption, vue.
Where is watch.spec.ts in the architecture?
watch.spec.ts is located at test/unit/features/options/watch.spec.ts (domain: CompilerSFC, directory: test/unit/features/options).

Analyze Your Own Codebase

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

Try Supermodel Free