Fix issues detected by 'JSHint' and 'JSCS'

Change-Id: Ia535be02d19f09e716f00ec8819ba785010798f7
This commit is contained in:
Urs Wolfer
2016-02-02 21:02:42 +01:00
parent 4c870ca27a
commit 26caed7b8d
37 changed files with 140 additions and 118 deletions

View File

@@ -191,7 +191,9 @@ limitations under the License.
'title-change': '_handleTitleChange',
},
observers: [ '_viewChanged(params.view)' ],
observers: [
'_viewChanged(params.view)',
],
get loggedIn() {
return !!(this.account && Object.keys(this.account).length > 0);
@@ -213,7 +215,7 @@ limitations under the License.
dashboardView: {
selectedChangeIndex: 0,
},
}
};
},
_accountChanged: function() {

View File

@@ -115,7 +115,9 @@ limitations under the License.
},
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
observers: [
'_actionsChanged(actions, _revisionActions)',
@@ -139,7 +141,7 @@ limitations under the License.
},
_getValuesFor: function(obj) {
return Object.keys(obj).map(function (key) {
return Object.keys(obj).map(function(key) {
return obj[key];
});
},
@@ -184,8 +186,8 @@ limitations under the License.
}.bind(this)).catch(function(err) {
alert('Oops. Something went wrong. Check the console and bug the ' +
'PolyGerrit team for assistance.');
throw err;
});
throw err;
});
},
_fireRevisionAction: function(endpoint, action) {
@@ -204,7 +206,7 @@ limitations under the License.
buttonEl.setAttribute('loading', false);
buttonEl.disabled = false;
throw err;
});
});
},
_send: function(method, payload, actionEndpoint, revisionAction) {

View File

@@ -108,7 +108,9 @@ limitations under the License.
},
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
_computeChangeURL: function(changeNum) {
if (!changeNum) { return ''; }
@@ -134,8 +136,8 @@ limitations under the License.
_computeLabelTitle: function(change, labelName) {
var label = change.labels[labelName];
if (!label) { return labelName; }
var significantLabel = label.rejected || label.approved
|| label.disliked || label.recommended;
var significantLabel = label.rejected || label.approved ||
label.disliked || label.recommended;
if (significantLabel && significantLabel.name) {
return labelName + '\nby ' + significantLabel.name;
}

View File

@@ -136,7 +136,9 @@ limitations under the License.
},
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
attached: function() {
this.fire('title-change', {title: this._query});

View File

@@ -121,7 +121,9 @@ limitations under the License.
},
},
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
behaviors: [
Gerrit.KeyboardShortcutBehavior,
],
_computeLabelNames: function(groups) {
var labels = [];
@@ -170,7 +172,7 @@ limitations under the License.
this.groups.forEach(function(group) {
len += group.length;
});
switch(e.keyCode) {
switch (e.keyCode) {
case 74: // 'j'
e.preventDefault();
if (this.selectedIndex == len - 1) { return; }

View File

@@ -369,7 +369,7 @@ limitations under the License.
_handlePatchChange: function(e) {
var patchNum = e.target.value;
var currentPatchNum =
this._change.revisions[this._change.current_revision]._number
this._change.revisions[this._change.current_revision]._number;
if (patchNum == currentPatchNum) {
page.show(this._computeChangePath(this._changeNum));
return;
@@ -467,7 +467,7 @@ limitations under the License.
this.ListChangesOption.ALL_REVISIONS,
this.ListChangesOption.CHANGE_ACTIONS
);
return { O: options };
return {O: options};
},
_computeLatestPatchNum: function(change) {
@@ -483,7 +483,7 @@ limitations under the License.
},
_computePatchIndexIsSelected: function(index, patchNum) {
return this._allPatchSets[index] == patchNum;
return this._allPatchSets[index] == patchNum;
},
_computeLabelNames: function(labels) {
@@ -500,7 +500,7 @@ limitations under the License.
var labelClassName;
var labelValPrefix = '';
if (label.value > 0) {
labelValPrefix = '+'
labelValPrefix = '+';
labelClassName = 'approved';
} else if (label.value < 0) {
labelClassName = 'notApproved';
@@ -518,7 +518,7 @@ limitations under the License.
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
switch(e.keyCode) {
switch (e.keyCode) {
case 65: // 'a'
e.preventDefault();
this.$.replyDropdown.open();

View File

@@ -85,7 +85,9 @@ limitations under the License.
},
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
attached: function() {
this.fire('title-change', {title: 'My Reviews'});

View File

@@ -54,7 +54,6 @@ limitations under the License.
(function() {
'use strict';
Polymer({
is: 'gr-diff-comment-thread',

View File

@@ -157,7 +157,9 @@ limitations under the License.
},
},
observers: [ '_prefsChanged(prefs.*)' ],
observers: [
'_prefsChanged(prefs.*)',
],
_prefsChanged: function(changeRecord) {
var prefs = changeRecord.base;

View File

@@ -174,7 +174,9 @@ limitations under the License.
'tap': '_tapHandler',
},
observers: [ '_prefsChanged(prefs.*)' ],
observers: [
'_prefsChanged(prefs.*)',
],
rowInserted: function(index) {
this.renderLineIndexRange(index, index);
@@ -243,7 +245,7 @@ limitations under the License.
return row.height;
}
var selector = '[data-index="' + index + '"]'
var selector = '[data-index="' + index + '"]';
var els = Polymer.dom(this.root).querySelectorAll(selector);
if (els.length != 2) {
throw Error('Rows should only consist of two elements');
@@ -564,7 +566,7 @@ limitations under the License.
if (numChars > 0 && numChars % this.prefs.line_length == 0) {
indices.push(htmlIndex);
}
htmlIndex = this._advanceChar(html, htmlIndex)
htmlIndex = this._advanceChar(html, htmlIndex);
if (content[i] == '\t') {
numChars += this.prefs.tab_size;
} else {

View File

@@ -204,7 +204,7 @@ limitations under the License.
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
switch(e.keyCode) {
switch (e.keyCode) {
case 219: // '['
e.preventDefault();
this._navToFile(this._fileList, -1);
@@ -217,7 +217,7 @@ limitations under the License.
if (!this._loggedIn) { return; }
this.set('changeViewState.showReplyDropdown', true);
// No break here. Allow to fall through.
/* falls through */ // required by JSHint
case 85: // 'u'
if (this._changeNum) {
e.preventDefault();
@@ -305,7 +305,7 @@ limitations under the License.
},
_computeChangeDetailQueryParams: function() {
return { O: this.listChangesOptionsToHex(
return {O: this.listChangesOptionsToHex(
this.ListChangesOption.ALL_REVISIONS
)};
},

View File

@@ -197,7 +197,9 @@ limitations under the License.
_diffPreferencesPromise: Object, // Used for testing.
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
observers: [
'_prefsChanged(prefs.*)',
@@ -221,7 +223,6 @@ limitations under the License.
];
var basePatchNum = this.patchRange.basePatchNum;
var patchNum = this.patchRange.patchNum;
return app.accountReady.then(function() {
promises.push(this._getCommentsAndDrafts(basePatchNum, app.loggedIn));
@@ -259,8 +260,6 @@ limitations under the License.
},
_getCommentsAndDrafts: function(basePatchNum, loggedIn) {
var promises = [];
function onlyParent(c) { return c.side == 'PARENT'; }
function withoutParent(c) { return c.side != 'PARENT'; }
@@ -543,8 +542,7 @@ limitations under the License.
continue;
}
var chunk = content[i].ab;
var currentChunk = { ab: [] };
var inCommentGroup = false;
var currentChunk = {ab: []};
for (var j = 0; j < chunk.length; j++) {
leftLineNum++;
rightLineNum++;
@@ -554,7 +552,7 @@ limitations under the License.
} else {
if (currentChunk.ab && currentChunk.ab.length > 0) {
result.push(currentChunk);
currentChunk = { ab: [] };
currentChunk = {ab: []};
}
// Append an annotation to indicate that this line should not be
// highlighted even though it's implied with both `a` and `b`
@@ -562,8 +560,8 @@ limitations under the License.
// should be highlighted but are equal (blank lines, for example).
result.push({
__noHighlight: true,
a: [ chunk[j] ],
b: [ chunk[j] ],
a: [chunk[j]],
b: [chunk[j]],
});
}
}
@@ -590,7 +588,7 @@ limitations under the License.
byLine[line] = [];
}
byLine[line].push(c);
}
};
};
allLeft.forEach(mapFunc(leftByLine));
allRight.forEach(mapFunc(rightByLine));
@@ -609,7 +607,7 @@ limitations under the License.
throw Error(
'Left and right ranges for context control should be equal:' +
'Left: [' + leftStart + ', ' + leftEnd + '] ' +
'Right: ['+ rightStart + ', ' + rightEnd + ']');
'Right: [' + rightStart + ', ' + rightEnd + ']');
}
var obj = {
type: 'CONTEXT_CONTROL',
@@ -748,9 +746,9 @@ limitations under the License.
});
}
if (leftComments && !rightComments) {
rightSide.push({ type: 'FILLER' });
rightSide.push({type: 'FILLER'});
} else if (!leftComments && rightComments) {
leftSide.push({ type: 'FILLER' });
leftSide.push({type: 'FILLER'});
}
this._groupedBaseComments[ctx.left.lineNum] = null;
this._groupedComments[ctx.right.lineNum] = null;

View File

@@ -150,7 +150,7 @@ limitations under the License.
var num = patchComments.length;
if (num == 0) { return ''; }
if (num == 1) { return '1 comment'; }
if (num > 1) { return num + ' comments'; };
if (num > 1) { return num + ' comments'; }
},
_computeDraftsURL: function(changeNum, patchNum) {
@@ -161,7 +161,7 @@ limitations under the License.
var num = (drafts[path] || []).length;
if (num == 0) { return ''; }
if (num == 1) { return '1 draft'; }
if (num > 1) { return num + ' drafts'; };
if (num > 1) { return num + ' drafts'; }
},
_handleResponse: function(e, req) {
@@ -173,7 +173,7 @@ limitations under the License.
info.__path = paths[i];
info.lines_inserted = info.lines_inserted || 0;
info.lines_deleted = info.lines_deleted || 0;
files.push(info)
files.push(info);
}
this.files = files;
},
@@ -181,7 +181,7 @@ limitations under the License.
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
switch(e.keyCode) {
switch (e.keyCode) {
case 74: // 'j'
e.preventDefault();
this.selectedIndex =

View File

@@ -105,7 +105,7 @@ limitations under the License.
},
_computeCommentsForMessage: function(comments, message, index) {
var comments = comments || {};
comments = comments || {};
var messages = this.messages || [];
var msgComments = {};
var mDate = util.parseDate(message.date);

View File

@@ -33,7 +33,9 @@ limitations under the License.
Polymer({
is: 'gr-overlay',
behaviors: [ Polymer.IronOverlayBehavior ],
behaviors: [
Polymer.IronOverlayBehavior,
],
});
})();
</script>

View File

@@ -194,7 +194,9 @@ limitations under the License.
_xhrPromise: Object, // Used for testing.
},
behaviors: [ Gerrit.RESTClientBehavior ],
behaviors: [
Gerrit.RESTClientBehavior,
],
get opened() {
return this.$.dropdown.opened;
@@ -234,7 +236,7 @@ limitations under the License.
}
if (total == 0) { return ''; }
if (total == 1) { return '1 Draft'; }
if (total > 1) { return total + ' Drafts'; };
if (total > 1) { return total + ' Drafts'; }
},
_computeLabelArray: function(labelsObj) {

View File

@@ -180,7 +180,9 @@ limitations under the License.
_xhrPromise: Object,
},
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
behaviors: [
Gerrit.KeyboardShortcutBehavior,
],
observers: [
'_reviewersChanged(change.reviewers.*, change.owner)',
@@ -240,7 +242,7 @@ limitations under the License.
_handleResponse: function(e) {
this._autocompleteData = e.detail.response.filter(function(reviewer) {
var account = reviewer.account;
if (!account) return true;
if (!account) { return true; }
for (var i = 0; i < this._reviewers.length; i++) {
if (account._account_id == this.change.owner._account_id ||
account._account_id == this._reviewers[i]._account_id) {
@@ -404,7 +406,7 @@ limitations under the License.
}
this._autocompleteData = [];
this._send('POST', this._restEndpoint(), reviewerID).then(function(req) {
this.change.reviewers['CC'] = this.change.reviewers['CC'] || [];
this.change.reviewers.CC = this.change.reviewers.CC || [];
req.response.reviewers.forEach(function(r) {
this.push('change.removable_reviewers', r);
this.push('change.reviewers.CC', r);

View File

@@ -56,7 +56,9 @@ limitations under the License.
Polymer({
is: 'gr-search-bar',
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
behaviors: [
Gerrit.KeyboardShortcutBehavior,
],
listeners: {
'searchInput.keydown': '_inputKeyDownHandler',
@@ -96,7 +98,7 @@ limitations under the License.
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
switch(e.keyCode) {
switch (e.keyCode) {
case 191: // '/'
e.preventDefault();
var s = this.$.searchInput;

View File

@@ -66,7 +66,7 @@ GrLinkTextParser.prototype.parseLinks = function(text, patterns) {
var pattern = new RegExp(patterns[p].match, 'g');
var match;
while (match = pattern.exec(text)) {
while ((match = pattern.exec(text)) != null) {
var before = text.substr(0, match.index);
this.addText(before);
text = text.substr(match.index + match[0].length);

View File

@@ -42,7 +42,7 @@ util.escapeHTML = function(str) {
util.getCookie = function(name) {
var key = name + '=';
var cookies = document.cookie.split(';');
for(var i = 0; i < cookies.length; i++) {
for (var i = 0; i < cookies.length; i++) {
var c = cookies[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);

View File

@@ -48,7 +48,7 @@ limitations under the License.
'Andrew Bonventre <andybons+gerrit@gmail.com>');
assert.equal(element._computeAccountTitle(
{ name: 'Andrew Bonventre' }),
{name: 'Andrew Bonventre'}),
'Andrew Bonventre');
assert.equal(element._computeShowEmail(true,
@@ -58,10 +58,10 @@ limitations under the License.
}), true);
assert.equal(element._computeShowEmail(true,
{ name: 'Andrew Bonventre' }), false);
{name: 'Andrew Bonventre'}), false);
assert.equal(element._computeShowEmail(false,
{ name: 'Andrew Bonventre' }), false);
{name: 'Andrew Bonventre'}), false);
assert.equal(element._computeShowEmail(
true, undefined), false);

View File

@@ -47,7 +47,7 @@ limitations under the License.
}),
'/q/owner:andybons%2Bgerrit%40gmail.com+status:open');
assert.equal(element._computeOwnerLink({ _account_id: 42 }),
assert.equal(element._computeOwnerLink({_account_id: 42}),
'/q/owner:42+status:open');
});

View File

@@ -45,7 +45,7 @@ limitations under the License.
'/changes/42/revisions/2/actions',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
cherrypick: {
@@ -74,7 +74,7 @@ limitations under the License.
'/changes/42/revisions/2/submit',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n{}', // The response is not used by the element.
]
);

View File

@@ -118,9 +118,9 @@ limitations under the License.
'combustible-stuff', 'lemons'),
'/q/status:open+project:combustible-stuff+branch:lemons');
element.change = { _number: 42 };
element.change = {_number: 42};
assert.equal(element.changeURL, '/c/42/');
element.change = { _number: 43 };
element.change = {_number: 43};
assert.equal(element.changeURL, '/c/43/');
});

View File

@@ -101,7 +101,7 @@ limitations under the License.
assert.equal(element.selectedIndex, 0);
showStub.restore();
done()
done();
}, 1);
});

View File

@@ -51,7 +51,7 @@ limitations under the License.
'/accounts/self/starred.changes/2',
[
204,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
''
]
);
@@ -61,7 +61,7 @@ limitations under the License.
'/accounts/self/starred.changes/2',
[
204,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
''
]
);

View File

@@ -49,7 +49,7 @@ limitations under the License.
/\/changes\/(.*)/,
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n{}',
]
);
@@ -80,9 +80,9 @@ limitations under the License.
element._change = {
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
revisions: {
rev2: { _number: 2 },
rev1: { _number: 1 },
rev3: { _number: 3 },
rev2: {_number: 2},
rev1: {_number: 1},
rev3: {_number: 3},
},
current_revision: 'rev3',
status: 'NEW',

View File

@@ -112,7 +112,7 @@ limitations under the License.
'/changes/42/revisions/1/drafts',
[
201,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n{' +
'"id": "baf0414d_40572e03",' +
'"path": "/path/to/file",' +
@@ -128,7 +128,7 @@ limitations under the License.
/\/changes\/42\/revisions\/1\/drafts\/.+/,
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n{' +
'"id": "baf0414d_40572e03",' +
'"path": "/path/to/file",' +
@@ -165,7 +165,7 @@ limitations under the License.
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
element.editing = true;
assert.isFalse(isVisible(element.$$('.edit')), 'edit is not visible')
assert.isFalse(isVisible(element.$$('.edit')), 'edit is not visible');
assert.isTrue(isVisible(element.$$('.discard')), 'discard is visible');
assert.isTrue(isVisible(element.$$('.save')), 'save is visible');
assert.isFalse(isVisible(element.$$('.cancel')), 'cancel is visible');
@@ -173,9 +173,9 @@ limitations under the License.
assert.isFalse(isVisible(element.$$('.quote')), 'quote is not visible');
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
element.draft = false,
element.draft = false;
element.editing = false;
assert.isFalse(isVisible(element.$$('.edit')), 'edit is not visible')
assert.isFalse(isVisible(element.$$('.edit')), 'edit is not visible');
assert.isFalse(isVisible(element.$$('.discard')),
'discard is not visible');
assert.isFalse(isVisible(element.$$('.save')), 'save is not visible');
@@ -198,7 +198,7 @@ limitations under the License.
// Save should be disabled on an empty message.
var disabled = element.$$('.save').hasAttribute('disabled');
assert.isTrue(disabled, 'save button should be disabled.');
element._editDraft == ' ';
element._editDraft = ' ';
disabled = element.$$('.save').hasAttribute('disabled');
assert.isTrue(disabled, 'save button should be disabled.');

View File

@@ -144,9 +144,9 @@ limitations under the License.
'/changes/41/1/drafts',
[
201,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' + JSON.stringify({
id: "7afa4931_de3d65bd",
id: '7afa4931_de3d65bd',
path: '/path/to/file.txt',
line: 5,
in_reply_to: 'baf0414d_60047215',

View File

@@ -64,7 +64,7 @@ limitations under the License.
});
var cancelPromise = new Promise(function(resolve) {
element.addEventListener('cancel', function() { resolve(); });
})
});
Promise.all([savePromise, cancelPromise]).then(function() {
done();
});

View File

@@ -84,8 +84,8 @@ limitations under the License.
'[[_computeCurrentRevisionMessage(change)]]"></gr-linked-text>';
var html = util.escapeHTML(content);
var highlights = [
{ startIndex: 0, endIndex: 33, },
{ startIndex: 75 },
{startIndex: 0, endIndex: 33},
{startIndex: 75},
];
assert.equal(
content.slice(highlights[0].startIndex, highlights[0].endIndex),
@@ -178,7 +178,7 @@ limitations under the License.
}];
contentEl = element.$$('.content .code[data-line-num="1"]');
assert.ok(contentEl);
var spanEl = contentEl.childNodes[1];
spanEl = contentEl.childNodes[1];
assert.equal(spanEl.tagName, 'SPAN');
assert.isTrue(spanEl.classList.contains(
'style-scope', 'gr-diff-side', 'tab'));
@@ -246,7 +246,7 @@ limitations under the License.
test('tap line to add a draft', function() {
var numAddDraftEvents = 0;
var fireMock = sinon.stub(element, 'fire', function(eventName) {
sinon.stub(element, 'fire', function(eventName) {
if (eventName == 'add-draft') {
numAddDraftEvents++;
}

View File

@@ -52,7 +52,7 @@ limitations under the License.
/\/changes\/42\/revisions\/(1|2)\/files\/sieve\.go\/diff(.*)/,
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
change_type: 'MODIFIED',
@@ -99,7 +99,7 @@ limitations under the License.
'/changes/42/revisions/1/comments',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': [],
@@ -136,7 +136,7 @@ limitations under the License.
'/changes/42/revisions/2/comments',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': [],
@@ -187,9 +187,9 @@ limitations under the License.
'/accounts/self/preferences.diff',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({ context: 25 }),
JSON.stringify({context: 25}),
]
);
@@ -293,7 +293,7 @@ limitations under the License.
newThreadEls[i].classList.contains('commentThread') ||
newThreadEls[i].tagName == 'GR-DIFF-COMMENT-THREAD');
}
var newHeight = newThreadEls[0].offsetHeight
var newHeight = newThreadEls[0].offsetHeight;
assert.equal(newThreadEls[1].offsetHeight, newHeight);
assert.equal(leftFillerEls[0].offsetHeight, newHeight);
assert.equal(leftThreadEls[0].offsetHeight, newHeight);
@@ -317,13 +317,13 @@ limitations under the License.
assert.equal(rightFillerEls[1].offsetHeight, originalHeight);
assert.equal(leftThreadEls[0].offsetHeight, originalHeight);
assert.equal(leftFillerEls[0].offsetHeight, originalHeight);
done()
done();
});
var commentEl = newThreadEls[1].$$('gr-diff-comment');
commentEl.fire('discard', null, {bubbles: false});
}, 1);
}, 1);
}),
});
test('intraline normalization', function() {
// The content and highlights are in the format returned by the Gerrit
@@ -514,8 +514,8 @@ limitations under the License.
10: {},
};
var ctx = {
left: { lineNum: 0 },
right: { lineNum: 0 },
left: {lineNum: 0},
right: {lineNum: 0},
};
var content = [
{

View File

@@ -46,7 +46,7 @@ limitations under the License.
'/changes/42/revisions/1/files',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': {
@@ -68,7 +68,7 @@ limitations under the License.
'/changes/42/revisions/2/files',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': {
@@ -165,14 +165,14 @@ limitations under the License.
test('comment filtering', function() {
var comments = {
'/COMMIT_MSG': [
{ patch_set: 1, message: 'Done' },
{ patch_set: 1, message: 'oh hay' },
{ patch_set: 2, message: 'hello' },
{patch_set: 1, message: 'Done'},
{patch_set: 1, message: 'oh hay'},
{patch_set: 2, message: 'hello'},
],
'myfile.txt': [
{ patch_set: 1, message: 'good news!' },
{ patch_set: 2, message: 'wat!?' },
{ patch_set: 2, message: 'hi' },
{patch_set: 1, message: 'good news!'},
{patch_set: 2, message: 'wat!?'},
{patch_set: 2, message: 'hi'},
],
};
assert.equal(

View File

@@ -93,7 +93,7 @@ limitations under the License.
test('Change-Id pattern was parsed and linked', function() {
// "Change-Id:" pattern.
var changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e'
var changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e';
var prefix = 'Change-Id: ';
element.content = prefix + changeID;
@@ -110,7 +110,6 @@ limitations under the License.
test('Multiple matches', function() {
element.content = 'Issue 3650\nIssue 3450';
var linkEl1 = element.$.output.childNodes[0];
var newlineNode = element.$.output.childNodes[1];
var linkEl2 = element.$.output.childNodes[2];
assert.equal(linkEl1.target, '_blank');

View File

@@ -80,7 +80,7 @@ limitations under the License.
'/changes/42/revisions/1/review',
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
'{' +
'"labels": {' +
@@ -154,7 +154,7 @@ limitations under the License.
message: 'I wholeheartedly disapprove'
});
assert.equal(req.response.labels['Code-Review'], -1);
assert.equal(req.response.labels['Verified'], -1);
assert.equal(req.response.labels.Verified, -1);
assert.isFalse(element.opened);
done();
});

View File

@@ -45,27 +45,27 @@ limitations under the License.
/\/changes\/42\/suggest_reviewers\?n=10&q=andy(.*)/,
[
200,
{ 'Content-Type': 'application/json' },
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify([
{
account: {
_account_id: 1021482,
name: "Andrew Bonventre",
email: "andybons@chromium.org",
name: 'Andrew Bonventre',
email: 'andybons@chromium.org',
}
},
{
account: {
_account_id: 1021863,
name: "Andrew Bonventre",
email: "andybons@google.com",
name: 'Andrew Bonventre',
email: 'andybons@google.com',
}
},
{
"group": {
"id": "c7af6dd375c092ff3b23c0937aa910693dc0c41b",
"name": "andy"
group: {
id: 'c7af6dd375c092ff3b23c0937aa910693dc0c41b',
name: 'andy',
}
}
]),
@@ -76,7 +76,7 @@ limitations under the License.
'/changes/42/reviewers',
[
200,
{ 'Content-Type': 'application/json'},
{'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
reviewers: [{
@@ -95,7 +95,7 @@ limitations under the License.
'/changes/42/reviewers/1021482',
[
204,
{ 'Content-Type': 'application/json'},
{'Content-Type': 'application/json'},
')]}\'\n{}',
]
);
@@ -198,7 +198,8 @@ limitations under the License.
function() {
assert(false, 'generateRequest should not be called for input ' +
'lengths of less than 3 chars');
});
}
);
element._inputVal = 'fo';
flushAsynchronousOperations();
genRequestStub.restore();
@@ -209,7 +210,7 @@ limitations under the License.
_number: 42,
reviewers: {},
removable_reviewers: [],
owner: { _account_id: 0 },
owner: {_account_id: 0},
};
element._inputRequestTimeout = 0;
element._mutable = true;

View File

@@ -23,7 +23,8 @@ limitations under the License.
<script>
var testFiles = [];
[ 'gr-account-dropdown-test.html',
[
'gr-account-dropdown-test.html',
'gr-account-label-test.html',
'gr-account-link-test.html',
'gr-avatar-test.html',