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

computed.spec.ts — vue Source File

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

File typescript VueCore 3 imports

Entity Profile

Dependency Diagram

graph LR
  41f7d0e3_2662_be52_1666_f5322ac8fd4b["computed.spec.ts"]
  09b3d58b_2586_2d23_1760_3ec3fe090d46["test-object-option.ts"]
  41f7d0e3_2662_be52_1666_f5322ac8fd4b --> 09b3d58b_2586_2d23_1760_3ec3fe090d46
  4a7600ac_90db_8739_d900_439c1c18fef7["testObjectOption"]
  41f7d0e3_2662_be52_1666_f5322ac8fd4b --> 4a7600ac_90db_8739_d900_439c1c18fef7
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  41f7d0e3_2662_be52_1666_f5322ac8fd4b --> db9e7bef_009d_3918_6e7d_543a36a38d75
  style 41f7d0e3_2662_be52_1666_f5322ac8fd4b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'
import testObjectOption from '../../../helpers/test-object-option'

describe('Options computed', () => {
  testObjectOption('computed')

  it('basic usage', done => {
    const vm = new Vue({
      template: '<div>{{ b }}</div>',
      data: {
        a: 1
      },
      computed: {
        b() {
          return this.a + 1
        }
      }
    }).$mount()
    expect(vm.b).toBe(2)
    expect(vm.$el.textContent).toBe('2')
    vm.a = 2
    expect(vm.b).toBe(3)
    waitForUpdate(() => {
      expect(vm.$el.textContent).toBe('3')
    }).then(done)
  })

  it('with setter', done => {
    const vm = new Vue({
      template: '<div>{{ b }}</div>',
      data: {
        a: 1
      },
      computed: {
        b: {
          get() {
            return this.a + 1
          },
          set(v) {
            this.a = v - 1
          }
        }
      }
    }).$mount()
    expect(vm.b).toBe(2)
    expect(vm.$el.textContent).toBe('2')
    vm.a = 2
    expect(vm.b).toBe(3)
    waitForUpdate(() => {
      expect(vm.$el.textContent).toBe('3')
      vm.b = 1
      expect(vm.a).toBe(0)
    })
      .then(() => {
        expect(vm.$el.textContent).toBe('1')
      })
      .then(done)
  })

  it('warn with setter and no getter', () => {
// ... (190 more lines)

Domain

Frequently Asked Questions

What does computed.spec.ts do?
computed.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain.
What does computed.spec.ts depend on?
computed.spec.ts imports 3 module(s): test-object-option.ts, testObjectOption, vue.
Where is computed.spec.ts in the architecture?
computed.spec.ts is located at test/unit/features/options/computed.spec.ts (domain: VueCore, 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