Home / File/ template-ref.spec.ts — vue Source File

template-ref.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('ref', () => {
  type TestShape = {
    id: string
    template: string
    data?: any
    components?: any
  }
  type ComponentShape = {
    test: TestShape
    test2: TestShape
    test3: TestShape
  }
  const components: ComponentShape = {
    test: {
      id: 'test',
      template: '<div>test</div>'
    },
    test2: {
      id: 'test2',
      template: '<div>test2</div>'
    },
    test3: {
      id: 'test3',
      template: '<div>test3</div>'
    }
  }

  it('should work', () => {
    const vm = new Vue({
      data: {
        value: 'bar'
      },
      template: `<div>
        <test ref="foo"></test>
        <test2 :ref="value"></test2>
        <test3 :ref="0"></test3>
      </div>`,
      components
    })
    vm.$mount()
    expect(vm.$refs.foo).toBeTruthy()
    expect(vm.$refs.foo.$options.id).toBe('test')
    expect(vm.$refs.bar).toBeTruthy()
    expect(vm.$refs.bar.$options.id).toBe('test2')
    expect(vm.$refs['0']).toBeTruthy()
    expect(vm.$refs['0'].$options.id).toBe('test3')
  })

  it('should dynamically update refs', done => {
    const vm = new Vue({
      data: {
        value: 'foo'
      },
      template: '<div :ref="value"></div>'
    }).$mount()
    expect(vm.$refs.foo).toBe(vm.$el)
    vm.value = 'bar'
    waitForUpdate(() => {
// ... (193 more lines)

Dependencies

  • vue

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free