Home / File/ component-slot.spec.ts — vue Source File

component-slot.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Component slot', () => {
  let vm, child
  function mount(options) {
    vm = new Vue({
      data: {
        msg: 'parent message'
      },
      template: `<div><test>${options.parentContent || ''}</test></div>`,
      components: {
        test: {
          template: options.childTemplate,
          data() {
            return {
              msg: 'child message'
            }
          }
        }
      }
    }).$mount()
    child = vm.$children[0]
  }

  it('no content', () => {
    mount({
      childTemplate: '<div><slot></slot></div>'
    })
    expect(child.$el.childNodes.length).toBe(0)
  })

  it('default slot', done => {
    mount({
      childTemplate: '<div><slot></slot></div>',
      parentContent: '<p>{{ msg }}</p>'
    })
    expect(child.$el.tagName).toBe('DIV')
    expect(child.$el.children[0].tagName).toBe('P')
    expect(child.$el.children[0].textContent).toBe('parent message')
    vm.msg = 'changed'
    waitForUpdate(() => {
      expect(child.$el.children[0].textContent).toBe('changed')
    }).then(done)
  })

  it('named slot', done => {
    mount({
      childTemplate: '<div><slot name="test"></slot></div>',
      parentContent: '<p slot="test">{{ msg }}</p>'
    })
    expect(child.$el.tagName).toBe('DIV')
    expect(child.$el.children[0].tagName).toBe('P')
    expect(child.$el.children[0].textContent).toBe('parent message')
    vm.msg = 'changed'
    waitForUpdate(() => {
      expect(child.$el.children[0].textContent).toBe('changed')
    }).then(done)
  })

  it('named slot with 0 as a number', done => {
// ... (1017 more lines)

Dependencies

  • vue

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free