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

once.spec.ts — vue Source File

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

File typescript VueCore Observer 1 imports 1 functions

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import Vue from 'vue'

describe('Directive v-once', () => {
  it('should not rerender component', done => {
    const vm = new Vue({
      template: '<div v-once>{{ a }}</div>',
      data: { a: 'hello' }
    }).$mount()
    expect(vm.$el.innerHTML).toBe('hello')
    vm.a = 'world'
    waitForUpdate(() => {
      expect(vm.$el.innerHTML).toBe('hello')
    }).then(done)
  })

  it('should not rerender self and child component', done => {
    const vm = new Vue({
      template: `
        <div v-once>
          <span>{{ a }}</span>
          <item :b="a"></item>
        </div>`,
      data: { a: 'hello' },
      components: {
        item: {
          template: '<div>{{ b }}</div>',
          props: ['b']
        }
      }
    }).$mount()
    expect(vm.$children.length).toBe(1)
    expect(vm.$el.innerHTML).toBe('<span>hello</span> <div>hello</div>')
    vm.a = 'world'
    waitForUpdate(() => {
      expect(vm.$el.innerHTML).toBe('<span>hello</span> <div>hello</div>')
    }).then(done)
  })

  it('should rerender parent but not self', done => {
    const vm = new Vue({
      template: `
        <div>
          <span>{{ a }}</span>
          <item v-once :b="a"></item>
        </div>`,
      data: { a: 'hello' },
      components: {
        item: {
          template: '<div>{{ b }}</div>',
          props: ['b']
        }
      }
    }).$mount()
    expect(vm.$children.length).toBe(1)
    expect(vm.$el.innerHTML).toBe('<span>hello</span> <div>hello</div>')
    vm.a = 'world'
    waitForUpdate(() => {
      expect(vm.$el.innerHTML).toBe('<span>world</span> <div>hello</div>')
    }).then(done)
  })
// ... (327 more lines)

Domain

Subdomains

Dependencies

  • vue

Frequently Asked Questions

What does once.spec.ts do?
once.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Observer subdomain.
What functions are defined in once.spec.ts?
once.spec.ts defines 1 function(s): expectTextContent.
What does once.spec.ts depend on?
once.spec.ts imports 1 module(s): vue.
Where is once.spec.ts in the architecture?
once.spec.ts is located at test/unit/features/directives/once.spec.ts (domain: VueCore, subdomain: Observer, 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