feat(reactivity): new effectScope API (#2195)

This commit is contained in:
Anthony Fu
2021-07-07 21:07:19 +08:00
committed by Evan You
parent 87f69fd0bb
commit f5617fc3bb
16 changed files with 400 additions and 89 deletions

View File

@@ -848,15 +848,16 @@ describe('api: watch', () => {
render(h(Comp), nodeOps.createElement('div'))
expect(instance!).toBeDefined()
expect(instance!.effects).toBeInstanceOf(Array)
expect(instance!.effects!.length).toBe(1)
expect(instance!.scope.effects).toBeInstanceOf(Array)
// includes the component's own render effect AND the watcher effect
expect(instance!.scope.effects!.length).toBe(2)
_show!.value = false
await nextTick()
await nextTick()
expect(instance!.effects![0].active).toBe(false)
expect(instance!.scope.effects![0].active).toBe(false)
})
test('this.$watch should pass `this.proxy` to watch source as the first argument ', () => {