chore: rename onDispose to onScopeDispose in warnings and tests (#4355)

This commit is contained in:
Haoqun Jiang 2021-08-17 06:19:06 +08:00 committed by GitHub
parent 620a69b871
commit 7c4e4514d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -173,7 +173,7 @@ describe('reactivity/effect/scope', () => {
expect(doubled).toBe(undefined) expect(doubled).toBe(undefined)
}) })
it('should fire onDispose hook', () => { it('should fire onScopeDispose hook', () => {
let dummy = 0 let dummy = 0
const scope = new EffectScope() const scope = new EffectScope()
@ -192,7 +192,7 @@ describe('reactivity/effect/scope', () => {
expect(dummy).toBe(7) expect(dummy).toBe(7)
}) })
it('should warn onDispose() is called when there is no active effect scope', () => { it('should warn onScopeDispose() is called when there is no active effect scope', () => {
const spy = jest.fn() const spy = jest.fn()
const scope = new EffectScope() const scope = new EffectScope()
scope.run(() => { scope.run(() => {
@ -204,7 +204,7 @@ describe('reactivity/effect/scope', () => {
onScopeDispose(spy) onScopeDispose(spy)
expect( expect(
'[Vue warn] onDispose() is called when there is no active effect scope to be associated with.' '[Vue warn] onScopeDispose() is called when there is no active effect scope to be associated with.'
).toHaveBeenWarned() ).toHaveBeenWarned()
scope.stop() scope.stop()

View File

@ -98,7 +98,7 @@ export function onScopeDispose(fn: () => void) {
activeEffectScope.cleanups.push(fn) activeEffectScope.cleanups.push(fn)
} else if (__DEV__) { } else if (__DEV__) {
warn( warn(
`onDispose() is called when there is no active effect scope` + `onScopeDispose() is called when there is no active effect scope` +
` to be associated with.` ` to be associated with.`
) )
} }