Commit 0eb13627 authored by Fernando's avatar Fernando

Maintainer feedback changes

* Tweak styles
* Refactor diff_utils
parent f5aa8ce3
......@@ -36,13 +36,13 @@ export default {
return this.diffData.filter(this.shouldShowLine);
},
isDiffView() {
return this.view === VIEW_TYPES.DIFF;
return this.view === this.$options.viewTypes.DIFF;
},
isBeforeView() {
return this.view === VIEW_TYPES.BEFORE;
return this.view === this.$options.viewTypes.BEFORE;
},
isAfterView() {
return this.view === VIEW_TYPES.AFTER;
return this.view === this.$options.viewTypes.AFTER;
},
},
methods: {
......@@ -110,10 +110,10 @@ export default {
class="line_holder"
data-testid="diffLine"
>
<td class="diff-line-num old_line gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
<td class="diff-line-num gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
{{ line.oldLine }}
</td>
<td class="diff-line-num new_line gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
<td class="diff-line-num gl-border-t-0 gl-border-b-0" :class="changeClass(line)">
{{ line.newLine }}
</td>
<td data-testid="diffContent" class="line_content" :class="changeClass(line)">
......
......@@ -8,11 +8,11 @@ import { LINE_TYPES } from './constants';
export function splitAction(action) {
const splitValues = action.value.split(/(\n)/);
if (
splitValues.length >= 2 &&
splitValues[splitValues.length - 1] === '' &&
splitValues[splitValues.length - 2] === '\n'
) {
const isEmptyCharacter = splitValues[splitValues.length - 1] === '';
const isNewLine = splitValues[splitValues.length - 2] === '\n';
if (splitValues.length >= 2 && isEmptyCharacter && isNewLine) {
splitValues.pop();
}
return splitValues.map((splitValue) => ({
......@@ -110,14 +110,12 @@ function splitLinesInline(lines) {
export function groupActionsByLines(actions) {
const res = [];
let currLine = null;
let currLine = { actions: [] };
const newLine = () => {
if (currLine !== null) {
res.push(currLine);
}
res.push(currLine);
currLine = { actions: [] };
};
newLine();
actions.forEach((action) => {
if (action.added) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment