mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
fix flow error for #3393
This commit is contained in:
parent
837b0b224b
commit
86bf3da18e
@ -11,7 +11,7 @@ function locateNode (vnode: VNode): VNodeWithData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
bind (el: HTMLElement, { value }: VNodeDirective, vnode: VNodeWithData) {
|
bind (el: any, { value }: VNodeDirective, vnode: VNodeWithData) {
|
||||||
vnode = locateNode(vnode)
|
vnode = locateNode(vnode)
|
||||||
const transition = vnode.data && vnode.data.transition
|
const transition = vnode.data && vnode.data.transition
|
||||||
if (value && transition && transition.appear && !isIE9) {
|
if (value && transition && transition.appear && !isIE9) {
|
||||||
@ -21,7 +21,7 @@ export default {
|
|||||||
el.style.display = value ? originalDisplay : 'none'
|
el.style.display = value ? originalDisplay : 'none'
|
||||||
el.__vOriginalDisplay = originalDisplay
|
el.__vOriginalDisplay = originalDisplay
|
||||||
},
|
},
|
||||||
update (el: HTMLElement, { value, oldValue }: VNodeDirective, vnode: VNodeWithData) {
|
update (el: any, { value, oldValue }: VNodeDirective, vnode: VNodeWithData) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (value === oldValue) return
|
if (value === oldValue) return
|
||||||
vnode = locateNode(vnode)
|
vnode = locateNode(vnode)
|
||||||
|
@ -50,11 +50,18 @@ describe('Directive v-show', () => {
|
|||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should respect display value in style attribute', () => {
|
it('should respect display value in style attribute', done => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><span v-show="foo" style="display:block">hello</span></div>',
|
template: '<div><span v-show="foo" style="display:block">hello</span></div>',
|
||||||
data: { foo: true }
|
data: { foo: true }
|
||||||
}).$mount()
|
}).$mount()
|
||||||
expect(vm.$el.firstChild.style.display).toBe('block')
|
expect(vm.$el.firstChild.style.display).toBe('block')
|
||||||
|
vm.foo = false
|
||||||
|
waitForUpdate(() => {
|
||||||
|
expect(vm.$el.firstChild.style.display).toBe('none')
|
||||||
|
vm.foo = true
|
||||||
|
}).then(() => {
|
||||||
|
expect(vm.$el.firstChild.style.display).toBe('block')
|
||||||
|
}).then(done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user