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

extends.spec.ts — vue Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  dbbb8da7_71da_3ccb_1269_3da2d82eb9a7["extends.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  dbbb8da7_71da_3ccb_1269_3da2d82eb9a7 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  1ec7e50f_8f20_0656_28f0_45cecc26cf74["env"]
  dbbb8da7_71da_3ccb_1269_3da2d82eb9a7 --> 1ec7e50f_8f20_0656_28f0_45cecc26cf74
  style dbbb8da7_71da_3ccb_1269_3da2d82eb9a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import { nativeWatch } from 'core/util/env'

describe('Options extends', () => {
  it('should work on objects', () => {
    const A = {
      data() {
        return { a: 1 }
      }
    }
    const B = {
      extends: A,
      data() {
        return { b: 2 }
      }
    }
    const vm = new Vue({
      extends: B,
      data: {
        c: 3
      }
    })
    expect(vm.a).toBe(1)
    expect(vm.b).toBe(2)
    expect(vm.c).toBe(3)
  })

  it('should work on extended constructors', () => {
    const A = Vue.extend({
      data() {
        return { a: 1 }
      }
    })
    const B = Vue.extend({
      extends: A,
      data() {
        return { b: 2 }
      }
    })
    const vm = new Vue({
      extends: B,
      data: {
        c: 3
      }
    })
    expect(vm.a).toBe(1)
    expect(vm.b).toBe(2)
    expect(vm.c).toBe(3)
  })

  if (nativeWatch) {
    it('should work with global mixins + Object.prototype.watch', done => {
      Vue.mixin({})

      const spy = vi.fn()
      const A = Vue.extend({
        data: function () {
          return { a: 1 }
        },
        watch: {
          a: spy
        },
        created: function () {
          this.a = 2
        }
      })
      new Vue({
        extends: A
      })
      waitForUpdate(() => {
        expect(spy).toHaveBeenCalledWith(2, 1)
      }).then(done)
    })
  }
})

Dependencies

  • env
  • vue

Frequently Asked Questions

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