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

use.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

graph LR
  9355ba84_0b52_ed8e_b1c7_262f0068dcc3["use.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  9355ba84_0b52_ed8e_b1c7_262f0068dcc3 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  style 9355ba84_0b52_ed8e_b1c7_262f0068dcc3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'

describe('Global API: use', () => {
  const def = {}
  const options = {}
  const pluginStub = {
    install: (Vue, opts) => {
      Vue.directive('plugin-test', def)
      expect(opts).toBe(options)
    }
  }

  it('should apply Object plugin', () => {
    Vue.use(pluginStub, options)
    expect(Vue.options.directives['plugin-test']).toBe(def)
    delete Vue.options.directives['plugin-test']
    expect(Vue.options.directives['plugin-test']).toBeUndefined()

    // should not double apply
    Vue.use(pluginStub, options)
    expect(Vue.options.directives['plugin-test']).toBeUndefined()
  })

  it('should apply Function plugin', () => {
    Vue.use(pluginStub.install, options)
    expect(Vue.options.directives['plugin-test']).toBe(def)
    delete Vue.options.directives['plugin-test']
  })

  it('should work on extended constructors without polluting the base', () => {
    const Ctor = Vue.extend({})
    Ctor.use(pluginStub, options)
    expect(Vue.options.directives['plugin-test']).toBeUndefined()
    expect(Ctor.options.directives['plugin-test']).toBe(def)
  })

  // GitHub issue #5970
  it('should work on multi version', () => {
    const Ctor1 = Vue.extend({})
    const Ctor2 = Vue.extend({})

    Ctor1.use(pluginStub, options)
    expect(Vue.options.directives['plugin-test']).toBeUndefined()
    expect(Ctor1.options.directives['plugin-test']).toBe(def)

    // multi version Vue Ctor with the same cid
    Ctor2.cid = Ctor1.cid
    Ctor2.use(pluginStub, options)
    expect(Vue.options.directives['plugin-test']).toBeUndefined()
    expect(Ctor2.options.directives['plugin-test']).toBe(def)
  })

  // #8595
  it('chain call', () => {
    expect(Vue.use(() => {})).toBe(Vue)
  })
})

Dependencies

  • vue

Frequently Asked Questions

What does use.spec.ts do?
use.spec.ts is a source file in the vue codebase, written in typescript.
What does use.spec.ts depend on?
use.spec.ts imports 1 module(s): vue.
Where is use.spec.ts in the architecture?
use.spec.ts is located at test/unit/features/global-api/use.spec.ts (directory: test/unit/features/global-api).

Analyze Your Own Codebase

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

Try Supermodel Free