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.

File typescript VueCore 3 imports

Entity Profile

Dependency Diagram

graph LR
  24078870_a82b_9ccc_b5de_ec30a4e12954["watch.spec.ts"]
  09b3d58b_2586_2d23_1760_3ec3fe090d46["test-object-option.ts"]
  24078870_a82b_9ccc_b5de_ec30a4e12954 --> 09b3d58b_2586_2d23_1760_3ec3fe090d46
  4a7600ac_90db_8739_d900_439c1c18fef7["testObjectOption"]
  24078870_a82b_9ccc_b5de_ec30a4e12954 --> 4a7600ac_90db_8739_d900_439c1c18fef7
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  24078870_a82b_9ccc_b5de_ec30a4e12954 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  style 24078870_a82b_9ccc_b5de_ec30a4e12954 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 VueCore 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: VueCore, 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