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 f5ed3461_5ce7_9bc4_63a1_82646da86e76["effectScope.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] f5ed3461_5ce7_9bc4_63a1_82646da86e76 --> db9e7bef_009d_3918_6e7d_543a36a38d75 6d8f8976_7066_720b_0d45_45fe42921eaf["util"] f5ed3461_5ce7_9bc4_63a1_82646da86e76 --> 6d8f8976_7066_720b_0d45_45fe42921eaf 920a56a4_015a_cbe3_85b7_79f2226fa20b["index"] f5ed3461_5ce7_9bc4_63a1_82646da86e76 --> 920a56a4_015a_cbe3_85b7_79f2226fa20b 1a5e86bd_1a43_1523_b480_a1b1a98c87ad["effect"] f5ed3461_5ce7_9bc4_63a1_82646da86e76 --> 1a5e86bd_1a43_1523_b480_a1b1a98c87ad style f5ed3461_5ce7_9bc4_63a1_82646da86e76 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