Show helpful instructions if change has Merge conflicts

* If the change has Merge Conflicts, then we show the user some helpful error
message in the tooltip of the change.

Bug: Issue 11501
Change-Id: I14a6b911ecd5a6798adcfe593a9e11a3959e803b
(cherry picked from commit 319ce419fa)
This commit is contained in:
Dhruv Srivastava
2019-11-12 08:41:10 -08:00
committed by Paladox none
parent 6c96ed67c6
commit fe186da19c
2 changed files with 21 additions and 3 deletions

View File

@@ -29,6 +29,10 @@
'It will not appear on dashboards unless you are CC\'ed or assigned, ' +
'and email notifications will be silenced until the review is started.';
const MERGE_CONFLICT_TOOLTIP = 'This change has merge conflicts. ' +
'Download the patch and run "git rebase master". ' +
'Upload a new patchset after resolving all merge conflicts.';
const PRIVATE_TOOLTIP = 'This change is only visible to its owner and ' +
'current reviewers (or anyone with "View Private Changes" permission).';
@@ -75,6 +79,9 @@
case ChangeStates.PRIVATE:
this.tooltipText = PRIVATE_TOOLTIP;
break;
case ChangeStates.MERGE_CONFLICT:
this.tooltipText = MERGE_CONFLICT_TOOLTIP;
break;
default:
this.tooltipText = '';
break;

View File

@@ -35,6 +35,17 @@ limitations under the License.
</test-fixture>
<script>
const WIP_TOOLTIP = 'This change isn\'t ready to be reviewed or submitted. ' +
'It will not appear on dashboards unless you are CC\'ed or assigned, ' +
'and email notifications will be silenced until the review is started.';
const MERGE_CONFLICT_TOOLTIP = 'This change has merge conflicts. ' +
'Download the patch and run "git rebase master". ' +
'Upload a new patchset after resolving all merge conflicts.';
const PRIVATE_TOOLTIP = 'This change is only visible to its owner and ' +
'current reviewers (or anyone with "View Private Changes" permission).';
suite('gr-change-status tests', () => {
let element;
let sandbox;
@@ -51,7 +62,7 @@ limitations under the License.
test('WIP', () => {
element.status = 'WIP';
assert.equal(element.$$('.chip').innerText, 'Work in Progress');
assert.isDefined(element.tooltipText);
assert.equal(element.tooltipText, WIP_TOOLTIP);
assert.isTrue(element.classList.contains('wip'));
});
@@ -81,14 +92,14 @@ limitations under the License.
test('merge conflict', () => {
element.status = 'Merge Conflict';
assert.equal(element.$$('.chip').innerText, element.status);
assert.equal(element.tooltipText, '');
assert.equal(element.tooltipText, MERGE_CONFLICT_TOOLTIP);
assert.isTrue(element.classList.contains('merge-conflict'));
});
test('private', () => {
element.status = 'Private';
assert.equal(element.$$('.chip').innerText, element.status);
assert.isDefined(element.tooltipText);
assert.equal(element.tooltipText, PRIVATE_TOOLTIP);
assert.isTrue(element.classList.contains('private'));
});