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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ff39fdb1
Commit
ff39fdb1
authored
Nov 15, 2019
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare timeago-tooltip for bootstrap-vue upgrade
parent
ad6f7e24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
26 deletions
+22
-26
spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
+22
-26
No files found.
spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
View file @
ff39fdb1
import
Vue
from
'
vue
'
;
import
timea
goTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
TimeA
goTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
{
formatDate
,
getTimeago
}
from
'
~/lib/utils/datetime_utility
'
;
describe
(
'
Time ago with tooltip component
'
,
()
=>
{
let
TimeagoTooltip
;
let
vm
;
beforeEach
(()
=>
{
TimeagoTooltip
=
Vue
.
extend
(
timeagoTooltip
);
});
const
buildVm
=
(
propsData
=
{})
=>
{
vm
=
shallowMount
(
TimeAgoTooltip
,
{
attachToDocument
:
true
,
sync
:
false
,
propsData
,
localVue
:
createLocalVue
(),
});
};
const
timestamp
=
'
2017-05-08T14:57:39.781Z
'
;
afterEach
(()
=>
{
vm
.
$
destroy
();
vm
.
destroy
();
});
it
(
'
should render timeago with a bootstrap tooltip
'
,
()
=>
{
vm
=
new
TimeagoTooltip
({
propsData
:
{
time
:
'
2017-05-08T14:57:39.781Z
'
,
},
}).
$mount
();
expect
(
vm
.
$el
.
tagName
).
toEqual
(
'
TIME
'
);
expect
(
vm
.
$el
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
formatDate
(
'
2017-05-08T14:57:39.781Z
'
),
);
buildVm
({
time
:
timestamp
,
});
const
timeago
=
getTimeago
();
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
timeago
.
format
(
'
2017-05-08T14:57:39.781Z
'
));
expect
(
vm
.
attributes
(
'
data-original-title
'
)).
toEqual
(
formatDate
(
timestamp
));
expect
(
vm
.
text
()).
toEqual
(
timeago
.
format
(
timestamp
));
});
it
(
'
should render provided html class
'
,
()
=>
{
vm
=
new
TimeagoTooltip
({
propsData
:
{
time
:
'
2017-05-08T14:57:39.781Z
'
,
cssClass
:
'
foo
'
,
},
}).
$mount
();
buildVm
({
time
:
timestamp
,
cssClass
:
'
foo
'
,
});
expect
(
vm
.
$el
.
classList
.
contains
(
'
foo
'
)).
toEqual
(
true
);
expect
(
vm
.
classes
()).
toContain
(
'
foo
'
);
});
});
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