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
7336fe61
Commit
7336fe61
authored
Sep 10, 2021
by
Dheeraj Joshi
Committed by
Ezekiel Kigbo
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swaps out v-html with GlSprintf in MR widget
parent
c6904269
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
ee/app/assets/javascripts/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue
...dget/components/merge_immediately_confirmation_dialog.vue
+13
-15
ee/spec/frontend/vue_mr_widget/components/merge_immediately_confirmation_dialog_spec.js
.../components/merge_immediately_confirmation_dialog_spec.js
+6
-2
No files found.
ee/app/assets/javascripts/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue
View file @
7336fe61
<
script
>
import
{
GlModal
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
escape
}
from
'
lodash
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
GlModal
,
GlButton
,
GlSprintf
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
export
default
{
name
:
'
MergeImmediatelyConfirmationDialog
'
,
components
:
{
GlModal
,
GlButton
,
GlSprintf
,
GlLink
,
},
props
:
{
docsUrl
:
{
...
...
@@ -17,17 +18,8 @@ export default {
},
computed
:
{
bodyText
()
{
return
sprintf
(
__
(
return
__
(
"
Merging immediately isn't recommended as it may negatively impact the existing merge train. Read the %{docsLinkStart}documentation%{docsLinkEnd} for more information.
"
,
),
{
docsLinkStart
:
`<a href="
${
escape
(
this
.
docsUrl
,
)}
" target="_blank" rel="noopener noreferrer">`
,
docsLinkEnd
:
'
</a>
'
,
},
false
,
);
},
},
...
...
@@ -58,7 +50,13 @@ export default {
:title=
"__('Merge immediately')"
@
shown=
"focusCancelButton"
>
<p
v-html=
"bodyText /* eslint-disable-line vue/no-v-html */"
></p>
<p>
<gl-sprintf
:message=
"bodyText"
>
<template
#docsLink
="
{ content }">
<gl-link
:href=
"docsUrl"
target=
"_blank"
>
{{
content
}}
</gl-link>
</
template
>
</gl-sprintf>
</p>
<p>
{{ __('Are you sure you want to merge immediately?') }}
</p>
<
template
#modal-footer
>
<gl-button
ref=
"cancelButton"
@
click=
"cancel"
>
{{
__
(
'
Cancel
'
)
}}
</gl-button>
...
...
ee/spec/frontend/vue_mr_widget/components/merge_immediately_confirmation_dialog_spec.js
View file @
7336fe61
import
{
GlSprintf
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
MergeImmediatelyConfirmationDialog
from
'
ee/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
...
...
@@ -9,6 +10,9 @@ describe('MergeImmediatelyConfirmationDialog', () => {
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
MergeImmediatelyConfirmationDialog
,
{
propsData
:
{
docsUrl
},
stubs
:
{
GlSprintf
,
},
});
return
wrapper
.
vm
.
$nextTick
();
...
...
@@ -21,10 +25,10 @@ describe('MergeImmediatelyConfirmationDialog', () => {
});
it
(
'
should render a link to the documentation
'
,
()
=>
{
const
docsLink
=
wrapper
.
find
(
`a[href="
${
docsUrl
}
"]`
);
const
docsLink
=
wrapper
.
find
Component
(
GlLink
);
expect
(
docsLink
.
exists
()).
toBe
(
true
);
expect
(
docsLink
.
attributes
(
).
rel
).
toBe
(
'
noopener noreferrer
'
);
expect
(
docsLink
.
attributes
(
'
href
'
)).
toBe
(
docsUrl
);
expect
(
trimText
(
docsLink
.
text
())).
toBe
(
'
documentation
'
);
});
...
...
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