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

render.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Options render', () => {
  it('basic usage', () => {
    const vm = new Vue({
      render(h) {
        const children: any[] = []
        for (let i = 0; i < this.items.length; i++) {
          children.push(h('li', { staticClass: 'task' }, [this.items[i].name]))
        }
        return h('ul', { staticClass: 'tasks' }, children)
      },
      data: {
        items: [
          { id: 1, name: 'task1' },
          { id: 2, name: 'task2' }
        ]
      }
    }).$mount()
    expect(vm.$el.tagName).toBe('UL')
    for (let i = 0; i < vm.$el.children.length; i++) {
      const li = vm.$el.children[i]
      expect(li.tagName).toBe('LI')
      expect(li.textContent).toBe(vm.items[i].name)
    }
  })

  it('allow null data', () => {
    const vm = new Vue({
      render(h) {
        return h('div', null, 'hello' /* string as children*/)
      }
    }).$mount()
    expect(vm.$el.tagName).toBe('DIV')
    expect(vm.$el.textContent).toBe('hello')
  })

  it('should warn non `render` option and non `template` option', () => {
    new Vue().$mount()
    expect(
      'Failed to mount component: template or render function not defined.'
    ).toHaveBeenWarned()
  })
})

Dependencies

  • vue

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free