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
08359a8e
Commit
08359a8e
authored
Jun 21, 2019
by
Samantha Ming
Committed by
Phil Hughes
Jun 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back trimChar method to remove trailing +/-
Add test for checking output
parent
75b3f26a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
app/assets/javascripts/notes/components/diff_with_note.vue
app/assets/javascripts/notes/components/diff_with_note.vue
+6
-1
changelogs/unreleased/59028-fix-extra-plus-in-diffs.yml
changelogs/unreleased/59028-fix-extra-plus-in-diffs.yml
+5
-0
spec/javascripts/notes/components/diff_with_note_spec.js
spec/javascripts/notes/components/diff_with_note_spec.js
+13
-0
No files found.
app/assets/javascripts/notes/components/diff_with_note.vue
View file @
08359a8e
...
...
@@ -7,6 +7,8 @@ import { GlSkeletonLoading } from '@gitlab/ui';
import
{
getDiffMode
}
from
'
~/diffs/store/utils
'
;
import
{
diffViewerModes
}
from
'
~/ide/constants
'
;
const
FIRST_CHAR_REGEX
=
/^
(\+
|-|
)
/
;
export
default
{
components
:
{
DiffFileHeader
,
...
...
@@ -59,6 +61,9 @@ export default {
this
.
error
=
true
;
});
},
trimChar
(
line
)
{
return
line
.
replace
(
FIRST_CHAR_REGEX
,
''
);
},
},
userColorSchemeClass
:
window
.
gon
.
user_color_scheme
,
};
...
...
@@ -83,7 +88,7 @@ export default {
>
<td
:class=
"line.type"
class=
"diff-line-num old_line"
>
{{
line
.
old_line
}}
</td>
<td
:class=
"line.type"
class=
"diff-line-num new_line"
>
{{
line
.
new_line
}}
</td>
<td
:class=
"line.type"
class=
"line_content"
v-html=
"
line.rich_text
"
></td>
<td
:class=
"line.type"
class=
"line_content"
v-html=
"
trimChar(line.rich_text)
"
></td>
</tr>
</
template
>
<tr
v-if=
"!hasTruncatedDiffLines"
class=
"line_holder line-holder-placeholder"
>
...
...
changelogs/unreleased/59028-fix-extra-plus-in-diffs.yml
0 → 100644
View file @
08359a8e
---
title
:
Remove duplicate trailing +/- char in merge request discussions
merge_request
:
29518
author
:
type
:
fixed
spec/javascripts/notes/components/diff_with_note_spec.js
View file @
08359a8e
...
...
@@ -47,6 +47,19 @@ describe('diff_with_note', () => {
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
});
it
(
'
removes trailing "+" char
'
,
()
=>
{
const
richText
=
vm
.
$el
.
querySelectorAll
(
'
.line_holder
'
)[
4
].
querySelector
(
'
.line_content
'
)
.
textContent
[
0
];
expect
(
richText
).
not
.
toEqual
(
'
+
'
);
});
it
(
'
removes trailing "-" char
'
,
()
=>
{
const
richText
=
vm
.
$el
.
querySelector
(
'
#LC13
'
).
parentNode
.
textContent
[
0
];
expect
(
richText
).
not
.
toEqual
(
'
-
'
);
});
it
(
'
shows text diff
'
,
()
=>
{
expect
(
selectors
.
container
).
toHaveClass
(
'
text-file
'
);
expect
(
selectors
.
diffTable
).
toExist
();
...
...
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