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
8e28f283
Commit
8e28f283
authored
Mar 12, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate mr_widget_author_time to VTU
parent
195d5f87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
spec/frontend/vue_mr_widget/components/mr_widget_author_time_spec.js
...nd/vue_mr_widget/components/mr_widget_author_time_spec.js
+22
-21
No files found.
spec/frontend/vue_mr_widget/components/mr_widget_author_time_spec.js
View file @
8e28f283
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
MrWidgetAuthor
from
'
~/vue_merge_request_widget/components/mr_widget_author.vue
'
;
import
MrWidgetAuthorTime
from
'
~/vue_merge_request_widget/components/mr_widget_author_time.vue
'
;
describe
(
'
MrWidgetAuthorTime
'
,
()
=>
{
let
vm
;
let
wrapper
;
const
defaultProps
=
{
actionText
:
'
Merged by
'
,
author
:
{
name
:
'
Administrator
'
,
username
:
'
root
'
,
webUrl
:
'
http://localhost:3000/root
'
,
avatarUrl
:
'
http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon
'
,
},
dateTitle
:
'
2017-03-23T23:02:00.807Z
'
,
dateReadable
:
'
12 hours ago
'
,
};
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
MrWidgetAuthorTime
);
vm
=
mountComponent
(
Component
,
{
actionText
:
'
Merged by
'
,
author
:
{
name
:
'
Administrator
'
,
username
:
'
root
'
,
webUrl
:
'
http://localhost:3000/root
'
,
avatarUrl
:
'
http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon
'
,
},
dateTitle
:
'
2017-03-23T23:02:00.807Z
'
,
dateReadable
:
'
12 hours ago
'
,
wrapper
=
shallowMount
(
MrWidgetAuthorTime
,
{
propsData
:
defaultProps
,
});
});
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
it
(
'
renders provided action text
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Merged by
'
);
expect
(
wrapper
.
text
()
).
toContain
(
'
Merged by
'
);
});
it
(
'
renders author
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Administrator
'
);
expect
(
wrapper
.
find
(
MrWidgetAuthor
).
props
(
'
author
'
)).
toStrictEqual
(
defaultProps
.
author
);
});
it
(
'
renders provided time
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
time
'
).
getAttribute
(
'
title
'
)).
toEqual
(
'
2017-03-23T23:02:00.807Z
'
);
expect
(
wrapper
.
find
(
'
time
'
).
attributes
(
'
title
'
)).
toBe
(
'
2017-03-23T23:02:00.807Z
'
);
expect
(
vm
.
$el
.
querySelector
(
'
time
'
).
textContent
.
trim
()).
toEqual
(
'
12 hours ago
'
);
expect
(
wrapper
.
find
(
'
time
'
).
text
().
trim
()).
toBe
(
'
12 hours ago
'
);
});
});
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