Let 'c' add a comment on inline diffs even if not all diffs are expanded

Previously, the c key would only add a comment if all inline diffs were
expanded, and hence the diff cursor was in effect. This change lets
comments get added via the 'c' key even when not all diffs are expanded.

Bug: Issue 7017
Change-Id: I443c5be29c6df2cc00b764b8152f0aed6e135f21
This commit is contained in:
Becky Siegel
2018-02-22 11:26:10 -08:00
parent 1fc8edf5c9
commit fc9c4cd981
2 changed files with 5 additions and 1 deletions

View File

@@ -534,7 +534,7 @@
const isRangeSelected = this.diffs.some(diff => {
return diff.isRangeSelected();
}, this);
if (this._showInlineDiffs && !isRangeSelected) {
if (!isRangeSelected) {
e.preventDefault();
this._addDraftAtTarget();
}

View File

@@ -494,6 +494,10 @@ limitations under the License.
MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k');
assert.equal(element.$.fileCursor.index, 0);
assert.equal(element.selectedIndex, 0);
sandbox.stub(element, '_addDraftAtTarget');
MockInteractions.pressAndReleaseKeyOn(element, 67, null, 'c');
assert.isTrue(element._addDraftAtTarget.called);
});
test('i key shows/hides selected inline diff', () => {