Fix formatting issues flagged by eslint
Change-Id: I13d9c4b2331bd5071cfa094d3cdbb5de2e380d8f
This commit is contained in:
@@ -99,9 +99,9 @@ limitations under the License.
|
||||
SKIP_MERGEABLE: 22,
|
||||
|
||||
/**
|
||||
* Skip diffstat computation that compute the insertions field (number of lines inserted) and
|
||||
* deletions field (number of lines deleted)
|
||||
*/
|
||||
* Skip diffstat computation that compute the insertions field (number of lines inserted) and
|
||||
* deletions field (number of lines deleted)
|
||||
*/
|
||||
SKIP_DIFFSTAT: 23,
|
||||
},
|
||||
|
||||
|
||||
@@ -225,8 +225,8 @@
|
||||
|
||||
editRefInput() {
|
||||
return Polymer.dom(this.root).querySelector(Polymer.Element ?
|
||||
'iron-input.editRefInput' :
|
||||
'input[is=iron-input].editRefInput');
|
||||
'iron-input.editRefInput' :
|
||||
'input[is=iron-input].editRefInput');
|
||||
},
|
||||
|
||||
editReference() {
|
||||
|
||||
@@ -367,7 +367,7 @@ limitations under the License.
|
||||
element.$.matchAuthoredDateWithCommitterDateSelect.bindValue =
|
||||
configInputObj.match_author_to_committer_date;
|
||||
const inputElement = Polymer.Element ?
|
||||
element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput;
|
||||
element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput;
|
||||
inputElement.bindValue = configInputObj.max_object_size_limit;
|
||||
element.$.contributorAgreementSelect.bindValue =
|
||||
configInputObj.use_contributor_agreements;
|
||||
|
||||
@@ -434,7 +434,7 @@
|
||||
|
||||
_getRebaseAction(revisionActions) {
|
||||
return this._getRevisionAction(revisionActions, 'rebase',
|
||||
{rebaseOnCurrent: null}
|
||||
{rebaseOnCurrent: null}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* @param label {string|undefined}
|
||||
* @param permittedLabels {Object|undefined}
|
||||
* @param {string|undefined} label
|
||||
* @param {Object|undefined} permittedLabels
|
||||
* @return {string}
|
||||
*/
|
||||
_computeLabelAccessClass(label, permittedLabels) {
|
||||
|
||||
@@ -118,26 +118,26 @@ limitations under the License.
|
||||
/* topMenus= */[],
|
||||
/* docBaseUrl= */ ''
|
||||
),
|
||||
defaultLinks.concat({
|
||||
title: 'Browse',
|
||||
links: adminLinks,
|
||||
}));
|
||||
defaultLinks.concat({
|
||||
title: 'Browse',
|
||||
links: adminLinks,
|
||||
}));
|
||||
assert.deepEqual(element._computeLinks(
|
||||
defaultLinks,
|
||||
userLinks,
|
||||
adminLinks,
|
||||
/* topMenus= */[],
|
||||
/* docBaseUrl= */ ''
|
||||
),
|
||||
defaultLinks.concat([
|
||||
{
|
||||
title: 'Your',
|
||||
links: userLinks,
|
||||
},
|
||||
{
|
||||
title: 'Browse',
|
||||
links: adminLinks,
|
||||
}])
|
||||
),
|
||||
defaultLinks.concat([
|
||||
{
|
||||
title: 'Your',
|
||||
links: userLinks,
|
||||
},
|
||||
{
|
||||
title: 'Browse',
|
||||
links: adminLinks,
|
||||
}])
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
if (!this.diffRow) return null;
|
||||
|
||||
const hostOwner = Polymer.dom(/** @type {Node} */ (this.diffRow))
|
||||
.getOwnerRoot();
|
||||
.getOwnerRoot();
|
||||
if (hostOwner && hostOwner.host &&
|
||||
hostOwner.host.tagName === 'GR-DIFF') {
|
||||
return hostOwner.host;
|
||||
@@ -233,8 +233,8 @@
|
||||
if (!this.diffRow) {
|
||||
// does not scroll during init unless requested
|
||||
const scrollingBehaviorForInit = this.initialLineNumber ?
|
||||
ScrollBehavior.KEEP_VISIBLE :
|
||||
ScrollBehavior.NEVER;
|
||||
ScrollBehavior.KEEP_VISIBLE :
|
||||
ScrollBehavior.NEVER;
|
||||
this._scrollBehavior = scrollingBehaviorForInit;
|
||||
this.reInitCursor();
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
this._setClasses([
|
||||
SelectionClass.COMMENT,
|
||||
node.commentSide === 'left' ?
|
||||
SelectionClass.LEFT :
|
||||
SelectionClass.RIGHT,
|
||||
SelectionClass.LEFT :
|
||||
SelectionClass.RIGHT,
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
/**
|
||||
* True means all changes in this line are whitespace changes that should
|
||||
* not be highlighted as changed as per the user settings.
|
||||
*
|
||||
* @type{boolean}
|
||||
*/
|
||||
this.ignoredWhitespaceOnly = false;
|
||||
@@ -185,11 +186,11 @@
|
||||
|
||||
if (before.length) {
|
||||
beforeGroups.push(before.length === group.lines.length ?
|
||||
group : group.cloneWithLines(before));
|
||||
group : group.cloneWithLines(before));
|
||||
}
|
||||
if (after.length) {
|
||||
afterGroups.push(after.length === group.lines.length ?
|
||||
group : group.cloneWithLines(after));
|
||||
group : group.cloneWithLines(after));
|
||||
}
|
||||
}
|
||||
return [beforeGroups, afterGroups];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
/** @type {boolean} */
|
||||
this.hasIntralineInfo = false;
|
||||
|
||||
/** @type Array<GrDiffLine.Highlights> */
|
||||
/** @type {Array<GrDiffLine.Highlights>} */
|
||||
this.highlights = [];
|
||||
|
||||
/** @type {?Array<Object>} ?Array<!GrDiffGroup> */
|
||||
|
||||
@@ -1070,7 +1070,7 @@ limitations under the License.
|
||||
/* loading= */ false,
|
||||
element.prefs,
|
||||
element._diffLength
|
||||
));
|
||||
));
|
||||
});
|
||||
|
||||
test('do not show the message if still loading', () => {
|
||||
@@ -1079,7 +1079,7 @@ limitations under the License.
|
||||
/* loading= */ true,
|
||||
element.prefs,
|
||||
element._diffLength
|
||||
));
|
||||
));
|
||||
});
|
||||
|
||||
test('do not show the message if contains valid changes', () => {
|
||||
@@ -1098,7 +1098,7 @@ limitations under the License.
|
||||
/* loading= */ false,
|
||||
element.prefs,
|
||||
element._diffLength
|
||||
));
|
||||
));
|
||||
});
|
||||
|
||||
test('do not show message if ignore whitespace is disabled', () => {
|
||||
@@ -1116,7 +1116,7 @@ limitations under the License.
|
||||
/* loading= */ false,
|
||||
element.prefs,
|
||||
element._diffLength
|
||||
));
|
||||
));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1129,7 +1129,7 @@ limitations under the License.
|
||||
element = fixture('basic');
|
||||
element.prefs = {};
|
||||
renderStub = sandbox.stub(element.$.diffBuilder, 'render')
|
||||
.returns(Promise.resolve());
|
||||
.returns(Promise.resolve());
|
||||
element.addEventListener('render', event => {
|
||||
assert.isTrue(event.detail.contentRendered);
|
||||
done();
|
||||
|
||||
@@ -192,8 +192,8 @@ suite('gr-edit-controls tests', () => {
|
||||
let renameStub;
|
||||
let renameAutocomplete;
|
||||
const inputSelector = Polymer.Element ?
|
||||
'.newPathIronInput' :
|
||||
'.newPathInput';
|
||||
'.newPathIronInput' :
|
||||
'.newPathInput';
|
||||
|
||||
setup(() => {
|
||||
navStub = sandbox.stub(Gerrit.Nav, 'navigateToChange');
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
/**
|
||||
* The last time the g key was pressed in milliseconds (or a keydown event
|
||||
* was handled if the key is held down).
|
||||
*
|
||||
* @type {number|null}
|
||||
*/
|
||||
_lastGKeyPressTimestamp: {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
/**
|
||||
* Alias of onClick
|
||||
*
|
||||
* @see onClick
|
||||
*/
|
||||
GrEventHelper.prototype.onTap = function(callback) {
|
||||
@@ -55,6 +56,7 @@
|
||||
|
||||
/**
|
||||
* Alias of captureClick
|
||||
*
|
||||
* @see captureClick
|
||||
*/
|
||||
GrEventHelper.prototype.captureTap = function(callback) {
|
||||
|
||||
@@ -33,12 +33,13 @@
|
||||
* if it hasn't been added yet. A root node is an document or is the
|
||||
* associated shadowRoot. This class can be added to any element with the same
|
||||
* root node.
|
||||
*
|
||||
* @param {HTMLElement} element The element to get class name for.
|
||||
* @return {string} Appropriate class name for the element is returned
|
||||
*/
|
||||
GrStyleObject.prototype.getClassName = function(element) {
|
||||
let rootNode = Polymer.Settings.useShadow
|
||||
? element.getRootNode() : document.body;
|
||||
? element.getRootNode() : document.body;
|
||||
if (rootNode === document) {
|
||||
rootNode = document.head;
|
||||
}
|
||||
@@ -56,6 +57,7 @@
|
||||
|
||||
/**
|
||||
* Apply shared style to the element.
|
||||
*
|
||||
* @param {HTMLElement} element The element to apply style for
|
||||
*/
|
||||
GrStyleObject.prototype.apply = function(element) {
|
||||
@@ -68,9 +70,10 @@
|
||||
|
||||
/**
|
||||
* Creates a new GrStyleObject with specified style properties.
|
||||
*
|
||||
* @param {string} String with style properties.
|
||||
* @return {GrStyleObject}
|
||||
*/
|
||||
*/
|
||||
GrStylesApi.prototype.css = function(ruleStr) {
|
||||
return new GrStyleObject(ruleStr);
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
_inputTextChanged(text) {
|
||||
if (text.length && this.allowAnyInput) {
|
||||
this.dispatchEvent(new CustomEvent(
|
||||
'account-text-changed', {bubbles: true, composed: true}));
|
||||
'account-text-changed', {bubbles: true, composed: true}));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ limitations under the License.
|
||||
|
||||
test('account-text-changed not fired when input text changed without ' +
|
||||
'allowAnyInput', () => {
|
||||
// Spy on query, as that is called when _updateSuggestions proceeds.
|
||||
// Spy on query, as that is called when _updateSuggestions proceeds.
|
||||
const changeStub = sandbox.stub();
|
||||
element.querySuggestions = input => Promise.resolve([]);
|
||||
element.addEventListener('account-text-changed', changeStub);
|
||||
|
||||
@@ -44,6 +44,7 @@ limitations under the License.
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
suite('gr-account-list tests', () => {
|
||||
let _nextAccountId = 0;
|
||||
const makeAccount = function() {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
/**
|
||||
* Retrieves the name of the plugin base on the url.
|
||||
*
|
||||
* @param {string|URL} url
|
||||
*/
|
||||
function getPluginNameFromUrl(url) {
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This defines the Gerrit instance. All methods directly attached to Gerrit
|
||||
* should be defined or linked here.
|
||||
*/
|
||||
/**
|
||||
* This defines the Gerrit instance. All methods directly attached to Gerrit
|
||||
* should be defined or linked here.
|
||||
*/
|
||||
|
||||
(function(window) {
|
||||
'use strict';
|
||||
|
||||
// Import utils methods
|
||||
const {
|
||||
send,
|
||||
getRestAPI,
|
||||
send,
|
||||
getRestAPI,
|
||||
} = window._apiUtils;
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@
|
||||
testOnly_resetInternalState,
|
||||
} = window._apiUtils;
|
||||
Gerrit._testOnly_installPreloadedPlugins = (...args) => Gerrit._pluginLoader
|
||||
.installPreloadedPlugins(...args);
|
||||
.installPreloadedPlugins(...args);
|
||||
Gerrit._testOnly_flushPreinstalls = flushPreinstalls;
|
||||
Gerrit._testOnly_resetPlugins = () => {
|
||||
testOnly_resetInternalState();
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
getCoverageRanges(changeNum, path, basePatchNum, patchNum) {
|
||||
return Gerrit.awaitPluginsLoaded().then(() => {
|
||||
for (const annotationApi of
|
||||
this._getEventCallbacks(EventType.ANNOTATE_DIFF)) {
|
||||
this._getEventCallbacks(EventType.ANNOTATE_DIFF)) {
|
||||
const provider = annotationApi.getCoverageProvider();
|
||||
// Only one coverage provider makes sense. If there are more, then we
|
||||
// simply ignore them.
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
// Import utils methods
|
||||
const {
|
||||
PLUGIN_LOADING_TIMEOUT_MS,
|
||||
PRELOADED_PROTOCOL,
|
||||
getPluginNameFromUrl,
|
||||
getBaseUrl,
|
||||
PLUGIN_LOADING_TIMEOUT_MS,
|
||||
PRELOADED_PROTOCOL,
|
||||
getPluginNameFromUrl,
|
||||
getBaseUrl,
|
||||
} = window._apiUtils;
|
||||
|
||||
/**
|
||||
@@ -95,6 +95,7 @@
|
||||
|
||||
/**
|
||||
* Use the plugin name or use the full url if not recognized.
|
||||
*
|
||||
* @see gr-api-utils#getPluginNameFromUrl
|
||||
* @param {string|URL} url
|
||||
*/
|
||||
@@ -282,6 +283,7 @@
|
||||
|
||||
/**
|
||||
* Checks if given plugin path/url is enabled or not.
|
||||
*
|
||||
* @param {string} pathOrUrl
|
||||
*/
|
||||
isPluginEnabled(pathOrUrl) {
|
||||
@@ -293,6 +295,7 @@
|
||||
|
||||
/**
|
||||
* Returns the plugin object with a given url.
|
||||
*
|
||||
* @param {string} pathOrUrl
|
||||
*/
|
||||
getPlugin(pathOrUrl) {
|
||||
@@ -302,6 +305,7 @@
|
||||
|
||||
/**
|
||||
* Checks if given plugin path/url is loaded or not.
|
||||
*
|
||||
* @param {string} pathOrUrl
|
||||
*/
|
||||
isPluginLoaded(pathOrUrl) {
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
// Import utils methods
|
||||
const {
|
||||
getPluginNameFromUrl,
|
||||
send,
|
||||
getPluginNameFromUrl,
|
||||
send,
|
||||
} = window._apiUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -691,7 +691,7 @@ limitations under the License.
|
||||
|
||||
test('setAccountStatus', () => {
|
||||
const sendStub = sandbox.stub(element._restApiHelper, 'send')
|
||||
.returns(Promise.resolve('OOO'));
|
||||
.returns(Promise.resolve('OOO'));
|
||||
element._cache.set('/accounts/self/detail', {});
|
||||
return element.setAccountStatus('OOO').then(() => {
|
||||
assert.isTrue(sendStub.calledOnce);
|
||||
@@ -702,7 +702,7 @@ limitations under the License.
|
||||
{status: 'OOO'});
|
||||
assert.deepEqual(element._restApiHelper
|
||||
._cache.get('/accounts/self/detail'),
|
||||
{status: 'OOO'});
|
||||
{status: 'OOO'});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
/**
|
||||
* Wraps calls to the underlying authenticated fetch function (_auth.fetch)
|
||||
* with timing and logging.
|
||||
*
|
||||
* @param {Gerrit.FetchRequest} req
|
||||
*/
|
||||
fetch(req) {
|
||||
@@ -139,6 +140,7 @@
|
||||
* Log information about a REST call. Because the elapsed time is determined
|
||||
* by this method, it should be called immediately after the request
|
||||
* finishes.
|
||||
*
|
||||
* @param {Gerrit.FetchRequest} req
|
||||
* @param {number} startTime the time that the request was started.
|
||||
* @param {number} status the HTTP status of the response. The status value
|
||||
@@ -147,7 +149,7 @@
|
||||
*/
|
||||
_logCall(req, startTime, status) {
|
||||
const method = (req.fetchOptions && req.fetchOptions.method) ?
|
||||
req.fetchOptions.method : 'GET';
|
||||
req.fetchOptions.method : 'GET';
|
||||
const endTime = Date.now();
|
||||
const elapsed = (endTime - startTime);
|
||||
const startAt = new Date(startTime);
|
||||
@@ -171,6 +173,7 @@
|
||||
* Returns a Promise that resolves to a native Response.
|
||||
* Doesn't do error checking. Supports cancel condition. Performs auth.
|
||||
* Validates auth expiry errors.
|
||||
*
|
||||
* @param {Gerrit.FetchJSONRequest} req
|
||||
*/
|
||||
fetchRawJSON(req) {
|
||||
@@ -205,6 +208,7 @@
|
||||
* Fetch JSON from url provided.
|
||||
* Returns a Promise that resolves to a parsed response.
|
||||
* Same as {@link fetchRawJSON}, plus error handling.
|
||||
*
|
||||
* @param {Gerrit.FetchJSONRequest} req
|
||||
*/
|
||||
fetchJSON(req) {
|
||||
@@ -329,6 +333,7 @@
|
||||
|
||||
/**
|
||||
* Send an XHR.
|
||||
*
|
||||
* @param {Gerrit.SendRequest} req
|
||||
* @return {Promise}
|
||||
*/
|
||||
@@ -339,7 +344,7 @@
|
||||
options.headers.set(
|
||||
'Content-Type', req.contentType || 'application/json');
|
||||
options.body = typeof req.body === 'string' ?
|
||||
req.body : JSON.stringify(req.body);
|
||||
req.body : JSON.stringify(req.body);
|
||||
}
|
||||
if (req.headers) {
|
||||
if (!options.headers) { options.headers = new Headers(); }
|
||||
@@ -349,7 +354,7 @@
|
||||
}
|
||||
}
|
||||
const url = req.url.startsWith('http') ?
|
||||
req.url : this.getBaseUrl() + req.url;
|
||||
req.url : this.getBaseUrl() + req.url;
|
||||
const fetchReq = {
|
||||
url,
|
||||
fetchOptions: options,
|
||||
|
||||
@@ -68,7 +68,7 @@ limitations under the License.
|
||||
test('getSuggestions', done => {
|
||||
const getSuggestedAccountsStub =
|
||||
sandbox.stub(restAPI, 'getSuggestedAccounts')
|
||||
.returns(Promise.resolve([account1, account2]));
|
||||
.returns(Promise.resolve([account1, account2]));
|
||||
|
||||
provider.getSuggestions('Some input').then(res => {
|
||||
assert.deepEqual(res, [account1, account2]);
|
||||
|
||||
@@ -35,14 +35,15 @@
|
||||
switch (usersType) {
|
||||
case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.REVIEWER:
|
||||
return new GrReviewerSuggestionsProvider(restApi, changeNumber,
|
||||
input => restApi.getChangeSuggestedReviewers(changeNumber, input));
|
||||
input => restApi.getChangeSuggestedReviewers(changeNumber,
|
||||
input));
|
||||
case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.CC:
|
||||
return new GrReviewerSuggestionsProvider(restApi, changeNumber,
|
||||
input => restApi.getChangeSuggestedCCs(changeNumber, input));
|
||||
input => restApi.getChangeSuggestedCCs(changeNumber, input));
|
||||
case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.ANY:
|
||||
return new GrReviewerSuggestionsProvider(restApi, changeNumber,
|
||||
input => restApi.getSuggestedAccounts(
|
||||
`cansee:${changeNumber} ${input}`));
|
||||
input => restApi.getSuggestedAccounts(
|
||||
`cansee:${changeNumber} ${input}`));
|
||||
default:
|
||||
throw new Error(`Unknown users type: ${usersType}`);
|
||||
}
|
||||
@@ -65,9 +66,9 @@
|
||||
this._loggedIn = loggedIn;
|
||||
});
|
||||
this._initPromise = Promise.all([getConfigPromise, getLoggedInPromise])
|
||||
.then(() => {
|
||||
this._initialized = true;
|
||||
});
|
||||
.then(() => {
|
||||
this._initialized = true;
|
||||
});
|
||||
return this._initPromise;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ Gerrit.ChangeFetchRequest;
|
||||
* - headers is a key-value hash to describe HTTP headers for the request.
|
||||
* - parseResponse states whether the result should be parsed as a JSON
|
||||
* object using getResponseObject.
|
||||
*
|
||||
* @typedef {{
|
||||
* method: string,
|
||||
* url: string,
|
||||
@@ -146,6 +147,7 @@ Gerrit.FetchRequest;
|
||||
* - cancelCondition is a function that, if provided and returns true, will
|
||||
* cancel the response after it resolves.
|
||||
* - params is a key-value hash to specify get params for the request URL.
|
||||
*
|
||||
* @typedef {{
|
||||
* url: string,
|
||||
* errFn: (function(?Response, string=)|null|undefined),
|
||||
@@ -217,6 +219,7 @@ Gerrit.CommentsBySide;
|
||||
* Note that the implied newline character at the end of each line is included
|
||||
* in the length calculation, and thus it is possible for the edits to span
|
||||
* newlines.
|
||||
*
|
||||
* @typedef {!Array<number>}
|
||||
*/
|
||||
Gerrit.IntralineInfo;
|
||||
|
||||
Reference in New Issue
Block a user