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
  4dddee4e_6342_4099_72c6_908cf649580e["extends.spec.ts"]
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  4dddee4e_6342_4099_72c6_908cf649580e --> c5601857_7faf_30c6_efca_20de90db006c
  b1eb2bb2_8774_a6f3_1b5c_854efafa7ee6["env"]
  4dddee4e_6342_4099_72c6_908cf649580e --> b1eb2bb2_8774_a6f3_1b5c_854efafa7ee6
  style 4dddee4e_6342_4099_72c6_908cf649580e 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