Add new slot for ported threads without a range
Change-Id: I5f4ecb35d4ecee6f56db7ae7a3029ce88775c5c7
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.ts b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.ts
index a0584b6..034081d 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.ts
@@ -22,6 +22,7 @@
GrDiffLineType,
FILE,
Highlights,
+ LineNumber,
} from '../gr-diff/gr-diff-line';
import {
GrDiffGroup,
@@ -150,7 +151,8 @@
this.cancel();
this.groups = [];
- this.push('groups', this._makeFileComments());
+ this.push('groups', this._makeGroup('LOST'));
+ this.push('groups', this._makeGroup(FILE));
// If it's a binary diff, we won't be rendering hunks of text differences
// so finish processing.
@@ -450,10 +452,10 @@
return line;
}
- _makeFileComments() {
+ _makeGroup(number: LineNumber) {
const line = new GrDiffLine(GrDiffLineType.BOTH);
- line.beforeNumber = FILE;
- line.afterNumber = FILE;
+ line.beforeNumber = number;
+ line.afterNumber = number;
return new GrDiffGroup(GrDiffGroupType.BOTH, [line]);
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor_test.js b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor_test.js
index f5cbcc0..b8f7498 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor_test.js
@@ -73,7 +73,7 @@
return element.process(content).then(() => {
const groups = element.groups;
-
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
assert.equal(groups.length, 4);
let group = groups[0];
@@ -133,6 +133,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
assert.equal(groups[0].type, GrDiffGroupType.BOTH);
assert.equal(groups[0].lines.length, 1);
@@ -153,6 +154,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
@@ -185,6 +187,7 @@
await element.process(content);
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
@@ -231,6 +234,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
@@ -252,6 +256,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the "a" group
@@ -283,6 +288,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the "a" group
@@ -324,6 +330,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the "a" group
@@ -411,6 +418,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the "a" group
@@ -450,6 +458,7 @@
return element.process(content).then(() => {
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the "a" group
@@ -479,6 +488,7 @@
await element.process(content);
const groups = element.groups;
+ groups.shift(); // remove portedThreadsWithoutRangeGroup
// group[0] is the file group
// group[1] is the chunk with a
@@ -744,12 +754,12 @@
element._isScrolling = true;
element.process(content);
// Just the files group - no more processing during scrolling.
- assert.equal(element.groups.length, 1);
+ assert.equal(element.groups.length, 2);
element._isScrolling = false;
element.process(content);
// More groups have been processed. How many does not matter here.
- assert.isAtLeast(element.groups.length, 2);
+ assert.isAtLeast(element.groups.length, 3);
});
test('image diffs', () => {
@@ -762,7 +772,7 @@
const content = _.times(200, _.constant(contentRow));
sinon.stub(element, 'async');
element.process(content, true);
- assert.equal(element.groups.length, 1);
+ assert.equal(element.groups.length, 2);
// Image diffs don't process content, just the 'FILE' line.
assert.equal(element.groups[0].lines.length, 1);