Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ia535be02d19f09e716f00ec8819ba785010798f7
diff --git a/polygerrit-ui/app/elements/gr-app.html b/polygerrit-ui/app/elements/gr-app.html
index 7a5cd77e..ecffaa0 100644
--- a/polygerrit-ui/app/elements/gr-app.html
+++ b/polygerrit-ui/app/elements/gr-app.html
@@ -191,7 +191,9 @@
'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 @@
dashboardView: {
selectedChangeIndex: 0,
},
- }
+ };
},
_accountChanged: function() {
diff --git a/polygerrit-ui/app/elements/gr-change-actions.html b/polygerrit-ui/app/elements/gr-change-actions.html
index c84ce7b..850ecb7 100644
--- a/polygerrit-ui/app/elements/gr-change-actions.html
+++ b/polygerrit-ui/app/elements/gr-change-actions.html
@@ -115,7 +115,9 @@
},
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
observers: [
'_actionsChanged(actions, _revisionActions)',
@@ -139,7 +141,7 @@
},
_getValuesFor: function(obj) {
- return Object.keys(obj).map(function (key) {
+ return Object.keys(obj).map(function(key) {
return obj[key];
});
},
@@ -184,8 +186,8 @@
}.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 @@
buttonEl.setAttribute('loading', false);
buttonEl.disabled = false;
throw err;
- });
+ });
},
_send: function(method, payload, actionEndpoint, revisionAction) {
diff --git a/polygerrit-ui/app/elements/gr-change-list-item.html b/polygerrit-ui/app/elements/gr-change-list-item.html
index 007b554..5099365f 100644
--- a/polygerrit-ui/app/elements/gr-change-list-item.html
+++ b/polygerrit-ui/app/elements/gr-change-list-item.html
@@ -108,7 +108,9 @@
},
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
_computeChangeURL: function(changeNum) {
if (!changeNum) { return ''; }
@@ -134,8 +136,8 @@
_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;
}
diff --git a/polygerrit-ui/app/elements/gr-change-list-view.html b/polygerrit-ui/app/elements/gr-change-list-view.html
index ff0d7f1..13959c5 100644
--- a/polygerrit-ui/app/elements/gr-change-list-view.html
+++ b/polygerrit-ui/app/elements/gr-change-list-view.html
@@ -136,7 +136,9 @@
},
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
attached: function() {
this.fire('title-change', {title: this._query});
diff --git a/polygerrit-ui/app/elements/gr-change-list.html b/polygerrit-ui/app/elements/gr-change-list.html
index 916f453..df383fb 100644
--- a/polygerrit-ui/app/elements/gr-change-list.html
+++ b/polygerrit-ui/app/elements/gr-change-list.html
@@ -121,7 +121,9 @@
},
},
- behaviors: [ Gerrit.KeyboardShortcutBehavior ],
+ behaviors: [
+ Gerrit.KeyboardShortcutBehavior,
+ ],
_computeLabelNames: function(groups) {
var labels = [];
@@ -170,7 +172,7 @@
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; }
diff --git a/polygerrit-ui/app/elements/gr-change-view.html b/polygerrit-ui/app/elements/gr-change-view.html
index eeffc27..71193de 100644
--- a/polygerrit-ui/app/elements/gr-change-view.html
+++ b/polygerrit-ui/app/elements/gr-change-view.html
@@ -369,7 +369,7 @@
_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 @@
this.ListChangesOption.ALL_REVISIONS,
this.ListChangesOption.CHANGE_ACTIONS
);
- return { O: options };
+ return {O: options};
},
_computeLatestPatchNum: function(change) {
@@ -483,7 +483,7 @@
},
_computePatchIndexIsSelected: function(index, patchNum) {
- return this._allPatchSets[index] == patchNum;
+ return this._allPatchSets[index] == patchNum;
},
_computeLabelNames: function(labels) {
@@ -500,7 +500,7 @@
var labelClassName;
var labelValPrefix = '';
if (label.value > 0) {
- labelValPrefix = '+'
+ labelValPrefix = '+';
labelClassName = 'approved';
} else if (label.value < 0) {
labelClassName = 'notApproved';
@@ -518,7 +518,7 @@
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
- switch(e.keyCode) {
+ switch (e.keyCode) {
case 65: // 'a'
e.preventDefault();
this.$.replyDropdown.open();
diff --git a/polygerrit-ui/app/elements/gr-dashboard-view.html b/polygerrit-ui/app/elements/gr-dashboard-view.html
index d1877353..dbfc85d 100644
--- a/polygerrit-ui/app/elements/gr-dashboard-view.html
+++ b/polygerrit-ui/app/elements/gr-dashboard-view.html
@@ -85,7 +85,9 @@
},
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
attached: function() {
this.fire('title-change', {title: 'My Reviews'});
diff --git a/polygerrit-ui/app/elements/gr-diff-comment-thread.html b/polygerrit-ui/app/elements/gr-diff-comment-thread.html
index def6a3b..178b417 100644
--- a/polygerrit-ui/app/elements/gr-diff-comment-thread.html
+++ b/polygerrit-ui/app/elements/gr-diff-comment-thread.html
@@ -54,7 +54,6 @@
(function() {
'use strict';
-
Polymer({
is: 'gr-diff-comment-thread',
diff --git a/polygerrit-ui/app/elements/gr-diff-preferences.html b/polygerrit-ui/app/elements/gr-diff-preferences.html
index b5d0bb8..221d5c3 100644
--- a/polygerrit-ui/app/elements/gr-diff-preferences.html
+++ b/polygerrit-ui/app/elements/gr-diff-preferences.html
@@ -157,7 +157,9 @@
},
},
- observers: [ '_prefsChanged(prefs.*)' ],
+ observers: [
+ '_prefsChanged(prefs.*)',
+ ],
_prefsChanged: function(changeRecord) {
var prefs = changeRecord.base;
diff --git a/polygerrit-ui/app/elements/gr-diff-side.html b/polygerrit-ui/app/elements/gr-diff-side.html
index 0157c73..9b43b4b 100644
--- a/polygerrit-ui/app/elements/gr-diff-side.html
+++ b/polygerrit-ui/app/elements/gr-diff-side.html
@@ -174,7 +174,9 @@
'tap': '_tapHandler',
},
- observers: [ '_prefsChanged(prefs.*)' ],
+ observers: [
+ '_prefsChanged(prefs.*)',
+ ],
rowInserted: function(index) {
this.renderLineIndexRange(index, index);
@@ -243,7 +245,7 @@
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 @@
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 {
diff --git a/polygerrit-ui/app/elements/gr-diff-view.html b/polygerrit-ui/app/elements/gr-diff-view.html
index 212500a..5175a1b 100644
--- a/polygerrit-ui/app/elements/gr-diff-view.html
+++ b/polygerrit-ui/app/elements/gr-diff-view.html
@@ -204,7 +204,7 @@
_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 @@
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 @@
},
_computeChangeDetailQueryParams: function() {
- return { O: this.listChangesOptionsToHex(
+ return {O: this.listChangesOptionsToHex(
this.ListChangesOption.ALL_REVISIONS
)};
},
diff --git a/polygerrit-ui/app/elements/gr-diff.html b/polygerrit-ui/app/elements/gr-diff.html
index a3d8260..ad22746 100644
--- a/polygerrit-ui/app/elements/gr-diff.html
+++ b/polygerrit-ui/app/elements/gr-diff.html
@@ -197,7 +197,9 @@
_diffPreferencesPromise: Object, // Used for testing.
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
observers: [
'_prefsChanged(prefs.*)',
@@ -221,7 +223,6 @@
];
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 @@
},
_getCommentsAndDrafts: function(basePatchNum, loggedIn) {
- var promises = [];
-
function onlyParent(c) { return c.side == 'PARENT'; }
function withoutParent(c) { return c.side != 'PARENT'; }
@@ -543,8 +542,7 @@
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 @@
} 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 @@
// 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 @@
byLine[line] = [];
}
byLine[line].push(c);
- }
+ };
};
allLeft.forEach(mapFunc(leftByLine));
allRight.forEach(mapFunc(rightByLine));
@@ -609,7 +607,7 @@
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 @@
});
}
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;
diff --git a/polygerrit-ui/app/elements/gr-file-list.html b/polygerrit-ui/app/elements/gr-file-list.html
index 9aa30bf..b5f5f88 100644
--- a/polygerrit-ui/app/elements/gr-file-list.html
+++ b/polygerrit-ui/app/elements/gr-file-list.html
@@ -150,7 +150,7 @@
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 @@
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 @@
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 @@
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
- switch(e.keyCode) {
+ switch (e.keyCode) {
case 74: // 'j'
e.preventDefault();
this.selectedIndex =
diff --git a/polygerrit-ui/app/elements/gr-messages-list.html b/polygerrit-ui/app/elements/gr-messages-list.html
index 2a797dc..ecadf6b 100644
--- a/polygerrit-ui/app/elements/gr-messages-list.html
+++ b/polygerrit-ui/app/elements/gr-messages-list.html
@@ -105,7 +105,7 @@
},
_computeCommentsForMessage: function(comments, message, index) {
- var comments = comments || {};
+ comments = comments || {};
var messages = this.messages || [];
var msgComments = {};
var mDate = util.parseDate(message.date);
diff --git a/polygerrit-ui/app/elements/gr-overlay.html b/polygerrit-ui/app/elements/gr-overlay.html
index 3a63b86..4f4e9a0 100644
--- a/polygerrit-ui/app/elements/gr-overlay.html
+++ b/polygerrit-ui/app/elements/gr-overlay.html
@@ -33,7 +33,9 @@
Polymer({
is: 'gr-overlay',
- behaviors: [ Polymer.IronOverlayBehavior ],
+ behaviors: [
+ Polymer.IronOverlayBehavior,
+ ],
});
})();
</script>
diff --git a/polygerrit-ui/app/elements/gr-reply-dropdown.html b/polygerrit-ui/app/elements/gr-reply-dropdown.html
index d217f36..9562f7f 100644
--- a/polygerrit-ui/app/elements/gr-reply-dropdown.html
+++ b/polygerrit-ui/app/elements/gr-reply-dropdown.html
@@ -194,7 +194,9 @@
_xhrPromise: Object, // Used for testing.
},
- behaviors: [ Gerrit.RESTClientBehavior ],
+ behaviors: [
+ Gerrit.RESTClientBehavior,
+ ],
get opened() {
return this.$.dropdown.opened;
@@ -234,7 +236,7 @@
}
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) {
diff --git a/polygerrit-ui/app/elements/gr-reviewer-list.html b/polygerrit-ui/app/elements/gr-reviewer-list.html
index 0a34bcc..238e5db 100644
--- a/polygerrit-ui/app/elements/gr-reviewer-list.html
+++ b/polygerrit-ui/app/elements/gr-reviewer-list.html
@@ -180,7 +180,9 @@
_xhrPromise: Object,
},
- behaviors: [ Gerrit.KeyboardShortcutBehavior ],
+ behaviors: [
+ Gerrit.KeyboardShortcutBehavior,
+ ],
observers: [
'_reviewersChanged(change.reviewers.*, change.owner)',
@@ -240,7 +242,7 @@
_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 @@
}
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);
diff --git a/polygerrit-ui/app/elements/gr-search-bar.html b/polygerrit-ui/app/elements/gr-search-bar.html
index a6d8cb7..a238054 100644
--- a/polygerrit-ui/app/elements/gr-search-bar.html
+++ b/polygerrit-ui/app/elements/gr-search-bar.html
@@ -56,7 +56,9 @@
Polymer({
is: 'gr-search-bar',
- behaviors: [ Gerrit.KeyboardShortcutBehavior ],
+ behaviors: [
+ Gerrit.KeyboardShortcutBehavior,
+ ],
listeners: {
'searchInput.keydown': '_inputKeyDownHandler',
@@ -96,7 +98,7 @@
_handleKey: function(e) {
if (this.shouldSupressKeyboardShortcut(e)) { return; }
- switch(e.keyCode) {
+ switch (e.keyCode) {
case 191: // '/'
e.preventDefault();
var s = this.$.searchInput;
diff --git a/polygerrit-ui/app/scripts/link-text-parser.js b/polygerrit-ui/app/scripts/link-text-parser.js
index 35579b8..b4b1678 100644
--- a/polygerrit-ui/app/scripts/link-text-parser.js
+++ b/polygerrit-ui/app/scripts/link-text-parser.js
@@ -66,7 +66,7 @@
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);
diff --git a/polygerrit-ui/app/scripts/util.js b/polygerrit-ui/app/scripts/util.js
index a69b47d..c7b5c91 100644
--- a/polygerrit-ui/app/scripts/util.js
+++ b/polygerrit-ui/app/scripts/util.js
@@ -42,7 +42,7 @@
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);
diff --git a/polygerrit-ui/app/test/gr-account-label-test.html b/polygerrit-ui/app/test/gr-account-label-test.html
index 7045679..dbfdeec 100644
--- a/polygerrit-ui/app/test/gr-account-label-test.html
+++ b/polygerrit-ui/app/test/gr-account-label-test.html
@@ -48,7 +48,7 @@
'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 @@
}), 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);
diff --git a/polygerrit-ui/app/test/gr-account-link-test.html b/polygerrit-ui/app/test/gr-account-link-test.html
index 1313f6f..dfc27f8 100644
--- a/polygerrit-ui/app/test/gr-account-link-test.html
+++ b/polygerrit-ui/app/test/gr-account-link-test.html
@@ -47,7 +47,7 @@
}),
'/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');
});
diff --git a/polygerrit-ui/app/test/gr-change-actions-test.html b/polygerrit-ui/app/test/gr-change-actions-test.html
index 7a3117a..14dd010 100644
--- a/polygerrit-ui/app/test/gr-change-actions-test.html
+++ b/polygerrit-ui/app/test/gr-change-actions-test.html
@@ -45,7 +45,7 @@
'/changes/42/revisions/2/actions',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
cherrypick: {
@@ -74,7 +74,7 @@
'/changes/42/revisions/2/submit',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n{}', // The response is not used by the element.
]
);
diff --git a/polygerrit-ui/app/test/gr-change-list-item-test.html b/polygerrit-ui/app/test/gr-change-list-item-test.html
index dcd35fa..5f06945 100644
--- a/polygerrit-ui/app/test/gr-change-list-item-test.html
+++ b/polygerrit-ui/app/test/gr-change-list-item-test.html
@@ -118,9 +118,9 @@
'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/');
});
diff --git a/polygerrit-ui/app/test/gr-change-list-test.html b/polygerrit-ui/app/test/gr-change-list-test.html
index 5989a73..db0c454 100644
--- a/polygerrit-ui/app/test/gr-change-list-test.html
+++ b/polygerrit-ui/app/test/gr-change-list-test.html
@@ -101,7 +101,7 @@
assert.equal(element.selectedIndex, 0);
showStub.restore();
- done()
+ done();
}, 1);
});
diff --git a/polygerrit-ui/app/test/gr-change-star-test.html b/polygerrit-ui/app/test/gr-change-star-test.html
index 5655020..3f7632b 100644
--- a/polygerrit-ui/app/test/gr-change-star-test.html
+++ b/polygerrit-ui/app/test/gr-change-star-test.html
@@ -51,7 +51,7 @@
'/accounts/self/starred.changes/2',
[
204,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
''
]
);
@@ -61,7 +61,7 @@
'/accounts/self/starred.changes/2',
[
204,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
''
]
);
diff --git a/polygerrit-ui/app/test/gr-change-view-test.html b/polygerrit-ui/app/test/gr-change-view-test.html
index 6811153..5610441 100644
--- a/polygerrit-ui/app/test/gr-change-view-test.html
+++ b/polygerrit-ui/app/test/gr-change-view-test.html
@@ -49,7 +49,7 @@
/\/changes\/(.*)/,
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n{}',
]
);
@@ -80,9 +80,9 @@
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',
diff --git a/polygerrit-ui/app/test/gr-diff-comment-test.html b/polygerrit-ui/app/test/gr-diff-comment-test.html
index 29f7134..694aa16 100644
--- a/polygerrit-ui/app/test/gr-diff-comment-test.html
+++ b/polygerrit-ui/app/test/gr-diff-comment-test.html
@@ -112,7 +112,7 @@
'/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 @@
/\/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 @@
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 @@
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 @@
// 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.');
diff --git a/polygerrit-ui/app/test/gr-diff-comment-thread-test.html b/polygerrit-ui/app/test/gr-diff-comment-thread-test.html
index e167fb3..3b1f895 100644
--- a/polygerrit-ui/app/test/gr-diff-comment-thread-test.html
+++ b/polygerrit-ui/app/test/gr-diff-comment-thread-test.html
@@ -144,9 +144,9 @@
'/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',
diff --git a/polygerrit-ui/app/test/gr-diff-preferences-test.html b/polygerrit-ui/app/test/gr-diff-preferences-test.html
index 36fffb8..c689834 100644
--- a/polygerrit-ui/app/test/gr-diff-preferences-test.html
+++ b/polygerrit-ui/app/test/gr-diff-preferences-test.html
@@ -64,7 +64,7 @@
});
var cancelPromise = new Promise(function(resolve) {
element.addEventListener('cancel', function() { resolve(); });
- })
+ });
Promise.all([savePromise, cancelPromise]).then(function() {
done();
});
diff --git a/polygerrit-ui/app/test/gr-diff-side-test.html b/polygerrit-ui/app/test/gr-diff-side-test.html
index 99d7ff8..a79dfc4 100644
--- a/polygerrit-ui/app/test/gr-diff-side-test.html
+++ b/polygerrit-ui/app/test/gr-diff-side-test.html
@@ -84,8 +84,8 @@
'[[_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 @@
}];
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 @@
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++;
}
diff --git a/polygerrit-ui/app/test/gr-diff-test.html b/polygerrit-ui/app/test/gr-diff-test.html
index aaaded2..cd0f158 100644
--- a/polygerrit-ui/app/test/gr-diff-test.html
+++ b/polygerrit-ui/app/test/gr-diff-test.html
@@ -52,7 +52,7 @@
/\/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 @@
'/changes/42/revisions/1/comments',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': [],
@@ -136,7 +136,7 @@
'/changes/42/revisions/2/comments',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': [],
@@ -187,9 +187,9 @@
'/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 @@
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 @@
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 @@
10: {},
};
var ctx = {
- left: { lineNum: 0 },
- right: { lineNum: 0 },
+ left: {lineNum: 0},
+ right: {lineNum: 0},
};
var content = [
{
diff --git a/polygerrit-ui/app/test/gr-file-list-test.html b/polygerrit-ui/app/test/gr-file-list-test.html
index 9e68f3e..71fe6d8 100644
--- a/polygerrit-ui/app/test/gr-file-list-test.html
+++ b/polygerrit-ui/app/test/gr-file-list-test.html
@@ -46,7 +46,7 @@
'/changes/42/revisions/1/files',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': {
@@ -68,7 +68,7 @@
'/changes/42/revisions/2/files',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
'/COMMIT_MSG': {
@@ -165,14 +165,14 @@
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(
diff --git a/polygerrit-ui/app/test/gr-linked-text-test.html b/polygerrit-ui/app/test/gr-linked-text-test.html
index ef5defa..0761948 100644
--- a/polygerrit-ui/app/test/gr-linked-text-test.html
+++ b/polygerrit-ui/app/test/gr-linked-text-test.html
@@ -93,7 +93,7 @@
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 @@
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');
diff --git a/polygerrit-ui/app/test/gr-reply-dropdown-test.html b/polygerrit-ui/app/test/gr-reply-dropdown-test.html
index 425a773..ca6e541 100644
--- a/polygerrit-ui/app/test/gr-reply-dropdown-test.html
+++ b/polygerrit-ui/app/test/gr-reply-dropdown-test.html
@@ -80,7 +80,7 @@
'/changes/42/revisions/1/review',
[
200,
- { 'Content-Type': 'application/json' },
+ {'Content-Type': 'application/json'},
')]}\'\n' +
'{' +
'"labels": {' +
@@ -154,7 +154,7 @@
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();
});
diff --git a/polygerrit-ui/app/test/gr-reviewer-list-test.html b/polygerrit-ui/app/test/gr-reviewer-list-test.html
index 8dd114b..860b138 100644
--- a/polygerrit-ui/app/test/gr-reviewer-list-test.html
+++ b/polygerrit-ui/app/test/gr-reviewer-list-test.html
@@ -45,27 +45,27 @@
/\/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 @@
'/changes/42/reviewers',
[
200,
- { 'Content-Type': 'application/json'},
+ {'Content-Type': 'application/json'},
')]}\'\n' +
JSON.stringify({
reviewers: [{
@@ -95,7 +95,7 @@
'/changes/42/reviewers/1021482',
[
204,
- { 'Content-Type': 'application/json'},
+ {'Content-Type': 'application/json'},
')]}\'\n{}',
]
);
@@ -198,7 +198,8 @@
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 @@
_number: 42,
reviewers: {},
removable_reviewers: [],
- owner: { _account_id: 0 },
+ owner: {_account_id: 0},
};
element._inputRequestTimeout = 0;
element._mutable = true;
diff --git a/polygerrit-ui/app/test/index.html b/polygerrit-ui/app/test/index.html
index 2d0c70b..25d0cb9 100644
--- a/polygerrit-ui/app/test/index.html
+++ b/polygerrit-ui/app/test/index.html
@@ -23,7 +23,8 @@
<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',