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

lifecycle.spec.ts — vue Source File

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

File typescript 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Options lifecycle hooks', () => {
  let spy
  beforeEach(() => {
    spy = vi.fn()
  })

  describe('beforeCreate', () => {
    it('should allow modifying options', () => {
      const vm = new Vue({
        data: {
          a: 1
        },
        beforeCreate() {
          spy()
          expect(this.a).toBeUndefined()
          this.$options.computed = {
            b() {
              return this.a + 1
            }
          }
        }
      })
      expect(spy).toHaveBeenCalled()
      expect(vm.b).toBe(2)
    })
  })

  describe('created', () => {
    it('should have completed observation', () => {
      new Vue({
        data: {
          a: 1
        },
        created() {
          expect(this.a).toBe(1)
          spy()
        }
      })
      expect(spy).toHaveBeenCalled()
    })
  })

  describe('beforeMount', () => {
    it('should not have mounted', () => {
      const vm = new Vue({
        render() {},
        beforeMount() {
          spy()
          expect(this._isMounted).toBe(false)
          expect(this.$el).toBeUndefined() // due to empty mount
          expect(this._vnode).toBeNull()
          expect(this._watcher).toBeNull()
        }
      })
      expect(spy).not.toHaveBeenCalled()
      vm.$mount()
      expect(spy).toHaveBeenCalled()
    })
// ... (279 more lines)

Dependencies

  • vue

Frequently Asked Questions

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