Fix focus layer not showing up in diff view
The focus layer was not showing up in the diff view because the
`annotated` property was not being set to true. This property is
used to determine whether or not the focus layer should be shown.
Change-Id: I29f3037653be62e669140c1916601d3a69e3ec85
Release-Notes: skip
Google-Bug-Id: b/345126277
diff --git a/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer.ts b/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer.ts
index b3d780e..6d55b0f 100644
--- a/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer.ts
+++ b/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer.ts
@@ -83,6 +83,7 @@
_line: GrDiffLine,
side: Side
) {
+ this.annotated = true;
if (!lineNumberEl || !textEl || !this.diffRangesToFocus) {
return;
}
diff --git a/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer_test.ts b/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer_test.ts
index fc61d21..f76ddef 100644
--- a/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-focus-layer/gr-focus-layer_test.ts
@@ -117,6 +117,11 @@
layer.setRanges(RANGES);
});
+ test('annotated is true after annotate', () => {
+ assert.isFalse(hasOutOfFocusClass(1, Side.LEFT));
+ assert.isTrue(layer.annotated);
+ });
+
test('line 1-2 are focussed on both sides', () => {
assert.isFalse(hasOutOfFocusClass(1, Side.LEFT));
assert.isFalse(hasOutOfFocusClass(2, Side.RIGHT));