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

setupTemplateRef.spec.ts — vue Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'
import { ref, h, nextTick, reactive } from 'v3/index'

// reference: https://vue-composition-api-rfc.netlify.com/api.html#template-refs

describe('api: setup() template refs', () => {
  it('string ref mount', () => {
    const el = ref(null)

    const Comp = {
      setup() {
        return {
          refKey: el
        }
      },
      render() {
        return h('div', { ref: 'refKey' })
      }
    }
    const vm = new Vue(Comp).$mount()
    expect(el.value).toBe(vm.$el)
  })

  it('string ref update', async () => {
    const fooEl = ref(null)
    const barEl = ref(null)
    const refKey = ref('foo')

    const Comp = {
      setup() {
        return {
          foo: fooEl,
          bar: barEl
        }
      },
      render() {
        return h('div', { ref: refKey.value })
      }
    }
    const vm = new Vue(Comp).$mount()
    expect(barEl.value).toBe(null)

    refKey.value = 'bar'
    await nextTick()
    expect(fooEl.value).toBe(null)
    expect(barEl.value).toBe(vm.$el)
  })

  it('string ref unmount', async () => {
    const el = ref(null)
    const toggle = ref(true)

    const Comp = {
      setup() {
        return {
          refKey: el
        }
      },
      render() {
        return toggle.value ? h('div', { ref: 'refKey' }) : null
// ... (442 more lines)

Dependencies

  • index
  • vue

Frequently Asked Questions

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