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

extend.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Global API: extend', () => {
  it('should correctly merge options', () => {
    const Test = Vue.extend({
      name: 'test',
      a: 1,
      b: 2
    })
    expect(Test.options.a).toBe(1)
    expect(Test.options.b).toBe(2)
    expect(Test.super).toBe(Vue)
    const t = new Test({
      a: 2
    })
    expect(t.$options.a).toBe(2)
    expect(t.$options.b).toBe(2)
    // inheritance
    const Test2 = Test.extend({
      a: 2
    })
    expect(Test2.options.a).toBe(2)
    expect(Test2.options.b).toBe(2)
    const t2 = new Test2({
      a: 3
    })
    expect(t2.$options.a).toBe(3)
    expect(t2.$options.b).toBe(2)
  })

  it('should warn invalid names', () => {
    Vue.extend({ name: '123' })
    expect('Invalid component name: "123"').toHaveBeenWarned()
    Vue.extend({ name: '_fesf' })
    expect('Invalid component name: "_fesf"').toHaveBeenWarned()
    Vue.extend({ name: 'Some App' })
    expect('Invalid component name: "Some App"').toHaveBeenWarned()
  })

  it('should work when used as components', () => {
    const foo = Vue.extend({
      template: '<span>foo</span>'
    })
    const bar = Vue.extend({
      template: '<span>bar</span>'
    })
    const vm = new Vue({
      template: '<div><foo></foo><bar></bar></div>',
      components: { foo, bar }
    }).$mount()
    expect(vm.$el.innerHTML).toBe('<span>foo</span><span>bar</span>')
  })

  it('should merge lifecycle hooks', () => {
    const calls: any[] = []
    const A = Vue.extend({
      created() {
        calls.push(1)
      }
    })
// ... (100 more lines)

Dependencies

  • vue

Frequently Asked Questions

What does extend.spec.ts do?
extend.spec.ts is a source file in the vue codebase, written in typescript.
What does extend.spec.ts depend on?
extend.spec.ts imports 1 module(s): vue.
Where is extend.spec.ts in the architecture?
extend.spec.ts is located at test/unit/features/global-api/extend.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