Fix an outdated test
Change-Id: I178b63bab5bfaf6ddf348804f33448c13dc38046
This commit is contained in:
@@ -65,6 +65,9 @@ class GrConfirmRevertSubmissionDialog extends GestureEventListeners(
|
||||
}
|
||||
|
||||
_populateRevertSubmissionMessage(message, change, changes) {
|
||||
if (change === undefined) {
|
||||
return;
|
||||
}
|
||||
// Follow the same convention of the revert
|
||||
const commitHash = change.current_revision;
|
||||
if (!commitHash) {
|
||||
@@ -79,12 +82,14 @@ class GrConfirmRevertSubmissionDialog extends GestureEventListeners(
|
||||
this.changes = changes;
|
||||
this.message = revertTitle + '\n\n' +
|
||||
'Reason for revert: <INSERT REASONING HERE>\n';
|
||||
this.message += 'Reverted Changes:\n';
|
||||
changes = changes || [];
|
||||
changes.forEach(change => {
|
||||
this.message += change.change_id.substring(0, 10) + ': ' +
|
||||
this._getTrimmedChangeSubject(change.subject) + '\n';
|
||||
});
|
||||
if (changes.length) {
|
||||
this.message += 'Reverted Changes:\n';
|
||||
changes.forEach(change => {
|
||||
this.message += change.change_id.substring(0, 10) + ': ' +
|
||||
this._getTrimmedChangeSubject(change.subject) + '\n';
|
||||
});
|
||||
}
|
||||
this.message = this._modifyRevertSubmissionMsg(change);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
|
||||
setup(() => {
|
||||
element = fixture('basic');
|
||||
sandbox =sinon.sandbox.create();
|
||||
sandbox = sinon.sandbox.create();
|
||||
});
|
||||
|
||||
teardown(() => sandbox.restore());
|
||||
@@ -51,7 +51,7 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
const alertStub = sandbox.stub();
|
||||
element.addEventListener('show-alert', alertStub);
|
||||
element._populateRevertSubmissionMessage(
|
||||
'not a commitHash in sight'
|
||||
'not a commitHash in sight', {}
|
||||
);
|
||||
assert.isTrue(alertStub.calledOnce);
|
||||
});
|
||||
@@ -60,8 +60,8 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
assert.isNotOk(element.message);
|
||||
element._populateRevertSubmissionMessage(
|
||||
'one line commit\n\nChange-Id: abcdefg\n',
|
||||
'abcd123');
|
||||
const expected = 'Revert submission\n\n' +
|
||||
{current_revision: 'abcd123', submission_id: '111'});
|
||||
const expected = 'Revert submission 111\n\n' +
|
||||
'Reason for revert: <INSERT REASONING HERE>\n';
|
||||
assert.equal(element.message, expected);
|
||||
});
|
||||
@@ -70,8 +70,8 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
assert.isNotOk(element.message);
|
||||
element._populateRevertSubmissionMessage(
|
||||
'many lines\ncommit\n\nmessage\n\nChange-Id: abcdefg\n',
|
||||
'abcd123');
|
||||
const expected = 'Revert submission\n\n' +
|
||||
{current_revision: 'abcd123', submission_id: '111'});
|
||||
const expected = 'Revert submission 111\n\n' +
|
||||
'Reason for revert: <INSERT REASONING HERE>\n';
|
||||
assert.equal(element.message, expected);
|
||||
});
|
||||
@@ -80,8 +80,8 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
assert.isNotOk(element.message);
|
||||
element._populateRevertSubmissionMessage(
|
||||
'test \nvery\n\ncommit\n\nBug: Issue 42\nChange-Id: abcdefg\n',
|
||||
'abcd123');
|
||||
const expected = 'Revert submission\n\n' +
|
||||
{current_revision: 'abcd123', submission_id: '111'});
|
||||
const expected = 'Revert submission 111\n\n' +
|
||||
'Reason for revert: <INSERT REASONING HERE>\n';
|
||||
assert.equal(element.message, expected);
|
||||
});
|
||||
@@ -90,8 +90,8 @@ suite('gr-confirm-revert-submission-dialog tests', () => {
|
||||
assert.isNotOk(element.message);
|
||||
element._populateRevertSubmissionMessage(
|
||||
'Revert "one line commit"\n\nChange-Id: abcdefg\n',
|
||||
'abcd123');
|
||||
const expected = 'Revert submission\n\n' +
|
||||
{current_revision: 'abcd123', submission_id: '111'});
|
||||
const expected = 'Revert submission 111\n\n' +
|
||||
'Reason for revert: <INSERT REASONING HERE>\n';
|
||||
assert.equal(element.message, expected);
|
||||
});
|
||||
|
||||
@@ -66,6 +66,7 @@ const elements = [
|
||||
'change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.html',
|
||||
'change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.html',
|
||||
'change/gr-confirm-revert-dialog/gr-confirm-revert-dialog_test.html',
|
||||
'change/gr-confirm-revert-submission-dialog/gr-confirm-revert-submission-dialog_test.html',
|
||||
'change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.html',
|
||||
'change/gr-download-dialog/gr-download-dialog_test.html',
|
||||
'change/gr-file-list-header/gr-file-list-header_test.html',
|
||||
|
||||
Reference in New Issue
Block a user