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
  267d79f5_8f08_897a_c684_18f6fdc9839f["directive.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  267d79f5_8f08_897a_c684_18f6fdc9839f --> db9e7bef_009d_3918_6e7d_543a36a38d75
  22f6e3b3_fd99_35d7_94cf_527e68438cb3["patch"]
  267d79f5_8f08_897a_c684_18f6fdc9839f --> 22f6e3b3_fd99_35d7_94cf_527e68438cb3
  973389ac_8625_30a3_53ce_b1b48fae58c5["vnode"]
  267d79f5_8f08_897a_c684_18f6fdc9839f --> 973389ac_8625_30a3_53ce_b1b48fae58c5
  style 267d79f5_8f08_897a_c684_18f6fdc9839f 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