Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
79ec24da
Commit
79ec24da
authored
Oct 26, 2018
by
Winnie Hellmann
Committed by
Clement Ho
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update content of visible tooltips
parent
359474a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
9 deletions
+38
-9
app/assets/javascripts/vue_shared/directives/tooltip.js
app/assets/javascripts/vue_shared/directives/tooltip.js
+8
-0
spec/javascripts/vue_shared/directives/tooltip_spec.js
spec/javascripts/vue_shared/directives/tooltip_spec.js
+30
-9
No files found.
app/assets/javascripts/vue_shared/directives/tooltip.js
View file @
79ec24da
...
...
@@ -9,6 +9,14 @@ export default {
componentUpdated
(
el
)
{
$
(
el
).
tooltip
(
'
_fixTitle
'
);
// update visible tooltips
const
tooltipInstance
=
$
(
el
).
data
(
'
bs.tooltip
'
);
const
tip
=
tooltipInstance
.
getTipElement
();
tooltipInstance
.
setElementContent
(
$
(
tip
.
querySelectorAll
(
'
.tooltip-inner
'
)),
tooltipInstance
.
getTitle
(),
);
},
unbind
(
el
)
{
...
...
spec/javascripts/vue_shared/directives/tooltip_spec.js
View file @
79ec24da
...
...
@@ -13,24 +13,45 @@ describe('Tooltip directive', () => {
describe
(
'
with a single tooltip
'
,
()
=>
{
beforeEach
(()
=>
{
const
SomeComponent
=
Vue
.
extend
({
setFixtures
(
'
<div id="dummy-element"></div>
'
);
vm
=
new
Vue
({
el
:
'
#dummy-element
'
,
directives
:
{
tooltip
,
},
template
:
`
<div
v-tooltip
title="foo">
</div>
`
,
data
()
{
return
{
tooltip
:
'
some text
'
,
};
},
template
:
'
<div v-tooltip :title="tooltip"></div>
'
,
});
vm
=
new
SomeComponent
().
$mount
();
});
it
(
'
should have tooltip plugin applied
'
,
()
=>
{
expect
(
$
(
vm
.
$el
).
data
(
'
bs.tooltip
'
)).
toBeDefined
();
});
it
(
'
displays the title as tooltip
'
,
()
=>
{
$
(
vm
.
$el
).
tooltip
(
'
show
'
);
const
tooltipElement
=
document
.
querySelector
(
'
.tooltip-inner
'
);
expect
(
tooltipElement
.
innerText
).
toContain
(
'
some text
'
);
});
it
(
'
updates a visible tooltip
'
,
done
=>
{
$
(
vm
.
$el
).
tooltip
(
'
show
'
);
const
tooltipElement
=
document
.
querySelector
(
'
.tooltip-inner
'
);
vm
.
tooltip
=
'
other text
'
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
tooltipElement
).
toContainText
(
'
other text
'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
describe
(
'
with multiple tooltips
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment