File tree 2 files changed +20
-4
lines changed
2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,10 @@ export default {
48
48
</div>`
49
49
} ,
50
50
update ( el , binding , vnode ) {
51
- if ( binding . value . content !== binding . oldValue . content && el === vnode . elm ) {
52
- el . _c_tooltip . hide ( )
51
+ if ( ( binding . value . content !== binding . oldValue . content ) && el === vnode . elm ) {
53
52
vnode . context . $nextTick ( ( ) => {
54
53
const title = binding . value . content
55
54
el . _c_tooltip . updateTitleContent ( title )
56
- el . _c_tooltip . show ( )
57
55
} )
58
56
}
59
57
}
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ const generateWrapper = (config) => {
46
46
directives : { CTooltip } ,
47
47
data ( ) {
48
48
return {
49
- button : true
49
+ button : true ,
50
+ title : 'tooltip 1'
50
51
}
51
52
} ,
52
53
mounted ( ) {
@@ -85,6 +86,23 @@ describe(ComponentName, () => {
85
86
expect ( tooltipWrapper . find ( '.tooltip-old' ) . isVisible ( ) ) . toBe ( true )
86
87
} )
87
88
89
+ it ( 'should update title content' , done => {
90
+ // todo
91
+ const updatedContent = 'Updated tooltip' ;
92
+ const wrapper = tooltipWrapper . find ( 'button' )
93
+ const instance = wrapper . element . _c_tooltip ;
94
+ expect (
95
+ tooltipWrapper . find ( '.tooltip-old .tooltip-old-inner' ) . element . textContent
96
+ ) . toBe ( 'tooltip' ) ;
97
+ instance . updateTitleContent ( updatedContent ) ;
98
+ instance . show ( ) ;
99
+ expect (
100
+ tooltipWrapper . find ( '.tooltip-old .tooltip-old-inner' ) . element . textContent
101
+ ) . toBe ( updatedContent ) ;
102
+ instance . hide ( ) ;
103
+ done ( ) ;
104
+ } ) ;
105
+
88
106
it ( 'destroys correctly' , ( done ) => {
89
107
setTimeout ( ( ) => {
90
108
expect ( tooltipWrapper . find ( '.btn' ) . exists ( ) ) . not . toBe ( true )
You can’t perform that action at this time.
0 commit comments