Home / File/ model-checkbox.spec.ts — vue Source File

model-checkbox.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Directive v-model checkbox', () => {
  it('should work', done => {
    const vm = new Vue({
      data: {
        test: true
      },
      template: '<input type="checkbox" v-model="test">'
    }).$mount()
    document.body.appendChild(vm.$el)
    expect(vm.$el.checked).toBe(true)
    vm.test = false
    waitForUpdate(function () {
      expect(vm.$el.checked).toBe(false)
      expect(vm.test).toBe(false)
      vm.$el.click()
      expect(vm.$el.checked).toBe(true)
      expect(vm.test).toBe(true)
    })
      .then(() => {
        document.body.removeChild(vm.$el)
      })
      .then(done)
  })

  it('should respect value bindings', done => {
    const vm = new Vue({
      data: {
        test: 1,
        a: 1,
        b: 2
      },
      template:
        '<input type="checkbox" v-model="test" :true-value="a" :false-value="b">'
    }).$mount()
    document.body.appendChild(vm.$el)
    expect(vm.$el.checked).toBe(true)
    vm.$el.click()
    expect(vm.$el.checked).toBe(false)
    expect(vm.test).toBe(2)
    vm.$el.click()
    expect(vm.$el.checked).toBe(true)
    expect(vm.test).toBe(1)
    vm.test = 2
    waitForUpdate(() => {
      expect(vm.$el.checked).toBe(false)
      vm.test = 1
    })
      .then(() => {
        expect(vm.$el.checked).toBe(true)
        document.body.removeChild(vm.$el)
      })
      .then(done)
  })

  it('bind to Array value', done => {
    const vm = new Vue({
      data: {
        test: ['1']
// ... (341 more lines)

Dependencies

  • vue

Frequently Asked Questions

What does model-checkbox.spec.ts do?
model-checkbox.spec.ts is a source file in the vue codebase, written in typescript.
What does model-checkbox.spec.ts depend on?
model-checkbox.spec.ts imports 1 module(s): vue.
Where is model-checkbox.spec.ts in the architecture?
model-checkbox.spec.ts is located at test/unit/features/directives/model-checkbox.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