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

data.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Options data', () => {
  it('should proxy and be reactive', done => {
    const data = { msg: 'foo' }
    const vm = new Vue({
      data,
      template: '<div>{{ msg }}</div>'
    }).$mount()
    expect(vm.$data).toEqual({ msg: 'foo' })
    expect(vm.$data).toBe(data)
    data.msg = 'bar'
    waitForUpdate(() => {
      expect(vm.$el.textContent).toBe('bar')
    }).then(done)
  })

  it('should merge data properly', () => {
    const Test = Vue.extend({
      data() {
        return { a: 1 }
      }
    })
    let vm = new Test({
      data: { b: 2 }
    })
    expect(vm.a).toBe(1)
    expect(vm.b).toBe(2)
    // no instance data
    vm = new Test()
    expect(vm.a).toBe(1)
    // no child-val
    const Extended = Test.extend({})
    vm = new Extended()
    expect(vm.a).toBe(1)
    // recursively merge objects
    const WithObject = Vue.extend({
      data() {
        return {
          obj: {
            a: 1
          }
        }
      }
    })
    vm = new WithObject({
      data: {
        obj: {
          b: 2
        }
      }
    })
    expect(vm.obj.a).toBe(1)
    expect(vm.obj.b).toBe(2)
  })

  it('should warn non-function during extend', () => {
    Vue.extend({
      data: { msg: 'foo' }
    })
// ... (129 more lines)

Dependencies

  • vue

Frequently Asked Questions

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