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

directive.spec.ts — vue Source File

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

File typescript 3 imports

Entity Profile

Dependency Diagram

graph LR
  75c268a8_b574_16bb_003a_e3ba3ee95fac["directive.spec.ts"]
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  75c268a8_b574_16bb_003a_e3ba3ee95fac --> c5601857_7faf_30c6_efca_20de90db006c
  b0751bbf_7c2c_dfea_301f_dc2a72bb6e6c["patch"]
  75c268a8_b574_16bb_003a_e3ba3ee95fac --> b0751bbf_7c2c_dfea_301f_dc2a72bb6e6c
  f6868225_acf7_afdc_ebd3_15704ddb6566["vnode"]
  75c268a8_b574_16bb_003a_e3ba3ee95fac --> f6868225_acf7_afdc_ebd3_15704ddb6566
  style 75c268a8_b574_16bb_003a_e3ba3ee95fac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import { patch } from 'web/runtime/patch'
import VNode from 'core/vdom/vnode'

describe('vdom directive module', () => {
  it('should work', () => {
    const directive1 = {
      bind: vi.fn(),
      update: vi.fn(),
      unbind: vi.fn()
    }
    const vm = new Vue({ directives: { directive1 } })
    // create
    const vnode1 = new VNode('div', {}, [
      new VNode(
        'p',
        {
          directives: [
            {
              name: 'directive1',
              value: 'hello',
              arg: 'arg1',
              modifiers: { modifier1: true }
            }
          ]
        },
        undefined,
        'hello world',
        undefined,
        vm
      )
    ])
    patch(null, vnode1)
    expect(directive1.bind).toHaveBeenCalled()
    // update
    const vnode2 = new VNode('div', {}, [
      new VNode(
        'p',
        {
          directives: [
            {
              name: 'directive1',
              value: 'world',
              arg: 'arg1',
              modifiers: { modifier1: true }
            }
          ]
        },
        undefined,
        'hello world',
        undefined,
        vm
      )
    ])
    patch(vnode1, vnode2)
    expect(directive1.update).toHaveBeenCalled()
    // destroy
    const vnode3 = new VNode('div')
    patch(vnode2, vnode3)
    expect(directive1.unbind).toHaveBeenCalled()
  })
})

Dependencies

  • patch
  • vnode
  • vue

Frequently Asked Questions

What does directive.spec.ts do?
directive.spec.ts is a source file in the vue codebase, written in typescript.
What does directive.spec.ts depend on?
directive.spec.ts imports 3 module(s): patch, vnode, vue.
Where is directive.spec.ts in the architecture?
directive.spec.ts is located at test/unit/modules/vdom/modules/directive.spec.ts (directory: test/unit/modules/vdom/modules).

Analyze Your Own Codebase

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

Try Supermodel Free