effectScope.spec.ts — vue Source File
Architecture documentation for effectScope.spec.ts, a typescript file in the vue codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 65d01401_7bf2_4210_bc61_4b6bccb6df9a["effectScope.spec.ts"] c5601857_7faf_30c6_efca_20de90db006c["vue"] 65d01401_7bf2_4210_bc61_4b6bccb6df9a --> c5601857_7faf_30c6_efca_20de90db006c 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9["util"] 65d01401_7bf2_4210_bc61_4b6bccb6df9a --> 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9 37c32364_930a_63e2_4e01_191cc2fafe97["index"] 65d01401_7bf2_4210_bc61_4b6bccb6df9a --> 37c32364_930a_63e2_4e01_191cc2fafe97 3a63aff0_8a8f_7988_aef0_ae98d03fcf43["effect"] 65d01401_7bf2_4210_bc61_4b6bccb6df9a --> 3a63aff0_8a8f_7988_aef0_ae98d03fcf43 style 65d01401_7bf2_4210_bc61_4b6bccb6df9a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Vue from 'vue'
import { nextTick } from 'core/util'
import {
watch,
watchEffect,
reactive,
computed,
ref,
ComputedRef,
EffectScope,
onScopeDispose,
getCurrentScope
} from 'v3/index'
import { effect } from 'v3/reactivity/effect'
describe('reactivity/effectScope', () => {
it('should run', () => {
const fnSpy = vi.fn(() => {})
new EffectScope().run(fnSpy)
expect(fnSpy).toHaveBeenCalledTimes(1)
})
it('should accept zero argument', () => {
const scope = new EffectScope()
expect(scope.effects.length).toBe(0)
})
it('should return run value', () => {
expect(new EffectScope().run(() => 1)).toBe(1)
})
it('should collect the effects', () => {
const scope = new EffectScope()
scope.run(() => {
let dummy
const counter = reactive({ num: 0 })
effect(() => (dummy = counter.num))
expect(dummy).toBe(0)
counter.num = 7
expect(dummy).toBe(7)
})
expect(scope.effects.length).toBe(1)
})
it('stop', () => {
let dummy, doubled
const counter = reactive({ num: 0 })
const scope = new EffectScope()
scope.run(() => {
effect(() => (dummy = counter.num))
effect(() => (doubled = counter.num * 2))
})
expect(scope.effects.length).toBe(2)
expect(dummy).toBe(0)
counter.num = 7
// ... (259 more lines)
Dependencies
- effect
- index
- util
- vue
Source
Frequently Asked Questions
What does effectScope.spec.ts do?
effectScope.spec.ts is a source file in the vue codebase, written in typescript.
What does effectScope.spec.ts depend on?
effectScope.spec.ts imports 4 module(s): effect, index, util, vue.
Where is effectScope.spec.ts in the architecture?
effectScope.spec.ts is located at test/unit/features/v3/reactivity/effectScope.spec.ts (directory: test/unit/features/v3/reactivity).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free