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
  777e4875_e7d7_fee7_3b08_10b12b1d9a87["setupTemplateRef.spec.ts"]
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  777e4875_e7d7_fee7_3b08_10b12b1d9a87 --> c5601857_7faf_30c6_efca_20de90db006c
  37c32364_930a_63e2_4e01_191cc2fafe97["index"]
  777e4875_e7d7_fee7_3b08_10b12b1d9a87 --> 37c32364_930a_63e2_4e01_191cc2fafe97
  style 777e4875_e7d7_fee7_3b08_10b12b1d9a87 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