Home / File/ create-element.spec.ts — vue Source File

create-element.spec.ts — vue Source File

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

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  76b73db2_8313_585a_e62b_b9f868f46468["create-element.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  76b73db2_8313_585a_e62b_b9f868f46468 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  973389ac_8625_30a3_53ce_b1b48fae58c5["vnode"]
  76b73db2_8313_585a_e62b_b9f868f46468 --> 973389ac_8625_30a3_53ce_b1b48fae58c5
  style 76b73db2_8313_585a_e62b_b9f868f46468 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import { createEmptyVNode } from 'core/vdom/vnode'

describe('create-element', () => {
  it('render vnode with basic reserved tag using createElement', () => {
    const vm = new Vue({
      data: { msg: 'hello world' }
    })
    const h = vm.$createElement
    const vnode = h('p', {})
    expect(vnode.tag).toBe('p')
    expect(vnode.data).toEqual({})
    expect(vnode.children).toBeUndefined()
    expect(vnode.text).toBeUndefined()
    expect(vnode.elm).toBeUndefined()
    expect(vnode.ns).toBeUndefined()
    expect(vnode.context).toEqual(vm)
  })

  it('render vnode with component using createElement', () => {
    const vm = new Vue({
      data: { message: 'hello world' },
      components: {
        'my-component': {
          props: ['msg']
        }
      }
    })
    const h = vm.$createElement
    const vnode = h('my-component', { props: { msg: vm.message } })
    expect(vnode.tag).toMatch(/vue-component-[0-9]+/)
    expect(vnode.componentOptions.propsData).toEqual({ msg: vm.message })
    expect(vnode.children).toBeUndefined()
    expect(vnode.text).toBeUndefined()
    expect(vnode.elm).toBeUndefined()
    expect(vnode.ns).toBeUndefined()
    expect(vnode.context).toEqual(vm)
  })

  it('render vnode with custom tag using createElement', () => {
    const vm = new Vue({
      data: { msg: 'hello world' }
    })
    const h = vm.$createElement
    const tag = 'custom-tag'
    const vnode = h(tag, {})
    expect(vnode.tag).toBe('custom-tag')
    expect(vnode.data).toEqual({})
    expect(vnode.children).toBeUndefined()
    expect(vnode.text).toBeUndefined()
    expect(vnode.elm).toBeUndefined()
    expect(vnode.ns).toBeUndefined()
    expect(vnode.context).toEqual(vm)
    expect(vnode.componentOptions).toBeUndefined()
  })

  it('render empty vnode with falsy tag using createElement', () => {
    const vm = new Vue({
      data: { msg: 'hello world' }
    })
// ... (225 more lines)

Dependencies

  • vnode
  • vue

Frequently Asked Questions

What does create-element.spec.ts do?
create-element.spec.ts is a source file in the vue codebase, written in typescript.
What does create-element.spec.ts depend on?
create-element.spec.ts imports 2 module(s): vnode, vue.
Where is create-element.spec.ts in the architecture?
create-element.spec.ts is located at test/unit/modules/vdom/create-element.spec.ts (directory: test/unit/modules/vdom).

Analyze Your Own Codebase

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

Try Supermodel Free