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

apiInject.spec.ts — vue Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  63336fa3_d8ec_375f_decd_e50d4306551b["apiInject.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  63336fa3_d8ec_375f_decd_e50d4306551b --> db9e7bef_009d_3918_6e7d_543a36a38d75
  920a56a4_015a_cbe3_85b7_79f2226fa20b["index"]
  63336fa3_d8ec_375f_decd_e50d4306551b --> 920a56a4_015a_cbe3_85b7_79f2226fa20b
  style 63336fa3_d8ec_375f_decd_e50d4306551b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import {
  h,
  provide,
  inject,
  InjectionKey,
  ref,
  nextTick,
  Ref,
  readonly,
  reactive
} from 'v3/index'

// reference: https://vue-composition-api-rfc.netlify.com/api.html#provide-inject
describe('api: provide/inject', () => {
  it('string keys', () => {
    const Provider = {
      setup() {
        provide('foo', 1)
        return () => h(Middle)
      }
    }

    const Middle = {
      render: () => h(Consumer)
    }

    const Consumer = {
      setup() {
        const foo = inject('foo')
        return () => h('div', foo)
      }
    }

    const vm = new Vue(Provider).$mount()
    expect(vm.$el.outerHTML).toBe(`<div>1</div>`)
  })

  it('symbol keys', () => {
    // also verifies InjectionKey type sync
    const key: InjectionKey<number> = Symbol()

    const Provider = {
      setup() {
        provide(key, 1)
        return () => h(Middle)
      }
    }

    const Middle = {
      render: () => h(Consumer)
    }

    const Consumer = {
      setup() {
        const foo = inject(key) || 1
        return () => h('div', foo + 1)
      }
    }

// ... (277 more lines)

Dependencies

  • index
  • vue

Frequently Asked Questions

What does apiInject.spec.ts do?
apiInject.spec.ts is a source file in the vue codebase, written in typescript.
What does apiInject.spec.ts depend on?
apiInject.spec.ts imports 2 module(s): index, vue.
Where is apiInject.spec.ts in the architecture?
apiInject.spec.ts is located at test/unit/features/v3/apiInject.spec.ts (directory: test/unit/features/v3).

Analyze Your Own Codebase

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

Try Supermodel Free