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

if.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Directive v-if', () => {
  it('should check if value is truthy', () => {
    const vm = new Vue({
      template: '<div><span v-if="foo">hello</span></div>',
      data: { foo: true }
    }).$mount()
    expect(vm.$el.innerHTML).toBe('<span>hello</span>')
  })

  it('should check if value is falsy', () => {
    const vm = new Vue({
      template: '<div><span v-if="foo">hello</span></div>',
      data: { foo: false }
    }).$mount()
    expect(vm.$el.innerHTML).toBe('<!---->')
  })

  it('should update if value changed', done => {
    const vm = new Vue({
      template: '<div><span v-if="foo">hello</span></div>',
      data: { foo: true }
    }).$mount()
    expect(vm.$el.innerHTML).toBe('<span>hello</span>')
    vm.foo = false
    waitForUpdate(() => {
      expect(vm.$el.innerHTML).toBe('<!---->')
      vm.foo = {}
    })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<span>hello</span>')
        vm.foo = 0
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<!---->')
        vm.foo = []
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<span>hello</span>')
        vm.foo = null
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<!---->')
        vm.foo = '0'
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<span>hello</span>')
        vm.foo = undefined
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<!---->')
        vm.foo = 1
      })
      .then(() => {
        expect(vm.$el.innerHTML).toBe('<span>hello</span>')
      })
      .then(done)
  })

// ... (254 more lines)

Dependencies

  • vue

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free