Revert "refactor(directives): remove binding.instance"
This reverts commit 52cc7e8231.
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
DirectiveBinding,
|
||||
nextTick
|
||||
} from '@vue/runtime-test'
|
||||
import { currentInstance, ComponentInternalInstance } from '../src/component'
|
||||
|
||||
describe('directives', () => {
|
||||
it('should work', async () => {
|
||||
@@ -17,6 +18,7 @@ describe('directives', () => {
|
||||
function assertBindings(binding: DirectiveBinding) {
|
||||
expect(binding.value).toBe(count.value)
|
||||
expect(binding.arg).toBe('foo')
|
||||
expect(binding.instance).toBe(_instance && _instance.proxy)
|
||||
expect(binding.modifiers && binding.modifiers.ok).toBe(true)
|
||||
}
|
||||
|
||||
@@ -105,9 +107,13 @@ describe('directives', () => {
|
||||
unmounted
|
||||
}
|
||||
|
||||
let _instance: ComponentInternalInstance | null = null
|
||||
let _vnode: VNode | null = null
|
||||
let _prevVnode: VNode | null = null
|
||||
const Comp = {
|
||||
setup() {
|
||||
_instance = currentInstance
|
||||
},
|
||||
render() {
|
||||
_prevVnode = _vnode
|
||||
_vnode = withDirectives(h('div', count.value), [
|
||||
@@ -147,6 +153,7 @@ describe('directives', () => {
|
||||
function assertBindings(binding: DirectiveBinding) {
|
||||
expect(binding.value).toBe(count.value)
|
||||
expect(binding.arg).toBe('foo')
|
||||
expect(binding.instance).toBe(_instance && _instance.proxy)
|
||||
expect(binding.modifiers && binding.modifiers.ok).toBe(true)
|
||||
}
|
||||
|
||||
@@ -160,9 +167,13 @@ describe('directives', () => {
|
||||
expect(prevVNode).toBe(_prevVnode)
|
||||
}) as DirectiveHook)
|
||||
|
||||
let _instance: ComponentInternalInstance | null = null
|
||||
let _vnode: VNode | null = null
|
||||
let _prevVnode: VNode | null = null
|
||||
const Comp = {
|
||||
setup() {
|
||||
_instance = currentInstance
|
||||
},
|
||||
render() {
|
||||
_prevVnode = _vnode
|
||||
_vnode = withDirectives(h('div', count.value), [
|
||||
@@ -196,6 +207,7 @@ describe('directives', () => {
|
||||
function assertBindings(binding: DirectiveBinding) {
|
||||
expect(binding.value).toBe(count.value)
|
||||
expect(binding.arg).toBe('foo')
|
||||
expect(binding.instance).toBe(_instance && _instance.proxy)
|
||||
expect(binding.modifiers && binding.modifiers.ok).toBe(true)
|
||||
}
|
||||
|
||||
@@ -284,6 +296,7 @@ describe('directives', () => {
|
||||
unmounted
|
||||
}
|
||||
|
||||
let _instance: ComponentInternalInstance | null = null
|
||||
let _vnode: VNode | null = null
|
||||
let _prevVnode: VNode | null = null
|
||||
|
||||
@@ -294,6 +307,9 @@ describe('directives', () => {
|
||||
}
|
||||
|
||||
const Comp = {
|
||||
setup() {
|
||||
_instance = currentInstance
|
||||
},
|
||||
render() {
|
||||
return withDirectives(h(Child, { count: count.value }), [
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user