Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ia535be02d19f09e716f00ec8819ba785010798f7
This commit is contained in:
@@ -191,7 +191,9 @@ limitations under the License.
|
|||||||
'title-change': '_handleTitleChange',
|
'title-change': '_handleTitleChange',
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [ '_viewChanged(params.view)' ],
|
observers: [
|
||||||
|
'_viewChanged(params.view)',
|
||||||
|
],
|
||||||
|
|
||||||
get loggedIn() {
|
get loggedIn() {
|
||||||
return !!(this.account && Object.keys(this.account).length > 0);
|
return !!(this.account && Object.keys(this.account).length > 0);
|
||||||
@@ -213,7 +215,7 @@ limitations under the License.
|
|||||||
dashboardView: {
|
dashboardView: {
|
||||||
selectedChangeIndex: 0,
|
selectedChangeIndex: 0,
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_accountChanged: function() {
|
_accountChanged: function() {
|
||||||
|
@@ -115,7 +115,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
observers: [
|
observers: [
|
||||||
'_actionsChanged(actions, _revisionActions)',
|
'_actionsChanged(actions, _revisionActions)',
|
||||||
@@ -139,7 +141,7 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getValuesFor: function(obj) {
|
_getValuesFor: function(obj) {
|
||||||
return Object.keys(obj).map(function (key) {
|
return Object.keys(obj).map(function(key) {
|
||||||
return obj[key];
|
return obj[key];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -184,8 +186,8 @@ limitations under the License.
|
|||||||
}.bind(this)).catch(function(err) {
|
}.bind(this)).catch(function(err) {
|
||||||
alert('Oops. Something went wrong. Check the console and bug the ' +
|
alert('Oops. Something went wrong. Check the console and bug the ' +
|
||||||
'PolyGerrit team for assistance.');
|
'PolyGerrit team for assistance.');
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireRevisionAction: function(endpoint, action) {
|
_fireRevisionAction: function(endpoint, action) {
|
||||||
@@ -204,7 +206,7 @@ limitations under the License.
|
|||||||
buttonEl.setAttribute('loading', false);
|
buttonEl.setAttribute('loading', false);
|
||||||
buttonEl.disabled = false;
|
buttonEl.disabled = false;
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_send: function(method, payload, actionEndpoint, revisionAction) {
|
_send: function(method, payload, actionEndpoint, revisionAction) {
|
||||||
|
@@ -108,7 +108,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
_computeChangeURL: function(changeNum) {
|
_computeChangeURL: function(changeNum) {
|
||||||
if (!changeNum) { return ''; }
|
if (!changeNum) { return ''; }
|
||||||
@@ -134,8 +136,8 @@ limitations under the License.
|
|||||||
_computeLabelTitle: function(change, labelName) {
|
_computeLabelTitle: function(change, labelName) {
|
||||||
var label = change.labels[labelName];
|
var label = change.labels[labelName];
|
||||||
if (!label) { return labelName; }
|
if (!label) { return labelName; }
|
||||||
var significantLabel = label.rejected || label.approved
|
var significantLabel = label.rejected || label.approved ||
|
||||||
|| label.disliked || label.recommended;
|
label.disliked || label.recommended;
|
||||||
if (significantLabel && significantLabel.name) {
|
if (significantLabel && significantLabel.name) {
|
||||||
return labelName + '\nby ' + significantLabel.name;
|
return labelName + '\nby ' + significantLabel.name;
|
||||||
}
|
}
|
||||||
|
@@ -136,7 +136,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
attached: function() {
|
attached: function() {
|
||||||
this.fire('title-change', {title: this._query});
|
this.fire('title-change', {title: this._query});
|
||||||
|
@@ -121,7 +121,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.KeyboardShortcutBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
_computeLabelNames: function(groups) {
|
_computeLabelNames: function(groups) {
|
||||||
var labels = [];
|
var labels = [];
|
||||||
@@ -170,7 +172,7 @@ limitations under the License.
|
|||||||
this.groups.forEach(function(group) {
|
this.groups.forEach(function(group) {
|
||||||
len += group.length;
|
len += group.length;
|
||||||
});
|
});
|
||||||
switch(e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 74: // 'j'
|
case 74: // 'j'
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.selectedIndex == len - 1) { return; }
|
if (this.selectedIndex == len - 1) { return; }
|
||||||
|
@@ -369,7 +369,7 @@ limitations under the License.
|
|||||||
_handlePatchChange: function(e) {
|
_handlePatchChange: function(e) {
|
||||||
var patchNum = e.target.value;
|
var patchNum = e.target.value;
|
||||||
var currentPatchNum =
|
var currentPatchNum =
|
||||||
this._change.revisions[this._change.current_revision]._number
|
this._change.revisions[this._change.current_revision]._number;
|
||||||
if (patchNum == currentPatchNum) {
|
if (patchNum == currentPatchNum) {
|
||||||
page.show(this._computeChangePath(this._changeNum));
|
page.show(this._computeChangePath(this._changeNum));
|
||||||
return;
|
return;
|
||||||
@@ -467,7 +467,7 @@ limitations under the License.
|
|||||||
this.ListChangesOption.ALL_REVISIONS,
|
this.ListChangesOption.ALL_REVISIONS,
|
||||||
this.ListChangesOption.CHANGE_ACTIONS
|
this.ListChangesOption.CHANGE_ACTIONS
|
||||||
);
|
);
|
||||||
return { O: options };
|
return {O: options};
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeLatestPatchNum: function(change) {
|
_computeLatestPatchNum: function(change) {
|
||||||
@@ -483,7 +483,7 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
|
|
||||||
_computePatchIndexIsSelected: function(index, patchNum) {
|
_computePatchIndexIsSelected: function(index, patchNum) {
|
||||||
return this._allPatchSets[index] == patchNum;
|
return this._allPatchSets[index] == patchNum;
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeLabelNames: function(labels) {
|
_computeLabelNames: function(labels) {
|
||||||
@@ -500,7 +500,7 @@ limitations under the License.
|
|||||||
var labelClassName;
|
var labelClassName;
|
||||||
var labelValPrefix = '';
|
var labelValPrefix = '';
|
||||||
if (label.value > 0) {
|
if (label.value > 0) {
|
||||||
labelValPrefix = '+'
|
labelValPrefix = '+';
|
||||||
labelClassName = 'approved';
|
labelClassName = 'approved';
|
||||||
} else if (label.value < 0) {
|
} else if (label.value < 0) {
|
||||||
labelClassName = 'notApproved';
|
labelClassName = 'notApproved';
|
||||||
@@ -518,7 +518,7 @@ limitations under the License.
|
|||||||
_handleKey: function(e) {
|
_handleKey: function(e) {
|
||||||
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
||||||
|
|
||||||
switch(e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 65: // 'a'
|
case 65: // 'a'
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.$.replyDropdown.open();
|
this.$.replyDropdown.open();
|
||||||
|
@@ -85,7 +85,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
attached: function() {
|
attached: function() {
|
||||||
this.fire('title-change', {title: 'My Reviews'});
|
this.fire('title-change', {title: 'My Reviews'});
|
||||||
|
@@ -54,7 +54,6 @@ limitations under the License.
|
|||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-diff-comment-thread',
|
is: 'gr-diff-comment-thread',
|
||||||
|
|
||||||
|
@@ -157,7 +157,9 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [ '_prefsChanged(prefs.*)' ],
|
observers: [
|
||||||
|
'_prefsChanged(prefs.*)',
|
||||||
|
],
|
||||||
|
|
||||||
_prefsChanged: function(changeRecord) {
|
_prefsChanged: function(changeRecord) {
|
||||||
var prefs = changeRecord.base;
|
var prefs = changeRecord.base;
|
||||||
|
@@ -174,7 +174,9 @@ limitations under the License.
|
|||||||
'tap': '_tapHandler',
|
'tap': '_tapHandler',
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [ '_prefsChanged(prefs.*)' ],
|
observers: [
|
||||||
|
'_prefsChanged(prefs.*)',
|
||||||
|
],
|
||||||
|
|
||||||
rowInserted: function(index) {
|
rowInserted: function(index) {
|
||||||
this.renderLineIndexRange(index, index);
|
this.renderLineIndexRange(index, index);
|
||||||
@@ -243,7 +245,7 @@ limitations under the License.
|
|||||||
return row.height;
|
return row.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selector = '[data-index="' + index + '"]'
|
var selector = '[data-index="' + index + '"]';
|
||||||
var els = Polymer.dom(this.root).querySelectorAll(selector);
|
var els = Polymer.dom(this.root).querySelectorAll(selector);
|
||||||
if (els.length != 2) {
|
if (els.length != 2) {
|
||||||
throw Error('Rows should only consist of two elements');
|
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) {
|
if (numChars > 0 && numChars % this.prefs.line_length == 0) {
|
||||||
indices.push(htmlIndex);
|
indices.push(htmlIndex);
|
||||||
}
|
}
|
||||||
htmlIndex = this._advanceChar(html, htmlIndex)
|
htmlIndex = this._advanceChar(html, htmlIndex);
|
||||||
if (content[i] == '\t') {
|
if (content[i] == '\t') {
|
||||||
numChars += this.prefs.tab_size;
|
numChars += this.prefs.tab_size;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -204,7 +204,7 @@ limitations under the License.
|
|||||||
_handleKey: function(e) {
|
_handleKey: function(e) {
|
||||||
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
||||||
|
|
||||||
switch(e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 219: // '['
|
case 219: // '['
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this._navToFile(this._fileList, -1);
|
this._navToFile(this._fileList, -1);
|
||||||
@@ -217,7 +217,7 @@ limitations under the License.
|
|||||||
if (!this._loggedIn) { return; }
|
if (!this._loggedIn) { return; }
|
||||||
|
|
||||||
this.set('changeViewState.showReplyDropdown', true);
|
this.set('changeViewState.showReplyDropdown', true);
|
||||||
// No break here. Allow to fall through.
|
/* falls through */ // required by JSHint
|
||||||
case 85: // 'u'
|
case 85: // 'u'
|
||||||
if (this._changeNum) {
|
if (this._changeNum) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -305,7 +305,7 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
|
|
||||||
_computeChangeDetailQueryParams: function() {
|
_computeChangeDetailQueryParams: function() {
|
||||||
return { O: this.listChangesOptionsToHex(
|
return {O: this.listChangesOptionsToHex(
|
||||||
this.ListChangesOption.ALL_REVISIONS
|
this.ListChangesOption.ALL_REVISIONS
|
||||||
)};
|
)};
|
||||||
},
|
},
|
||||||
|
@@ -197,7 +197,9 @@ limitations under the License.
|
|||||||
_diffPreferencesPromise: Object, // Used for testing.
|
_diffPreferencesPromise: Object, // Used for testing.
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
observers: [
|
observers: [
|
||||||
'_prefsChanged(prefs.*)',
|
'_prefsChanged(prefs.*)',
|
||||||
@@ -221,7 +223,6 @@ limitations under the License.
|
|||||||
];
|
];
|
||||||
|
|
||||||
var basePatchNum = this.patchRange.basePatchNum;
|
var basePatchNum = this.patchRange.basePatchNum;
|
||||||
var patchNum = this.patchRange.patchNum;
|
|
||||||
|
|
||||||
return app.accountReady.then(function() {
|
return app.accountReady.then(function() {
|
||||||
promises.push(this._getCommentsAndDrafts(basePatchNum, app.loggedIn));
|
promises.push(this._getCommentsAndDrafts(basePatchNum, app.loggedIn));
|
||||||
@@ -259,8 +260,6 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getCommentsAndDrafts: function(basePatchNum, loggedIn) {
|
_getCommentsAndDrafts: function(basePatchNum, loggedIn) {
|
||||||
var promises = [];
|
|
||||||
|
|
||||||
function onlyParent(c) { return c.side == 'PARENT'; }
|
function onlyParent(c) { return c.side == 'PARENT'; }
|
||||||
function withoutParent(c) { return c.side != 'PARENT'; }
|
function withoutParent(c) { return c.side != 'PARENT'; }
|
||||||
|
|
||||||
@@ -543,8 +542,7 @@ limitations under the License.
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var chunk = content[i].ab;
|
var chunk = content[i].ab;
|
||||||
var currentChunk = { ab: [] };
|
var currentChunk = {ab: []};
|
||||||
var inCommentGroup = false;
|
|
||||||
for (var j = 0; j < chunk.length; j++) {
|
for (var j = 0; j < chunk.length; j++) {
|
||||||
leftLineNum++;
|
leftLineNum++;
|
||||||
rightLineNum++;
|
rightLineNum++;
|
||||||
@@ -554,7 +552,7 @@ limitations under the License.
|
|||||||
} else {
|
} else {
|
||||||
if (currentChunk.ab && currentChunk.ab.length > 0) {
|
if (currentChunk.ab && currentChunk.ab.length > 0) {
|
||||||
result.push(currentChunk);
|
result.push(currentChunk);
|
||||||
currentChunk = { ab: [] };
|
currentChunk = {ab: []};
|
||||||
}
|
}
|
||||||
// Append an annotation to indicate that this line should not be
|
// Append an annotation to indicate that this line should not be
|
||||||
// highlighted even though it's implied with both `a` and `b`
|
// 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).
|
// should be highlighted but are equal (blank lines, for example).
|
||||||
result.push({
|
result.push({
|
||||||
__noHighlight: true,
|
__noHighlight: true,
|
||||||
a: [ chunk[j] ],
|
a: [chunk[j]],
|
||||||
b: [ chunk[j] ],
|
b: [chunk[j]],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -590,7 +588,7 @@ limitations under the License.
|
|||||||
byLine[line] = [];
|
byLine[line] = [];
|
||||||
}
|
}
|
||||||
byLine[line].push(c);
|
byLine[line].push(c);
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
allLeft.forEach(mapFunc(leftByLine));
|
allLeft.forEach(mapFunc(leftByLine));
|
||||||
allRight.forEach(mapFunc(rightByLine));
|
allRight.forEach(mapFunc(rightByLine));
|
||||||
@@ -609,7 +607,7 @@ limitations under the License.
|
|||||||
throw Error(
|
throw Error(
|
||||||
'Left and right ranges for context control should be equal:' +
|
'Left and right ranges for context control should be equal:' +
|
||||||
'Left: [' + leftStart + ', ' + leftEnd + '] ' +
|
'Left: [' + leftStart + ', ' + leftEnd + '] ' +
|
||||||
'Right: ['+ rightStart + ', ' + rightEnd + ']');
|
'Right: [' + rightStart + ', ' + rightEnd + ']');
|
||||||
}
|
}
|
||||||
var obj = {
|
var obj = {
|
||||||
type: 'CONTEXT_CONTROL',
|
type: 'CONTEXT_CONTROL',
|
||||||
@@ -748,9 +746,9 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (leftComments && !rightComments) {
|
if (leftComments && !rightComments) {
|
||||||
rightSide.push({ type: 'FILLER' });
|
rightSide.push({type: 'FILLER'});
|
||||||
} else if (!leftComments && rightComments) {
|
} else if (!leftComments && rightComments) {
|
||||||
leftSide.push({ type: 'FILLER' });
|
leftSide.push({type: 'FILLER'});
|
||||||
}
|
}
|
||||||
this._groupedBaseComments[ctx.left.lineNum] = null;
|
this._groupedBaseComments[ctx.left.lineNum] = null;
|
||||||
this._groupedComments[ctx.right.lineNum] = null;
|
this._groupedComments[ctx.right.lineNum] = null;
|
||||||
|
@@ -150,7 +150,7 @@ limitations under the License.
|
|||||||
var num = patchComments.length;
|
var num = patchComments.length;
|
||||||
if (num == 0) { return ''; }
|
if (num == 0) { return ''; }
|
||||||
if (num == 1) { return '1 comment'; }
|
if (num == 1) { return '1 comment'; }
|
||||||
if (num > 1) { return num + ' comments'; };
|
if (num > 1) { return num + ' comments'; }
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeDraftsURL: function(changeNum, patchNum) {
|
_computeDraftsURL: function(changeNum, patchNum) {
|
||||||
@@ -161,7 +161,7 @@ limitations under the License.
|
|||||||
var num = (drafts[path] || []).length;
|
var num = (drafts[path] || []).length;
|
||||||
if (num == 0) { return ''; }
|
if (num == 0) { return ''; }
|
||||||
if (num == 1) { return '1 draft'; }
|
if (num == 1) { return '1 draft'; }
|
||||||
if (num > 1) { return num + ' drafts'; };
|
if (num > 1) { return num + ' drafts'; }
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleResponse: function(e, req) {
|
_handleResponse: function(e, req) {
|
||||||
@@ -173,7 +173,7 @@ limitations under the License.
|
|||||||
info.__path = paths[i];
|
info.__path = paths[i];
|
||||||
info.lines_inserted = info.lines_inserted || 0;
|
info.lines_inserted = info.lines_inserted || 0;
|
||||||
info.lines_deleted = info.lines_deleted || 0;
|
info.lines_deleted = info.lines_deleted || 0;
|
||||||
files.push(info)
|
files.push(info);
|
||||||
}
|
}
|
||||||
this.files = files;
|
this.files = files;
|
||||||
},
|
},
|
||||||
@@ -181,7 +181,7 @@ limitations under the License.
|
|||||||
_handleKey: function(e) {
|
_handleKey: function(e) {
|
||||||
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
||||||
|
|
||||||
switch(e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 74: // 'j'
|
case 74: // 'j'
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.selectedIndex =
|
this.selectedIndex =
|
||||||
|
@@ -105,7 +105,7 @@ limitations under the License.
|
|||||||
},
|
},
|
||||||
|
|
||||||
_computeCommentsForMessage: function(comments, message, index) {
|
_computeCommentsForMessage: function(comments, message, index) {
|
||||||
var comments = comments || {};
|
comments = comments || {};
|
||||||
var messages = this.messages || [];
|
var messages = this.messages || [];
|
||||||
var msgComments = {};
|
var msgComments = {};
|
||||||
var mDate = util.parseDate(message.date);
|
var mDate = util.parseDate(message.date);
|
||||||
|
@@ -33,7 +33,9 @@ limitations under the License.
|
|||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-overlay',
|
is: 'gr-overlay',
|
||||||
behaviors: [ Polymer.IronOverlayBehavior ],
|
behaviors: [
|
||||||
|
Polymer.IronOverlayBehavior,
|
||||||
|
],
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
@@ -194,7 +194,9 @@ limitations under the License.
|
|||||||
_xhrPromise: Object, // Used for testing.
|
_xhrPromise: Object, // Used for testing.
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.RESTClientBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.RESTClientBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
get opened() {
|
get opened() {
|
||||||
return this.$.dropdown.opened;
|
return this.$.dropdown.opened;
|
||||||
@@ -234,7 +236,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
if (total == 0) { return ''; }
|
if (total == 0) { return ''; }
|
||||||
if (total == 1) { return '1 Draft'; }
|
if (total == 1) { return '1 Draft'; }
|
||||||
if (total > 1) { return total + ' Drafts'; };
|
if (total > 1) { return total + ' Drafts'; }
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeLabelArray: function(labelsObj) {
|
_computeLabelArray: function(labelsObj) {
|
||||||
|
@@ -180,7 +180,9 @@ limitations under the License.
|
|||||||
_xhrPromise: Object,
|
_xhrPromise: Object,
|
||||||
},
|
},
|
||||||
|
|
||||||
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.KeyboardShortcutBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
observers: [
|
observers: [
|
||||||
'_reviewersChanged(change.reviewers.*, change.owner)',
|
'_reviewersChanged(change.reviewers.*, change.owner)',
|
||||||
@@ -240,7 +242,7 @@ limitations under the License.
|
|||||||
_handleResponse: function(e) {
|
_handleResponse: function(e) {
|
||||||
this._autocompleteData = e.detail.response.filter(function(reviewer) {
|
this._autocompleteData = e.detail.response.filter(function(reviewer) {
|
||||||
var account = reviewer.account;
|
var account = reviewer.account;
|
||||||
if (!account) return true;
|
if (!account) { return true; }
|
||||||
for (var i = 0; i < this._reviewers.length; i++) {
|
for (var i = 0; i < this._reviewers.length; i++) {
|
||||||
if (account._account_id == this.change.owner._account_id ||
|
if (account._account_id == this.change.owner._account_id ||
|
||||||
account._account_id == this._reviewers[i]._account_id) {
|
account._account_id == this._reviewers[i]._account_id) {
|
||||||
@@ -404,7 +406,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
this._autocompleteData = [];
|
this._autocompleteData = [];
|
||||||
this._send('POST', this._restEndpoint(), reviewerID).then(function(req) {
|
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) {
|
req.response.reviewers.forEach(function(r) {
|
||||||
this.push('change.removable_reviewers', r);
|
this.push('change.removable_reviewers', r);
|
||||||
this.push('change.reviewers.CC', r);
|
this.push('change.reviewers.CC', r);
|
||||||
|
@@ -56,7 +56,9 @@ limitations under the License.
|
|||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-search-bar',
|
is: 'gr-search-bar',
|
||||||
|
|
||||||
behaviors: [ Gerrit.KeyboardShortcutBehavior ],
|
behaviors: [
|
||||||
|
Gerrit.KeyboardShortcutBehavior,
|
||||||
|
],
|
||||||
|
|
||||||
listeners: {
|
listeners: {
|
||||||
'searchInput.keydown': '_inputKeyDownHandler',
|
'searchInput.keydown': '_inputKeyDownHandler',
|
||||||
@@ -96,7 +98,7 @@ limitations under the License.
|
|||||||
|
|
||||||
_handleKey: function(e) {
|
_handleKey: function(e) {
|
||||||
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
if (this.shouldSupressKeyboardShortcut(e)) { return; }
|
||||||
switch(e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 191: // '/'
|
case 191: // '/'
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var s = this.$.searchInput;
|
var s = this.$.searchInput;
|
||||||
|
@@ -66,7 +66,7 @@ GrLinkTextParser.prototype.parseLinks = function(text, patterns) {
|
|||||||
var pattern = new RegExp(patterns[p].match, 'g');
|
var pattern = new RegExp(patterns[p].match, 'g');
|
||||||
|
|
||||||
var match;
|
var match;
|
||||||
while (match = pattern.exec(text)) {
|
while ((match = pattern.exec(text)) != null) {
|
||||||
var before = text.substr(0, match.index);
|
var before = text.substr(0, match.index);
|
||||||
this.addText(before);
|
this.addText(before);
|
||||||
text = text.substr(match.index + match[0].length);
|
text = text.substr(match.index + match[0].length);
|
||||||
|
@@ -42,7 +42,7 @@ util.escapeHTML = function(str) {
|
|||||||
util.getCookie = function(name) {
|
util.getCookie = function(name) {
|
||||||
var key = name + '=';
|
var key = name + '=';
|
||||||
var cookies = document.cookie.split(';');
|
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];
|
var c = cookies[i];
|
||||||
while (c.charAt(0) == ' ') {
|
while (c.charAt(0) == ' ') {
|
||||||
c = c.substring(1);
|
c = c.substring(1);
|
||||||
|
@@ -48,7 +48,7 @@ limitations under the License.
|
|||||||
'Andrew Bonventre <andybons+gerrit@gmail.com>');
|
'Andrew Bonventre <andybons+gerrit@gmail.com>');
|
||||||
|
|
||||||
assert.equal(element._computeAccountTitle(
|
assert.equal(element._computeAccountTitle(
|
||||||
{ name: 'Andrew Bonventre' }),
|
{name: 'Andrew Bonventre'}),
|
||||||
'Andrew Bonventre');
|
'Andrew Bonventre');
|
||||||
|
|
||||||
assert.equal(element._computeShowEmail(true,
|
assert.equal(element._computeShowEmail(true,
|
||||||
@@ -58,10 +58,10 @@ limitations under the License.
|
|||||||
}), true);
|
}), true);
|
||||||
|
|
||||||
assert.equal(element._computeShowEmail(true,
|
assert.equal(element._computeShowEmail(true,
|
||||||
{ name: 'Andrew Bonventre' }), false);
|
{name: 'Andrew Bonventre'}), false);
|
||||||
|
|
||||||
assert.equal(element._computeShowEmail(false,
|
assert.equal(element._computeShowEmail(false,
|
||||||
{ name: 'Andrew Bonventre' }), false);
|
{name: 'Andrew Bonventre'}), false);
|
||||||
|
|
||||||
assert.equal(element._computeShowEmail(
|
assert.equal(element._computeShowEmail(
|
||||||
true, undefined), false);
|
true, undefined), false);
|
||||||
|
@@ -47,7 +47,7 @@ limitations under the License.
|
|||||||
}),
|
}),
|
||||||
'/q/owner:andybons%2Bgerrit%40gmail.com+status:open');
|
'/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');
|
'/q/owner:42+status:open');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/2/actions',
|
'/changes/42/revisions/2/actions',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
cherrypick: {
|
cherrypick: {
|
||||||
@@ -74,7 +74,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/2/submit',
|
'/changes/42/revisions/2/submit',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n{}', // The response is not used by the element.
|
')]}\'\n{}', // The response is not used by the element.
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@@ -118,9 +118,9 @@ limitations under the License.
|
|||||||
'combustible-stuff', 'lemons'),
|
'combustible-stuff', 'lemons'),
|
||||||
'/q/status:open+project:combustible-stuff+branch:lemons');
|
'/q/status:open+project:combustible-stuff+branch:lemons');
|
||||||
|
|
||||||
element.change = { _number: 42 };
|
element.change = {_number: 42};
|
||||||
assert.equal(element.changeURL, '/c/42/');
|
assert.equal(element.changeURL, '/c/42/');
|
||||||
element.change = { _number: 43 };
|
element.change = {_number: 43};
|
||||||
assert.equal(element.changeURL, '/c/43/');
|
assert.equal(element.changeURL, '/c/43/');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ limitations under the License.
|
|||||||
assert.equal(element.selectedIndex, 0);
|
assert.equal(element.selectedIndex, 0);
|
||||||
|
|
||||||
showStub.restore();
|
showStub.restore();
|
||||||
done()
|
done();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ limitations under the License.
|
|||||||
'/accounts/self/starred.changes/2',
|
'/accounts/self/starred.changes/2',
|
||||||
[
|
[
|
||||||
204,
|
204,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -61,7 +61,7 @@ limitations under the License.
|
|||||||
'/accounts/self/starred.changes/2',
|
'/accounts/self/starred.changes/2',
|
||||||
[
|
[
|
||||||
204,
|
204,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@@ -49,7 +49,7 @@ limitations under the License.
|
|||||||
/\/changes\/(.*)/,
|
/\/changes\/(.*)/,
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n{}',
|
')]}\'\n{}',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -80,9 +80,9 @@ limitations under the License.
|
|||||||
element._change = {
|
element._change = {
|
||||||
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
|
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
|
||||||
revisions: {
|
revisions: {
|
||||||
rev2: { _number: 2 },
|
rev2: {_number: 2},
|
||||||
rev1: { _number: 1 },
|
rev1: {_number: 1},
|
||||||
rev3: { _number: 3 },
|
rev3: {_number: 3},
|
||||||
},
|
},
|
||||||
current_revision: 'rev3',
|
current_revision: 'rev3',
|
||||||
status: 'NEW',
|
status: 'NEW',
|
||||||
|
@@ -112,7 +112,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/1/drafts',
|
'/changes/42/revisions/1/drafts',
|
||||||
[
|
[
|
||||||
201,
|
201,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n{' +
|
')]}\'\n{' +
|
||||||
'"id": "baf0414d_40572e03",' +
|
'"id": "baf0414d_40572e03",' +
|
||||||
'"path": "/path/to/file",' +
|
'"path": "/path/to/file",' +
|
||||||
@@ -128,7 +128,7 @@ limitations under the License.
|
|||||||
/\/changes\/42\/revisions\/1\/drafts\/.+/,
|
/\/changes\/42\/revisions\/1\/drafts\/.+/,
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n{' +
|
')]}\'\n{' +
|
||||||
'"id": "baf0414d_40572e03",' +
|
'"id": "baf0414d_40572e03",' +
|
||||||
'"path": "/path/to/file",' +
|
'"path": "/path/to/file",' +
|
||||||
@@ -165,7 +165,7 @@ limitations under the License.
|
|||||||
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
|
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
|
||||||
|
|
||||||
element.editing = true;
|
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.$$('.discard')), 'discard is visible');
|
||||||
assert.isTrue(isVisible(element.$$('.save')), 'save is visible');
|
assert.isTrue(isVisible(element.$$('.save')), 'save is visible');
|
||||||
assert.isFalse(isVisible(element.$$('.cancel')), 'cancel 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.$$('.quote')), 'quote is not visible');
|
||||||
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
|
assert.isFalse(isVisible(element.$$('.done')), 'done is not visible');
|
||||||
|
|
||||||
element.draft = false,
|
element.draft = false;
|
||||||
element.editing = 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')),
|
assert.isFalse(isVisible(element.$$('.discard')),
|
||||||
'discard is not visible');
|
'discard is not visible');
|
||||||
assert.isFalse(isVisible(element.$$('.save')), 'save 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.
|
// Save should be disabled on an empty message.
|
||||||
var disabled = element.$$('.save').hasAttribute('disabled');
|
var disabled = element.$$('.save').hasAttribute('disabled');
|
||||||
assert.isTrue(disabled, 'save button should be disabled.');
|
assert.isTrue(disabled, 'save button should be disabled.');
|
||||||
element._editDraft == ' ';
|
element._editDraft = ' ';
|
||||||
disabled = element.$$('.save').hasAttribute('disabled');
|
disabled = element.$$('.save').hasAttribute('disabled');
|
||||||
assert.isTrue(disabled, 'save button should be disabled.');
|
assert.isTrue(disabled, 'save button should be disabled.');
|
||||||
|
|
||||||
|
@@ -144,9 +144,9 @@ limitations under the License.
|
|||||||
'/changes/41/1/drafts',
|
'/changes/41/1/drafts',
|
||||||
[
|
[
|
||||||
201,
|
201,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' + JSON.stringify({
|
')]}\'\n' + JSON.stringify({
|
||||||
id: "7afa4931_de3d65bd",
|
id: '7afa4931_de3d65bd',
|
||||||
path: '/path/to/file.txt',
|
path: '/path/to/file.txt',
|
||||||
line: 5,
|
line: 5,
|
||||||
in_reply_to: 'baf0414d_60047215',
|
in_reply_to: 'baf0414d_60047215',
|
||||||
|
@@ -64,7 +64,7 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
var cancelPromise = new Promise(function(resolve) {
|
var cancelPromise = new Promise(function(resolve) {
|
||||||
element.addEventListener('cancel', function() { resolve(); });
|
element.addEventListener('cancel', function() { resolve(); });
|
||||||
})
|
});
|
||||||
Promise.all([savePromise, cancelPromise]).then(function() {
|
Promise.all([savePromise, cancelPromise]).then(function() {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -84,8 +84,8 @@ limitations under the License.
|
|||||||
'[[_computeCurrentRevisionMessage(change)]]"></gr-linked-text>';
|
'[[_computeCurrentRevisionMessage(change)]]"></gr-linked-text>';
|
||||||
var html = util.escapeHTML(content);
|
var html = util.escapeHTML(content);
|
||||||
var highlights = [
|
var highlights = [
|
||||||
{ startIndex: 0, endIndex: 33, },
|
{startIndex: 0, endIndex: 33},
|
||||||
{ startIndex: 75 },
|
{startIndex: 75},
|
||||||
];
|
];
|
||||||
assert.equal(
|
assert.equal(
|
||||||
content.slice(highlights[0].startIndex, highlights[0].endIndex),
|
content.slice(highlights[0].startIndex, highlights[0].endIndex),
|
||||||
@@ -178,7 +178,7 @@ limitations under the License.
|
|||||||
}];
|
}];
|
||||||
contentEl = element.$$('.content .code[data-line-num="1"]');
|
contentEl = element.$$('.content .code[data-line-num="1"]');
|
||||||
assert.ok(contentEl);
|
assert.ok(contentEl);
|
||||||
var spanEl = contentEl.childNodes[1];
|
spanEl = contentEl.childNodes[1];
|
||||||
assert.equal(spanEl.tagName, 'SPAN');
|
assert.equal(spanEl.tagName, 'SPAN');
|
||||||
assert.isTrue(spanEl.classList.contains(
|
assert.isTrue(spanEl.classList.contains(
|
||||||
'style-scope', 'gr-diff-side', 'tab'));
|
'style-scope', 'gr-diff-side', 'tab'));
|
||||||
@@ -246,7 +246,7 @@ limitations under the License.
|
|||||||
|
|
||||||
test('tap line to add a draft', function() {
|
test('tap line to add a draft', function() {
|
||||||
var numAddDraftEvents = 0;
|
var numAddDraftEvents = 0;
|
||||||
var fireMock = sinon.stub(element, 'fire', function(eventName) {
|
sinon.stub(element, 'fire', function(eventName) {
|
||||||
if (eventName == 'add-draft') {
|
if (eventName == 'add-draft') {
|
||||||
numAddDraftEvents++;
|
numAddDraftEvents++;
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ limitations under the License.
|
|||||||
/\/changes\/42\/revisions\/(1|2)\/files\/sieve\.go\/diff(.*)/,
|
/\/changes\/42\/revisions\/(1|2)\/files\/sieve\.go\/diff(.*)/,
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
change_type: 'MODIFIED',
|
change_type: 'MODIFIED',
|
||||||
@@ -99,7 +99,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/1/comments',
|
'/changes/42/revisions/1/comments',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
'/COMMIT_MSG': [],
|
'/COMMIT_MSG': [],
|
||||||
@@ -136,7 +136,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/2/comments',
|
'/changes/42/revisions/2/comments',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
'/COMMIT_MSG': [],
|
'/COMMIT_MSG': [],
|
||||||
@@ -187,9 +187,9 @@ limitations under the License.
|
|||||||
'/accounts/self/preferences.diff',
|
'/accounts/self/preferences.diff',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({ context: 25 }),
|
JSON.stringify({context: 25}),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ limitations under the License.
|
|||||||
newThreadEls[i].classList.contains('commentThread') ||
|
newThreadEls[i].classList.contains('commentThread') ||
|
||||||
newThreadEls[i].tagName == 'GR-DIFF-COMMENT-THREAD');
|
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(newThreadEls[1].offsetHeight, newHeight);
|
||||||
assert.equal(leftFillerEls[0].offsetHeight, newHeight);
|
assert.equal(leftFillerEls[0].offsetHeight, newHeight);
|
||||||
assert.equal(leftThreadEls[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(rightFillerEls[1].offsetHeight, originalHeight);
|
||||||
assert.equal(leftThreadEls[0].offsetHeight, originalHeight);
|
assert.equal(leftThreadEls[0].offsetHeight, originalHeight);
|
||||||
assert.equal(leftFillerEls[0].offsetHeight, originalHeight);
|
assert.equal(leftFillerEls[0].offsetHeight, originalHeight);
|
||||||
done()
|
done();
|
||||||
});
|
});
|
||||||
var commentEl = newThreadEls[1].$$('gr-diff-comment');
|
var commentEl = newThreadEls[1].$$('gr-diff-comment');
|
||||||
commentEl.fire('discard', null, {bubbles: false});
|
commentEl.fire('discard', null, {bubbles: false});
|
||||||
}, 1);
|
}, 1);
|
||||||
}, 1);
|
}, 1);
|
||||||
}),
|
});
|
||||||
|
|
||||||
test('intraline normalization', function() {
|
test('intraline normalization', function() {
|
||||||
// The content and highlights are in the format returned by the Gerrit
|
// The content and highlights are in the format returned by the Gerrit
|
||||||
@@ -514,8 +514,8 @@ limitations under the License.
|
|||||||
10: {},
|
10: {},
|
||||||
};
|
};
|
||||||
var ctx = {
|
var ctx = {
|
||||||
left: { lineNum: 0 },
|
left: {lineNum: 0},
|
||||||
right: { lineNum: 0 },
|
right: {lineNum: 0},
|
||||||
};
|
};
|
||||||
var content = [
|
var content = [
|
||||||
{
|
{
|
||||||
|
@@ -46,7 +46,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/1/files',
|
'/changes/42/revisions/1/files',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
'/COMMIT_MSG': {
|
'/COMMIT_MSG': {
|
||||||
@@ -68,7 +68,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/2/files',
|
'/changes/42/revisions/2/files',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
'/COMMIT_MSG': {
|
'/COMMIT_MSG': {
|
||||||
@@ -165,14 +165,14 @@ limitations under the License.
|
|||||||
test('comment filtering', function() {
|
test('comment filtering', function() {
|
||||||
var comments = {
|
var comments = {
|
||||||
'/COMMIT_MSG': [
|
'/COMMIT_MSG': [
|
||||||
{ patch_set: 1, message: 'Done' },
|
{patch_set: 1, message: 'Done'},
|
||||||
{ patch_set: 1, message: 'oh hay' },
|
{patch_set: 1, message: 'oh hay'},
|
||||||
{ patch_set: 2, message: 'hello' },
|
{patch_set: 2, message: 'hello'},
|
||||||
],
|
],
|
||||||
'myfile.txt': [
|
'myfile.txt': [
|
||||||
{ patch_set: 1, message: 'good news!' },
|
{patch_set: 1, message: 'good news!'},
|
||||||
{ patch_set: 2, message: 'wat!?' },
|
{patch_set: 2, message: 'wat!?'},
|
||||||
{ patch_set: 2, message: 'hi' },
|
{patch_set: 2, message: 'hi'},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@@ -93,7 +93,7 @@ limitations under the License.
|
|||||||
|
|
||||||
test('Change-Id pattern was parsed and linked', function() {
|
test('Change-Id pattern was parsed and linked', function() {
|
||||||
// "Change-Id:" pattern.
|
// "Change-Id:" pattern.
|
||||||
var changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e'
|
var changeID = 'I11d6a37f5e9b5df0486f6c922d8836dfa780e03e';
|
||||||
var prefix = 'Change-Id: ';
|
var prefix = 'Change-Id: ';
|
||||||
element.content = prefix + changeID;
|
element.content = prefix + changeID;
|
||||||
|
|
||||||
@@ -110,7 +110,6 @@ limitations under the License.
|
|||||||
test('Multiple matches', function() {
|
test('Multiple matches', function() {
|
||||||
element.content = 'Issue 3650\nIssue 3450';
|
element.content = 'Issue 3650\nIssue 3450';
|
||||||
var linkEl1 = element.$.output.childNodes[0];
|
var linkEl1 = element.$.output.childNodes[0];
|
||||||
var newlineNode = element.$.output.childNodes[1];
|
|
||||||
var linkEl2 = element.$.output.childNodes[2];
|
var linkEl2 = element.$.output.childNodes[2];
|
||||||
|
|
||||||
assert.equal(linkEl1.target, '_blank');
|
assert.equal(linkEl1.target, '_blank');
|
||||||
|
@@ -80,7 +80,7 @@ limitations under the License.
|
|||||||
'/changes/42/revisions/1/review',
|
'/changes/42/revisions/1/review',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
'{' +
|
'{' +
|
||||||
'"labels": {' +
|
'"labels": {' +
|
||||||
@@ -154,7 +154,7 @@ limitations under the License.
|
|||||||
message: 'I wholeheartedly disapprove'
|
message: 'I wholeheartedly disapprove'
|
||||||
});
|
});
|
||||||
assert.equal(req.response.labels['Code-Review'], -1);
|
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);
|
assert.isFalse(element.opened);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -45,27 +45,27 @@ limitations under the License.
|
|||||||
/\/changes\/42\/suggest_reviewers\?n=10&q=andy(.*)/,
|
/\/changes\/42\/suggest_reviewers\?n=10&q=andy(.*)/,
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json' },
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify([
|
JSON.stringify([
|
||||||
{
|
{
|
||||||
account: {
|
account: {
|
||||||
_account_id: 1021482,
|
_account_id: 1021482,
|
||||||
name: "Andrew Bonventre",
|
name: 'Andrew Bonventre',
|
||||||
email: "andybons@chromium.org",
|
email: 'andybons@chromium.org',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
account: {
|
account: {
|
||||||
_account_id: 1021863,
|
_account_id: 1021863,
|
||||||
name: "Andrew Bonventre",
|
name: 'Andrew Bonventre',
|
||||||
email: "andybons@google.com",
|
email: 'andybons@google.com',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": {
|
group: {
|
||||||
"id": "c7af6dd375c092ff3b23c0937aa910693dc0c41b",
|
id: 'c7af6dd375c092ff3b23c0937aa910693dc0c41b',
|
||||||
"name": "andy"
|
name: 'andy',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
@@ -76,7 +76,7 @@ limitations under the License.
|
|||||||
'/changes/42/reviewers',
|
'/changes/42/reviewers',
|
||||||
[
|
[
|
||||||
200,
|
200,
|
||||||
{ 'Content-Type': 'application/json'},
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n' +
|
')]}\'\n' +
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
reviewers: [{
|
reviewers: [{
|
||||||
@@ -95,7 +95,7 @@ limitations under the License.
|
|||||||
'/changes/42/reviewers/1021482',
|
'/changes/42/reviewers/1021482',
|
||||||
[
|
[
|
||||||
204,
|
204,
|
||||||
{ 'Content-Type': 'application/json'},
|
{'Content-Type': 'application/json'},
|
||||||
')]}\'\n{}',
|
')]}\'\n{}',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -198,7 +198,8 @@ limitations under the License.
|
|||||||
function() {
|
function() {
|
||||||
assert(false, 'generateRequest should not be called for input ' +
|
assert(false, 'generateRequest should not be called for input ' +
|
||||||
'lengths of less than 3 chars');
|
'lengths of less than 3 chars');
|
||||||
});
|
}
|
||||||
|
);
|
||||||
element._inputVal = 'fo';
|
element._inputVal = 'fo';
|
||||||
flushAsynchronousOperations();
|
flushAsynchronousOperations();
|
||||||
genRequestStub.restore();
|
genRequestStub.restore();
|
||||||
@@ -209,7 +210,7 @@ limitations under the License.
|
|||||||
_number: 42,
|
_number: 42,
|
||||||
reviewers: {},
|
reviewers: {},
|
||||||
removable_reviewers: [],
|
removable_reviewers: [],
|
||||||
owner: { _account_id: 0 },
|
owner: {_account_id: 0},
|
||||||
};
|
};
|
||||||
element._inputRequestTimeout = 0;
|
element._inputRequestTimeout = 0;
|
||||||
element._mutable = true;
|
element._mutable = true;
|
||||||
|
@@ -23,7 +23,8 @@ limitations under the License.
|
|||||||
<script>
|
<script>
|
||||||
var testFiles = [];
|
var testFiles = [];
|
||||||
|
|
||||||
[ 'gr-account-dropdown-test.html',
|
[
|
||||||
|
'gr-account-dropdown-test.html',
|
||||||
'gr-account-label-test.html',
|
'gr-account-label-test.html',
|
||||||
'gr-account-link-test.html',
|
'gr-account-link-test.html',
|
||||||
'gr-avatar-test.html',
|
'gr-avatar-test.html',
|
||||||
|
Reference in New Issue
Block a user