Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6d1ba6c

Browse filesBrowse files
committed
fix(CTooltip): tooltip shows up on title update
1 parent 9d64c71 commit 6d1ba6c
Copy full SHA for 6d1ba6c

File tree

Expand file treeCollapse file tree

2 files changed

+20
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-4
lines changed

‎src/directives/CTooltip.js

Copy file name to clipboardExpand all lines: src/directives/CTooltip.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ export default {
4848
</div>`
4949
},
5050
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) {
5352
vnode.context.$nextTick(() => {
5453
const title = binding.value.content
5554
el._c_tooltip.updateTitleContent(title)
56-
el._c_tooltip.show()
5755
})
5856
}
5957
}

‎src/directives/tests/CTooltip.spec.js

Copy file name to clipboardExpand all lines: src/directives/tests/CTooltip.spec.js
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const generateWrapper = (config) => {
4646
directives: { CTooltip },
4747
data () {
4848
return {
49-
button: true
49+
button: true,
50+
title: 'tooltip 1'
5051
}
5152
},
5253
mounted () {
@@ -85,6 +86,23 @@ describe(ComponentName, () => {
8586
expect(tooltipWrapper.find('.tooltip-old').isVisible()).toBe(true)
8687
})
8788

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+
88106
it('destroys correctly', (done) => {
89107
setTimeout(() => {
90108
expect(tooltipWrapper.find('.btn').exists()).not.toBe(true)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.