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.

Entity Profile

Dependency Diagram

graph LR
  f0950146_e93a_0156_926c_3ddc0804808e["computed.spec.ts"]
  4ef3cec1_7e9c_23bb_5e9b_f118e8ebdf99["test-object-option.ts"]
  f0950146_e93a_0156_926c_3ddc0804808e --> 4ef3cec1_7e9c_23bb_5e9b_f118e8ebdf99
  830d85be_ea2f_f50c_75f1_dd6812fb608f["testObjectOption"]
  f0950146_e93a_0156_926c_3ddc0804808e --> 830d85be_ea2f_f50c_75f1_dd6812fb608f
  c5601857_7faf_30c6_efca_20de90db006c["vue"]
  f0950146_e93a_0156_926c_3ddc0804808e --> c5601857_7faf_30c6_efca_20de90db006c
  style f0950146_e93a_0156_926c_3ddc0804808e 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 CompilerSFC 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: CompilerSFC, 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