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

mixin.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Global API: mixin', () => {
  let options
  beforeEach(() => {
    options = Vue.options
  })
  afterEach(() => {
    Vue.options = options
  })

  it('should work', () => {
    const spy = vi.fn()
    Vue.mixin({
      created() {
        spy(this.$options.myOption)
      }
    })
    new Vue({
      myOption: 'hello'
    })
    expect(spy).toHaveBeenCalledWith('hello')
  })

  it('should work for constructors created before mixin is applied', () => {
    const calls: any[] = []
    const Test: Vue = Vue.extend({
      name: 'test',
      beforeCreate() {
        calls.push(this.$options.myOption + ' local')
      }
    })
    Vue.mixin({
      beforeCreate() {
        calls.push(this.$options.myOption + ' global')
      }
    })
    expect(Test.options.name).toBe('test')
    new Test({
      myOption: 'hello'
    })
    expect(calls).toEqual(['hello global', 'hello local'])
  })

  // #3957
  it('should work for global props', () => {
    const Test = Vue.extend({
      template: `<div>{{ prop }}</div>`
    })

    Vue.mixin({
      props: ['prop']
    })

    // test child component
    const vm = new Vue({
      template: '<test prop="hi"></test>',
      components: { Test }
    }).$mount()

// ... (142 more lines)

Dependencies

  • vue

Frequently Asked Questions

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