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
18e84556
Commit
18e84556
authored
Mar 12, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate mr_widget_related_links to VTU
parent
195d5f87
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
24 deletions
+27
-24
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
.../vue_mr_widget/components/mr_widget_related_links_spec.js
+27
-24
No files found.
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
View file @
18e84556
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
relatedLinksComponent
from
'
~/vue_merge_request_widget/components/mr_widget_related_links.vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
RelatedLinks
from
'
~/vue_merge_request_widget/components/mr_widget_related_links.vue
'
;
describe
(
'
MRWidgetRelatedLinks
'
,
()
=>
{
let
vm
;
let
wrapper
;
const
createComponent
=
(
data
)
=>
{
const
Component
=
Vue
.
extend
(
relatedLinksComponent
);
return
mountComponent
(
Component
,
data
);
const
createComponent
=
(
propsData
=
{})
=>
{
wrapper
=
shallowMount
(
RelatedLinks
,
{
propsData
});
};
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
closesText
'
,
()
=>
{
it
(
'
returns Closes text for open merge request
'
,
()
=>
{
vm
=
createComponent
({
state
:
'
open
'
,
relatedLinks
:
{}
});
createComponent
({
state
:
'
open
'
,
relatedLinks
:
{}
});
expect
(
vm
.
closesText
).
toEqual
(
'
Closes
'
);
expect
(
wrapper
.
vm
.
closesText
).
toBe
(
'
Closes
'
);
});
it
(
'
returns correct text for closed merge request
'
,
()
=>
{
vm
=
createComponent
({
state
:
'
closed
'
,
relatedLinks
:
{}
});
createComponent
({
state
:
'
closed
'
,
relatedLinks
:
{}
});
expect
(
vm
.
closesText
).
toEqual
(
'
Did not close
'
);
expect
(
wrapper
.
vm
.
closesText
).
toBe
(
'
Did not close
'
);
});
it
(
'
returns correct tense for merged request
'
,
()
=>
{
vm
=
createComponent
({
state
:
'
merged
'
,
relatedLinks
:
{}
});
createComponent
({
state
:
'
merged
'
,
relatedLinks
:
{}
});
expect
(
vm
.
closesText
).
toEqual
(
'
Closed
'
);
expect
(
wrapper
.
vm
.
closesText
).
toBe
(
'
Closed
'
);
});
});
});
it
(
'
should have only have closing issues text
'
,
()
=>
{
vm
=
createComponent
({
createComponent
({
relatedLinks
:
{
closing
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
},
});
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
const
content
=
wrapper
.
text
()
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
trim
();
expect
(
content
).
toContain
(
'
Closes #23 and #42
'
);
expect
(
content
).
not
.
toContain
(
'
Mentions
'
);
});
it
(
'
should have only have mentioned issues text
'
,
()
=>
{
vm
=
createComponent
({
createComponent
({
relatedLinks
:
{
mentioned
:
'
<a href="#">#7</a>
'
,
},
});
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Mentions #7
'
);
expect
(
vm
.
$el
.
innerText
).
not
.
toContain
(
'
Closes
'
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
'
Mentions #7
'
);
expect
(
wrapper
.
text
().
trim
()
).
not
.
toContain
(
'
Closes
'
);
});
it
(
'
should have closing and mentioned issues at the same time
'
,
()
=>
{
vm
=
createComponent
({
createComponent
({
relatedLinks
:
{
closing
:
'
<a href="#">#7</a>
'
,
mentioned
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
},
});
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
const
content
=
wrapper
.
text
()
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
trim
();
expect
(
content
).
toContain
(
'
Closes #7
'
);
expect
(
content
).
toContain
(
'
Mentions #23 and #42
'
);
});
it
(
'
should have assing issues link
'
,
()
=>
{
vm
=
createComponent
({
createComponent
({
relatedLinks
:
{
assignToMe
:
'
<a href="#">Assign yourself to these issues</a>
'
,
},
});
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Assign yourself to these issues
'
);
expect
(
wrapper
.
text
().
trim
()
).
toContain
(
'
Assign yourself to these issues
'
);
});
});
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