Downport "Update eslint version and eslint rules"
Legacy indent rules doesn't handle all cases. As a result there are different indents in .js files. This commit update eslint rules and add autofix for incorrect indents. It is expected that fix should be run after converting to class-based elements. Change-Id: I844132280d3fcc6203777425316d8fb348e126c0
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
"description": "Gerrit Code Review",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.16.0",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-google": "^0.13.0",
|
||||
"eslint-plugin-html": "^5.0.5",
|
||||
"eslint-plugin-html": "^6.0.0",
|
||||
"fried-twinkie": "^0.2.2",
|
||||
"polylint": "^2.10.4",
|
||||
"typescript": "^2.x.x",
|
||||
@@ -16,6 +16,7 @@
|
||||
"start": "polygerrit-ui/run-server.sh",
|
||||
"test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh",
|
||||
"eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0",
|
||||
"eslintfix": "./node_modules/eslint/bin/eslint.js --fix --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0",
|
||||
"test-template": "./polygerrit-ui/app/run_template_test.sh",
|
||||
"polylint": "bazel test polygerrit-ui/app:polylint_test"
|
||||
},
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
"functions": "never"
|
||||
}],
|
||||
"eol-last": "off",
|
||||
"indent": "off",
|
||||
"indent-legacy": ["error", 2, {
|
||||
"indent": ["error", 2, {
|
||||
"MemberExpression": 2,
|
||||
"FunctionDeclaration": {"body": 1, "parameters": 2},
|
||||
"FunctionExpression": {"body": 1, "parameters": 2},
|
||||
@@ -44,13 +43,14 @@
|
||||
"SwitchCase": 1
|
||||
}],
|
||||
"keyword-spacing": ["error", { "after": true, "before": true }],
|
||||
"lines-between-class-members": ["error", "always"],
|
||||
"max-len": [
|
||||
"error",
|
||||
80,
|
||||
2,
|
||||
{"ignoreComments": true}
|
||||
],
|
||||
"new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }],
|
||||
"new-cap": ["error", { "capIsNewExceptions": ["Polymer", "LegacyElementMixin", "GestureEventListeners", "LegacyDataMixin"] }],
|
||||
"no-console": "off",
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
@@ -70,6 +70,19 @@
|
||||
"no-redeclare": "off",
|
||||
"operator-linebreak": "off",
|
||||
"object-shorthand": ["error", "always"],
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{
|
||||
"blankLine": "always",
|
||||
"prev": "class",
|
||||
"next": "*"
|
||||
},
|
||||
{
|
||||
"blankLine": "always",
|
||||
"prev": "*",
|
||||
"next": "class"
|
||||
}
|
||||
],
|
||||
"prefer-arrow-callback": "error",
|
||||
"prefer-const": "error",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
|
||||
@@ -56,7 +56,7 @@ limitations under the License.
|
||||
cachedPromise = undefined;
|
||||
},
|
||||
},
|
||||
Gerrit.BaseUrlBehavior,
|
||||
Gerrit.BaseUrlBehavior,
|
||||
];
|
||||
})(window);
|
||||
</script>
|
||||
|
||||
@@ -56,8 +56,8 @@ limitations under the License.
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
Gerrit.BaseUrlBehavior,
|
||||
Gerrit.URLEncodingBehavior,
|
||||
Gerrit.BaseUrlBehavior,
|
||||
Gerrit.URLEncodingBehavior,
|
||||
];
|
||||
})(window);
|
||||
</script>
|
||||
|
||||
@@ -124,8 +124,8 @@ limitations under the License.
|
||||
// 2 -> 3, 3 -> 5, etc.
|
||||
// Map an edit to the patchNum of parent*2... I.e. edit on 2 -> 4.
|
||||
const num = r => r._number === Gerrit.PatchSetBehavior.EDIT_NAME ?
|
||||
2 * editParent :
|
||||
2 * (r._number - 1) + 1;
|
||||
2 * editParent :
|
||||
2 * (r._number - 1) + 1;
|
||||
return revisions.sort((a, b) => num(b) - num(a));
|
||||
},
|
||||
|
||||
|
||||
@@ -238,8 +238,8 @@ limitations under the License.
|
||||
|
||||
test('directory view', () => {
|
||||
const {
|
||||
NEXT_FILE, NEXT_LINE, GO_TO_OPENED_CHANGES, SEARCH,
|
||||
SAVE_COMMENT,
|
||||
NEXT_FILE, NEXT_LINE, GO_TO_OPENED_CHANGES, SEARCH,
|
||||
SAVE_COMMENT,
|
||||
} = kb.Shortcut;
|
||||
const {DIFFS, EVERYWHERE, NAVIGATION} = kb.ShortcutSection;
|
||||
const {GO_KEY, ShortcutManager} = kb;
|
||||
|
||||
@@ -169,7 +169,7 @@ limitations under the License.
|
||||
return this.changeStatuses(change).join(', ');
|
||||
},
|
||||
},
|
||||
Gerrit.BaseUrlBehavior,
|
||||
Gerrit.BaseUrlBehavior,
|
||||
];
|
||||
})(window);
|
||||
</script>
|
||||
|
||||
@@ -206,7 +206,7 @@ limitations under the License.
|
||||
};
|
||||
assert.equal(element._computePermissionName(name, permission,
|
||||
element.permissionValues, element.capabilities),
|
||||
element.capabilities[permission.id].name);
|
||||
element.capabilities[permission.id].name);
|
||||
|
||||
name = 'refs/for/*';
|
||||
permission = {
|
||||
@@ -216,7 +216,7 @@ limitations under the License.
|
||||
|
||||
assert.equal(element._computePermissionName(
|
||||
name, permission, element.permissionValues, element.capabilities),
|
||||
element.permissionValues[permission.id].name);
|
||||
element.permissionValues[permission.id].name);
|
||||
|
||||
name = 'refs/for/*';
|
||||
permission = {
|
||||
@@ -228,7 +228,7 @@ limitations under the License.
|
||||
|
||||
assert.equal(element._computePermissionName(name, permission,
|
||||
element.permissionValues, element.capabilities),
|
||||
'Label Code-Review');
|
||||
'Label Code-Review');
|
||||
|
||||
permission = {
|
||||
id: 'labelAs-Code-Review',
|
||||
@@ -239,7 +239,7 @@ limitations under the License.
|
||||
|
||||
assert.equal(element._computePermissionName(name, permission,
|
||||
element.permissionValues, element.capabilities),
|
||||
'Label Code-Review(On Behalf Of)');
|
||||
'Label Code-Review(On Behalf Of)');
|
||||
});
|
||||
|
||||
test('_computeSectionName', () => {
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
return;
|
||||
}
|
||||
this._groups = Object.keys(groups)
|
||||
.map(key => {
|
||||
const group = groups[key];
|
||||
group.name = key;
|
||||
return group;
|
||||
});
|
||||
.map(key => {
|
||||
const group = groups[key];
|
||||
group.name = key;
|
||||
return group;
|
||||
});
|
||||
this._loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -105,23 +105,23 @@
|
||||
.then(res => {
|
||||
this._filteredLinks = res.links;
|
||||
this._breadcrumbParentName = res.expandedSection ?
|
||||
res.expandedSection.name : '';
|
||||
res.expandedSection.name : '';
|
||||
|
||||
if (!res.expandedSection) {
|
||||
this._subsectionLinks = [];
|
||||
return;
|
||||
}
|
||||
this._subsectionLinks = [res.expandedSection]
|
||||
.concat(res.expandedSection.children).map(section => {
|
||||
return {
|
||||
text: !section.detailType ? 'Home' : section.name,
|
||||
value: section.view + (section.detailType || ''),
|
||||
view: section.view,
|
||||
url: section.url,
|
||||
detailType: section.detailType,
|
||||
parent: this._groupId || this._repoName || '',
|
||||
};
|
||||
});
|
||||
.concat(res.expandedSection.children).map(section => {
|
||||
return {
|
||||
text: !section.detailType ? 'Home' : section.name,
|
||||
value: section.view + (section.detailType || ''),
|
||||
view: section.view,
|
||||
url: section.url,
|
||||
detailType: section.detailType,
|
||||
parent: this._groupId || this._repoName || '',
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -102,21 +102,21 @@
|
||||
}
|
||||
return this.$.restAPI.getRepoBranches(
|
||||
input, this.repoName, SUGGESTIONS_LIMIT).then(response => {
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
});
|
||||
},
|
||||
|
||||
_formatBooleanString(config) {
|
||||
|
||||
@@ -140,15 +140,15 @@
|
||||
_handleSavingGroupMember() {
|
||||
return this.$.restAPI.saveGroupMembers(this._groupName,
|
||||
this._groupMemberSearchId).then(config => {
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
this.$.restAPI.getGroupMembers(this._groupName).then(members => {
|
||||
this._groupMembers = members;
|
||||
});
|
||||
this._groupMemberSearchName = '';
|
||||
this._groupMemberSearchId = '';
|
||||
});
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
this.$.restAPI.getGroupMembers(this._groupName).then(members => {
|
||||
this._groupMembers = members;
|
||||
});
|
||||
this._groupMemberSearchName = '';
|
||||
this._groupMemberSearchId = '';
|
||||
});
|
||||
},
|
||||
|
||||
_handleDeleteConfirm() {
|
||||
@@ -237,24 +237,24 @@
|
||||
if (input.length === 0) { return Promise.resolve([]); }
|
||||
return this.$.restAPI.getSuggestedAccounts(
|
||||
input, SUGGESTIONS_LIMIT).then(accounts => {
|
||||
const accountSuggestions = [];
|
||||
let nameAndEmail;
|
||||
if (!accounts) { return []; }
|
||||
for (const key in accounts) {
|
||||
if (!accounts.hasOwnProperty(key)) { continue; }
|
||||
if (accounts[key].email !== undefined) {
|
||||
nameAndEmail = accounts[key].name +
|
||||
const accountSuggestions = [];
|
||||
let nameAndEmail;
|
||||
if (!accounts) { return []; }
|
||||
for (const key in accounts) {
|
||||
if (!accounts.hasOwnProperty(key)) { continue; }
|
||||
if (accounts[key].email !== undefined) {
|
||||
nameAndEmail = accounts[key].name +
|
||||
' <' + accounts[key].email + '>';
|
||||
} else {
|
||||
nameAndEmail = accounts[key].name;
|
||||
}
|
||||
accountSuggestions.push({
|
||||
name: nameAndEmail,
|
||||
value: accounts[key]._account_id,
|
||||
});
|
||||
}
|
||||
return accountSuggestions;
|
||||
} else {
|
||||
nameAndEmail = accounts[key].name;
|
||||
}
|
||||
accountSuggestions.push({
|
||||
name: nameAndEmail,
|
||||
value: accounts[key]._account_id,
|
||||
});
|
||||
}
|
||||
return accountSuggestions;
|
||||
});
|
||||
},
|
||||
|
||||
_getGroupSuggestions(input) {
|
||||
|
||||
@@ -167,10 +167,10 @@ limitations under the License.
|
||||
.querySelectorAll('.nameColumn a')[0].href, includedGroups[0].url);
|
||||
assert.equal(Polymer.dom(element.root)
|
||||
.querySelectorAll('.nameColumn a')[1].href,
|
||||
'https://test/site/group/url');
|
||||
'https://test/site/group/url');
|
||||
assert.equal(Polymer.dom(element.root)
|
||||
.querySelectorAll('.nameColumn a')[2].href,
|
||||
'https://test/site/group/url');
|
||||
'https://test/site/group/url');
|
||||
});
|
||||
|
||||
test('save members correctly', () => {
|
||||
|
||||
@@ -168,15 +168,15 @@
|
||||
}
|
||||
return this.$.restAPI.saveGroupOwner(this.groupId,
|
||||
owner).then(config => {
|
||||
this._owner = false;
|
||||
});
|
||||
this._owner = false;
|
||||
});
|
||||
},
|
||||
|
||||
_handleSaveDescription() {
|
||||
return this.$.restAPI.saveGroupDescription(this.groupId,
|
||||
this._groupConfig.description).then(config => {
|
||||
this._description = false;
|
||||
});
|
||||
this._description = false;
|
||||
});
|
||||
},
|
||||
|
||||
_handleSaveOptions() {
|
||||
@@ -186,8 +186,8 @@
|
||||
|
||||
return this.$.restAPI.saveGroupOptions(this.groupId,
|
||||
options).then(config => {
|
||||
this._options = false;
|
||||
});
|
||||
this._options = false;
|
||||
});
|
||||
},
|
||||
|
||||
_handleConfigName() {
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
|
||||
_computeGroupName(groups, groupId) {
|
||||
return groups && groups[groupId] && groups[groupId].name ?
|
||||
groups[groupId].name : groupId;
|
||||
groups[groupId].name : groupId;
|
||||
},
|
||||
|
||||
_getGroupSuggestions() {
|
||||
|
||||
@@ -91,11 +91,11 @@
|
||||
return;
|
||||
}
|
||||
this._plugins = Object.keys(plugins)
|
||||
.map(key => {
|
||||
const plugin = plugins[key];
|
||||
plugin.name = key;
|
||||
return plugin;
|
||||
});
|
||||
.map(key => {
|
||||
const plugin = plugins[key];
|
||||
plugin.name = key;
|
||||
return plugin;
|
||||
});
|
||||
this._loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
// current value appears. If there is no parent repo, it is
|
||||
// initialized as an empty string.
|
||||
this._inheritFromFilter = res.inherits_from ?
|
||||
this._inheritsFrom.name : '';
|
||||
this._inheritsFrom.name : '';
|
||||
this._local = res.local;
|
||||
this._groups = res.groups;
|
||||
this._weblinks = res.config_web_links || [];
|
||||
@@ -369,11 +369,11 @@
|
||||
};
|
||||
|
||||
const originalInheritsFromId = this._originalInheritsFrom ?
|
||||
this.singleDecodeURL(this._originalInheritsFrom.id) :
|
||||
null;
|
||||
this.singleDecodeURL(this._originalInheritsFrom.id) :
|
||||
null;
|
||||
const inheritsFromId = this._inheritsFrom ?
|
||||
this.singleDecodeURL(this._inheritsFrom.id) :
|
||||
null;
|
||||
this.singleDecodeURL(this._inheritsFrom.id) :
|
||||
null;
|
||||
|
||||
const inheritFromChanged =
|
||||
// Inherit from changed
|
||||
|
||||
@@ -674,7 +674,7 @@ limitations under the License.
|
||||
Polymer.dom(element.$$('gr-access-section').root).querySelectorAll(
|
||||
'gr-permission')[2];
|
||||
newPermission._handleAddRuleItem(
|
||||
{detail: {value: {id: 'Maintainers'}}});
|
||||
{detail: {value: {id: 'Maintainers'}}});
|
||||
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
|
||||
|
||||
// Modify a section reference.
|
||||
@@ -907,7 +907,7 @@ limitations under the License.
|
||||
Polymer.dom(element.$$('gr-access-section').root).querySelectorAll(
|
||||
'gr-permission')[1];
|
||||
readPermission._handleAddRuleItem(
|
||||
{detail: {value: {id: 'Maintainers'}}});
|
||||
{detail: {value: {id: 'Maintainers'}}});
|
||||
|
||||
expectedInput = {
|
||||
add: {
|
||||
|
||||
@@ -96,16 +96,16 @@
|
||||
_handleEditRepoConfig() {
|
||||
return this.$.restAPI.createChange(this.repo, CONFIG_BRANCH,
|
||||
EDIT_CONFIG_SUBJECT, undefined, false, true).then(change => {
|
||||
const message = change ?
|
||||
CREATE_CHANGE_SUCCEEDED_MESSAGE :
|
||||
CREATE_CHANGE_FAILED_MESSAGE;
|
||||
this.dispatchEvent(new CustomEvent('show-alert',
|
||||
{detail: {message}, bubbles: true}));
|
||||
if (!change) { return; }
|
||||
const message = change ?
|
||||
CREATE_CHANGE_SUCCEEDED_MESSAGE :
|
||||
CREATE_CHANGE_FAILED_MESSAGE;
|
||||
this.dispatchEvent(new CustomEvent('show-alert',
|
||||
{detail: {message}, bubbles: true}));
|
||||
if (!change) { return; }
|
||||
|
||||
Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff(
|
||||
change, CONFIG_PATH, INITIAL_PATCHSET));
|
||||
});
|
||||
Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff(
|
||||
change, CONFIG_PATH, INITIAL_PATCHSET));
|
||||
});
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
// Group by ref and sort by id.
|
||||
const dashboards = res.concat.apply([], res).sort((a, b) =>
|
||||
a.id < b.id ? -1 : 1);
|
||||
a.id < b.id ? -1 : 1);
|
||||
const dashboardsByRef = {};
|
||||
dashboards.forEach(d => {
|
||||
if (!dashboardsByRef[d.ref]) {
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
_determineIfOwner(repo) {
|
||||
return this.$.restAPI.getRepoAccess(repo)
|
||||
.then(access =>
|
||||
this._isOwner = access && !!access[repo].is_owner);
|
||||
this._isOwner = access && !!access[repo].is_owner);
|
||||
},
|
||||
|
||||
_paramsChanged(params) {
|
||||
@@ -124,17 +124,17 @@
|
||||
if (detailType === DETAIL_TYPES.BRANCHES) {
|
||||
return this.$.restAPI.getRepoBranches(
|
||||
filter, repo, itemsPerPage, offset, errFn).then(items => {
|
||||
if (!items) { return; }
|
||||
this._items = items;
|
||||
this._loading = false;
|
||||
});
|
||||
if (!items) { return; }
|
||||
this._items = items;
|
||||
this._loading = false;
|
||||
});
|
||||
} else if (detailType === DETAIL_TYPES.TAGS) {
|
||||
return this.$.restAPI.getRepoTags(
|
||||
filter, repo, itemsPerPage, offset, errFn).then(items => {
|
||||
if (!items) { return; }
|
||||
this._items = items;
|
||||
this._loading = false;
|
||||
});
|
||||
if (!items) { return; }
|
||||
this._items = items;
|
||||
this._loading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
_computeCanEditClass(ref, detailType, isOwner) {
|
||||
return isOwner && this._stripRefs(ref, detailType) === 'HEAD' ?
|
||||
'canEdit' : '';
|
||||
'canEdit' : '';
|
||||
},
|
||||
|
||||
_handleEditRevision(e) {
|
||||
|
||||
@@ -153,9 +153,9 @@ limitations under the License.
|
||||
const cancelBtn = Polymer.dom(element.root).querySelector('.cancelBtn');
|
||||
const editBtn = Polymer.dom(element.root).querySelector('.editBtn');
|
||||
const revisionNoEditing = Polymer.dom(element.root)
|
||||
.querySelector('.revisionNoEditing');
|
||||
.querySelector('.revisionNoEditing');
|
||||
const revisionWithEditing = Polymer.dom(element.root)
|
||||
.querySelector('.revisionWithEditing');
|
||||
.querySelector('.revisionWithEditing');
|
||||
|
||||
sandbox.stub(element, '_getLoggedIn').returns(Promise.resolve(true));
|
||||
sandbox.stub(element.$.restAPI, 'getRepoAccess').returns(
|
||||
|
||||
@@ -268,8 +268,8 @@
|
||||
_handleSaveRepoConfig() {
|
||||
return this.$.restAPI.saveRepoConfig(this.repo,
|
||||
this._formatRepoConfigForSave(this._repoConfig)).then(() => {
|
||||
this._configChanged = false;
|
||||
});
|
||||
this._configChanged = false;
|
||||
});
|
||||
},
|
||||
|
||||
_handleConfigChanged() {
|
||||
@@ -309,7 +309,7 @@
|
||||
command: commandObj[title]
|
||||
.replace(/\$\{project\}/gi, encodeURI(repo))
|
||||
.replace(/\$\{project-base-name\}/gi,
|
||||
encodeURI(repo.substring(repo.lastIndexOf('/') + 1))),
|
||||
encodeURI(repo.substring(repo.lastIndexOf('/') + 1))),
|
||||
});
|
||||
}
|
||||
return commands;
|
||||
|
||||
@@ -123,7 +123,7 @@ limitations under the License.
|
||||
let permission = 'priority';
|
||||
let label;
|
||||
assert.deepEqual(element._getDefaultRuleValues(permission, label),
|
||||
{action: 'BATCH'});
|
||||
{action: 'BATCH'});
|
||||
permission = 'label-Code-Review';
|
||||
label = {values: [
|
||||
{value: -2, text: 'This shall not be merged'},
|
||||
@@ -137,7 +137,7 @@ limitations under the License.
|
||||
permission = 'push';
|
||||
label = undefined;
|
||||
assert.deepEqual(element._getDefaultRuleValues(permission, label),
|
||||
{action: 'ALLOW', force: false});
|
||||
{action: 'ALLOW', force: false});
|
||||
permission = 'submit';
|
||||
assert.deepEqual(element._getDefaultRuleValues(permission, label),
|
||||
{action: 'ALLOW'});
|
||||
|
||||
@@ -57,31 +57,31 @@ limitations under the License.
|
||||
{labels: {}}, 'Verified'), 'cell label u-gray-background');
|
||||
assert.equal(element._computeLabelClass(
|
||||
{labels: {Verified: {approved: true, value: 1}}}, 'Verified'),
|
||||
'cell label u-green u-monospace');
|
||||
'cell label u-green u-monospace');
|
||||
assert.equal(element._computeLabelClass(
|
||||
{labels: {Verified: {rejected: true, value: -1}}}, 'Verified'),
|
||||
'cell label u-monospace u-red');
|
||||
'cell label u-monospace u-red');
|
||||
assert.equal(element._computeLabelClass(
|
||||
{labels: {'Code-Review': {value: 1}}}, 'Code-Review'),
|
||||
'cell label u-green u-monospace');
|
||||
'cell label u-green u-monospace');
|
||||
assert.equal(element._computeLabelClass(
|
||||
{labels: {'Code-Review': {value: -1}}}, 'Code-Review'),
|
||||
'cell label u-monospace u-red');
|
||||
'cell label u-monospace u-red');
|
||||
assert.equal(element._computeLabelClass(
|
||||
{labels: {'Code-Review': {value: -1}}}, 'Verified'),
|
||||
'cell label u-gray-background');
|
||||
'cell label u-gray-background');
|
||||
|
||||
assert.equal(element._computeLabelTitle({labels: {}}, 'Verified'),
|
||||
'Label not applicable');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Verified'),
|
||||
'Verified\nby Diffy');
|
||||
'Verified\nby Diffy');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Code-Review'),
|
||||
'Label not applicable');
|
||||
'Label not applicable');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {Verified: {rejected: {name: 'Diffy'}}}}, 'Verified'),
|
||||
'Verified\nby Diffy');
|
||||
'Verified\nby Diffy');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {'Code-Review': {disliked: {name: 'Diffy'}, value: -1}}},
|
||||
'Code-Review'), 'Code-Review\nby Diffy');
|
||||
@@ -91,19 +91,19 @@ limitations under the License.
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {'Code-Review': {recommended: {name: 'Diffy'},
|
||||
rejected: {name: 'Admin'}}}}, 'Code-Review'),
|
||||
'Code-Review\nby Admin');
|
||||
'Code-Review\nby Admin');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {'Code-Review': {approved: {name: 'Diffy'},
|
||||
rejected: {name: 'Admin'}}}}, 'Code-Review'),
|
||||
'Code-Review\nby Admin');
|
||||
'Code-Review\nby Admin');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {'Code-Review': {recommended: {name: 'Diffy'},
|
||||
disliked: {name: 'Admin'}, value: -1}}}, 'Code-Review'),
|
||||
'Code-Review\nby Admin');
|
||||
'Code-Review\nby Admin');
|
||||
assert.equal(element._computeLabelTitle(
|
||||
{labels: {'Code-Review': {approved: {name: 'Diffy'},
|
||||
disliked: {name: 'Admin'}, value: -1}}}, 'Code-Review'),
|
||||
'Code-Review\nby Diffy');
|
||||
'Code-Review\nby Diffy');
|
||||
|
||||
assert.equal(element._computeLabelValue({labels: {}}), '');
|
||||
assert.equal(element._computeLabelValue({labels: {}}, 'Verified'), '');
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
this.showNumber = !!(preferences &&
|
||||
preferences.legacycid_in_change_table);
|
||||
this.visibleChangeTableColumns = preferences.change_table.length > 0 ?
|
||||
this.getVisibleColumns(preferences.change_table) : this.columnNames;
|
||||
this.getVisibleColumns(preferences.change_table) : this.columnNames;
|
||||
} else {
|
||||
// Not logged in.
|
||||
this.showNumber = false;
|
||||
|
||||
@@ -111,7 +111,7 @@ limitations under the License.
|
||||
|
||||
test('computed fields', () => {
|
||||
assert.equal(element._computeLabelNames(
|
||||
[{results: [{_number: 0, labels: {}}]}]).length, 0);
|
||||
[{results: [{_number: 0, labels: {}}]}]).length, 0);
|
||||
assert.equal(element._computeLabelNames([
|
||||
{results: [
|
||||
{_number: 0, labels: {Verified: {approved: {}}}},
|
||||
|
||||
@@ -108,21 +108,21 @@
|
||||
};
|
||||
return this.$.restAPI.getDashboard(
|
||||
project, dashboard, errFn).then(response => {
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
title: response.title,
|
||||
sections: response.sections.map(section => {
|
||||
const suffix = response.foreach ? ' ' + response.foreach : '';
|
||||
return {
|
||||
title: response.title,
|
||||
sections: response.sections.map(section => {
|
||||
const suffix = response.foreach ? ' ' + response.foreach : '';
|
||||
return {
|
||||
name: section.name,
|
||||
query: (section.query + suffix).replace(
|
||||
PROJECT_PLACEHOLDER_PATTERN, project),
|
||||
};
|
||||
}),
|
||||
name: section.name,
|
||||
query: (section.query + suffix).replace(
|
||||
PROJECT_PLACEHOLDER_PATTERN, project),
|
||||
};
|
||||
});
|
||||
}),
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
_computeTitle(user) {
|
||||
@@ -161,11 +161,11 @@
|
||||
this._loading = true;
|
||||
const {project, dashboard, title, user, sections} = this.params;
|
||||
const dashboardPromise = project ?
|
||||
this._getProjectDashboard(project, dashboard) :
|
||||
Promise.resolve(Gerrit.Nav.getUserDashboard(
|
||||
user,
|
||||
sections,
|
||||
title || this._computeTitle(user)));
|
||||
this._getProjectDashboard(project, dashboard) :
|
||||
Promise.resolve(Gerrit.Nav.getUserDashboard(
|
||||
user,
|
||||
sections,
|
||||
title || this._computeTitle(user)));
|
||||
|
||||
const checkForNewUser = !project && user === 'self';
|
||||
return dashboardPromise
|
||||
@@ -191,8 +191,8 @@
|
||||
|
||||
const queries = res.sections
|
||||
.map(section => section.suffixForDashboard ?
|
||||
section.query + ' ' + section.suffixForDashboard :
|
||||
section.query);
|
||||
section.query + ' ' + section.suffixForDashboard :
|
||||
section.query);
|
||||
|
||||
if (checkForNewUser) {
|
||||
queries.push('owner:self');
|
||||
@@ -211,7 +211,7 @@
|
||||
results,
|
||||
isOutgoing: res.sections[i].isOutgoing,
|
||||
})).filter((section, i) => i < res.sections.length && (
|
||||
!res.sections[i].hideIfEmpty ||
|
||||
!res.sections[i].hideIfEmpty ||
|
||||
section.results.length));
|
||||
});
|
||||
},
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
_computeDashboardLinkClass(showDashboardLink, loggedIn) {
|
||||
return showDashboardLink && loggedIn ?
|
||||
'dashboardLink' : 'dashboardLink hide';
|
||||
'dashboardLink' : 'dashboardLink hide';
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -159,8 +159,8 @@
|
||||
|
||||
const api = this.$.restAPI;
|
||||
const xhr = this.allowAnyUser ?
|
||||
api.getSuggestedAccounts(`cansee:${this.change._number} ${input}`) :
|
||||
api.getChangeSuggestedReviewers(this.change._number, input);
|
||||
api.getSuggestedAccounts(`cansee:${this.change._number} ${input}`) :
|
||||
api.getChangeSuggestedReviewers(this.change._number, input);
|
||||
|
||||
return xhr.then(reviewers => {
|
||||
if (!reviewers) { return []; }
|
||||
|
||||
@@ -217,10 +217,10 @@ limitations under the License.
|
||||
test('allowAnyUser', done => {
|
||||
const suggestReviewerStub =
|
||||
sandbox.stub(element.$.restAPI, 'getChangeSuggestedReviewers')
|
||||
.returns(Promise.resolve([]));
|
||||
.returns(Promise.resolve([]));
|
||||
const suggestAccountStub =
|
||||
sandbox.stub(element.$.restAPI, 'getSuggestedAccounts')
|
||||
.returns(Promise.resolve([]));
|
||||
.returns(Promise.resolve([]));
|
||||
|
||||
element._getReviewerSuggestions('').then(() => {
|
||||
assert.isTrue(suggestReviewerStub.calledOnce);
|
||||
@@ -252,7 +252,7 @@ limitations under the License.
|
||||
|
||||
test('account-text-changed not fired when input text changed without ' +
|
||||
'allowAnyUser', () => {
|
||||
// Spy on query, as that is called when _updateSuggestions proceeds.
|
||||
// Spy on query, as that is called when _updateSuggestions proceeds.
|
||||
const changeStub = sandbox.stub();
|
||||
sandbox.stub(element.$.restAPI, 'getChangeSuggestedReviewers')
|
||||
.returns(Promise.resolve([]));
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
// a toast tell them why they can't enter it.
|
||||
this.$.entry.setText(reviewer);
|
||||
this.dispatchEvent(new CustomEvent('show-alert',
|
||||
{detail: {message: VALID_EMAIL_ALERT}, bubbles: true}));
|
||||
{detail: {message: VALID_EMAIL_ALERT}, bubbles: true}));
|
||||
return false;
|
||||
} else {
|
||||
const account = {email: reviewer, _pendingAdd: true};
|
||||
|
||||
@@ -568,7 +568,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {string=} actionName
|
||||
*/
|
||||
_deleteAndNotify(actionName) {
|
||||
@@ -1370,9 +1370,9 @@
|
||||
|
||||
_filterPrimaryActions(_topLevelActions) {
|
||||
this._topLevelPrimaryActions = _topLevelActions.filter(action =>
|
||||
action.__primary);
|
||||
action.__primary);
|
||||
this._topLevelSecondaryActions = _topLevelActions.filter(action =>
|
||||
!action.__primary);
|
||||
!action.__primary);
|
||||
},
|
||||
|
||||
_computeMenuActions(actionRecord, hiddenActionsRecord) {
|
||||
|
||||
@@ -373,7 +373,7 @@ limitations under the License.
|
||||
assert.isTrue(fetchChangesStub.called);
|
||||
element._handleRebaseConfirm({detail: {base: '1234'}});
|
||||
assert.deepEqual(fireActionStub.lastCall.args,
|
||||
['/rebase', rebaseAction, true, {base: '1234'}]);
|
||||
['/rebase', rebaseAction, true, {base: '1234'}]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@ limitations under the License.
|
||||
js_resource_paths: [],
|
||||
html_resource_paths: [
|
||||
new URL('test/plugin.html?' + Math.random(),
|
||||
window.location.href).toString(),
|
||||
window.location.href).toString(),
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -140,7 +140,7 @@ limitations under the License.
|
||||
setup(() => {
|
||||
Gerrit.install(p => plugin = p, '0.1',
|
||||
new URL('test/plugin.html?' + Math.random(),
|
||||
window.location.href).toString());
|
||||
window.location.href).toString());
|
||||
sandbox.stub(Gerrit, '_arePluginsLoaded').returns(true);
|
||||
Gerrit._setPluginsPending([]);
|
||||
element = createElement();
|
||||
|
||||
@@ -243,12 +243,12 @@
|
||||
this._newHashtag = '';
|
||||
this.$.restAPI.setChangeHashtag(
|
||||
this.change._number, {add: [newHashtag]}).then(newHashtag => {
|
||||
this.set(['change', 'hashtags'], newHashtag);
|
||||
if (newHashtag !== lastHashtag) {
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('hashtag-changed', {bubbles: true}));
|
||||
}
|
||||
});
|
||||
this.set(['change', 'hashtags'], newHashtag);
|
||||
if (newHashtag !== lastHashtag) {
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('hashtag-changed', {bubbles: true}));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_computeTopicReadOnly(mutable, change) {
|
||||
@@ -359,7 +359,7 @@
|
||||
_computeBranchURL(project, branch) {
|
||||
return Gerrit.Nav.getUrlForBranch(branch, project,
|
||||
this.change.status == this.ChangeStatus.NEW ? 'open' :
|
||||
this.change.status.toLowerCase());
|
||||
this.change.status.toLowerCase());
|
||||
},
|
||||
|
||||
_computeTopicURL(topic) {
|
||||
|
||||
@@ -436,7 +436,7 @@ limitations under the License.
|
||||
{current_revision: '789', revisions: {456: {commit: {parents}}}}));
|
||||
assert.equal(element._computeParents(
|
||||
{current_revision: '456', revisions: {456: {commit: {parents}}}}),
|
||||
parents);
|
||||
parents);
|
||||
});
|
||||
|
||||
test('_computeParentsLabel', () => {
|
||||
|
||||
@@ -135,8 +135,8 @@
|
||||
|
||||
_computeShowHideIcon(showOptionalLabels) {
|
||||
return showOptionalLabels ?
|
||||
'gr-icons:expand-less' :
|
||||
'gr-icons:expand-more';
|
||||
'gr-icons:expand-less' :
|
||||
'gr-icons:expand-more';
|
||||
},
|
||||
|
||||
_computeSectionClass(show) {
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
computed:
|
||||
'_computeChangeIdCommitMessageError(_latestCommitMessage, _change)',
|
||||
},
|
||||
/** @type {?} */
|
||||
/** @type {?} */
|
||||
_patchRange: {
|
||||
type: Object,
|
||||
},
|
||||
@@ -382,16 +382,16 @@
|
||||
this.$.commitMessageEditor.disabled = true;
|
||||
this.$.restAPI.putChangeCommitMessage(
|
||||
this._changeNum, message).then(resp => {
|
||||
this.$.commitMessageEditor.disabled = false;
|
||||
if (!resp.ok) { return; }
|
||||
this.$.commitMessageEditor.disabled = false;
|
||||
if (!resp.ok) { return; }
|
||||
|
||||
this._latestCommitMessage = this._prepareCommitMsgForLinkify(
|
||||
message);
|
||||
this._editingCommitMessage = false;
|
||||
this._reloadWindow();
|
||||
}).catch(err => {
|
||||
this.$.commitMessageEditor.disabled = false;
|
||||
});
|
||||
this._latestCommitMessage = this._prepareCommitMsgForLinkify(
|
||||
message);
|
||||
this._editingCommitMessage = false;
|
||||
this._reloadWindow();
|
||||
}).catch(err => {
|
||||
this.$.commitMessageEditor.disabled = false;
|
||||
});
|
||||
},
|
||||
|
||||
_reloadWindow() {
|
||||
@@ -720,7 +720,7 @@
|
||||
|
||||
_viewStateChanged(viewState) {
|
||||
this._numFilesShown = viewState.numFilesShown ?
|
||||
viewState.numFilesShown : DEFAULT_NUM_FILES_SHOWN;
|
||||
viewState.numFilesShown : DEFAULT_NUM_FILES_SHOWN;
|
||||
},
|
||||
|
||||
_numFilesShownChanged(numFilesShown) {
|
||||
@@ -827,7 +827,7 @@
|
||||
// check that there is at least 2 parents otherwise fall back to 1,
|
||||
// which means there is only one parent.
|
||||
const parentCount = parentCounts.hasOwnProperty(1) ?
|
||||
parentCounts[1] : 1;
|
||||
parentCounts[1] : 1;
|
||||
|
||||
const preferFirst = this._prefs &&
|
||||
this._prefs.default_base_for_merges === 'FIRST_PARENT';
|
||||
@@ -1216,9 +1216,9 @@
|
||||
_getLatestCommitMessage() {
|
||||
return this.$.restAPI.getChangeCommitInfo(this._changeNum,
|
||||
this.computeLatestPatchNum(this._allPatchSets)).then(commitInfo => {
|
||||
this._latestCommitMessage =
|
||||
this._latestCommitMessage =
|
||||
this._prepareCommitMsgForLinkify(commitInfo.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_getLatestRevisionSHA(change) {
|
||||
@@ -1264,7 +1264,7 @@
|
||||
this._changeComments = comments;
|
||||
this._diffDrafts = Object.assign({}, this._changeComments.drafts);
|
||||
this._commentThreads = this._changeComments.getAllThreadsForChange()
|
||||
.map(c => Object.assign({}, c));
|
||||
.map(c => Object.assign({}, c));
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1673,7 +1673,7 @@
|
||||
*/
|
||||
_handleEditTap() {
|
||||
const editInfo = Object.values(this._change.revisions).find(info =>
|
||||
info._number === this.EDIT_NAME);
|
||||
info._number === this.EDIT_NAME);
|
||||
|
||||
if (editInfo) {
|
||||
Gerrit.Nav.navigateToChange(this._change, this.EDIT_NAME);
|
||||
|
||||
@@ -162,7 +162,7 @@ limitations under the License.
|
||||
assert.isFalse(element.$.replyOverlay.opened);
|
||||
assert(openSpy.lastCall.calledWithExactly(
|
||||
element.$.replyDialog.FocusTarget.ANY),
|
||||
'_openReplyDialog should have been passed ANY');
|
||||
'_openReplyDialog should have been passed ANY');
|
||||
assert.equal(openSpy.callCount, 1);
|
||||
done();
|
||||
});
|
||||
@@ -1074,7 +1074,7 @@ limitations under the License.
|
||||
MockInteractions.tap(element.$.replyBtn);
|
||||
assert(openStub.lastCall.calledWithExactly(
|
||||
element.$.replyDialog.FocusTarget.ANY),
|
||||
'_openReplyDialog should have been passed ANY');
|
||||
'_openReplyDialog should have been passed ANY');
|
||||
assert.equal(openStub.callCount, 1);
|
||||
});
|
||||
|
||||
@@ -1086,7 +1086,7 @@ limitations under the License.
|
||||
{message: {message: 'text'}});
|
||||
assert(openStub.lastCall.calledWithExactly(
|
||||
element.$.replyDialog.FocusTarget.BODY),
|
||||
'_openReplyDialog should have been passed BODY');
|
||||
'_openReplyDialog should have been passed BODY');
|
||||
assert.equal(openStub.callCount, 1);
|
||||
done();
|
||||
});
|
||||
@@ -1511,7 +1511,7 @@ limitations under the License.
|
||||
|
||||
test('_computeEditMode', () => {
|
||||
const callCompute = (range, params) =>
|
||||
element._computeEditMode({base: range}, {base: params});
|
||||
element._computeEditMode({base: range}, {base: params});
|
||||
assert.isFalse(callCompute({}, {}));
|
||||
assert.isTrue(callCompute({}, {edit: true}));
|
||||
assert.isFalse(callCompute({basePatchNum: 'PARENT', patchNum: 1}, {}));
|
||||
@@ -1719,7 +1719,7 @@ limitations under the License.
|
||||
|
||||
element._patchRange = {patchNum: 1};
|
||||
element.$.actions.dispatchEvent(new CustomEvent('stop-edit-tap',
|
||||
{bubbles: false}));
|
||||
{bubbles: false}));
|
||||
});
|
||||
|
||||
suite('plugin endpoints', () => {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
_computeDiffLineURL(file, changeNum, patchNum, comment) {
|
||||
const basePatchNum = comment.hasOwnProperty('parent') ?
|
||||
-comment.parent : null;
|
||||
-comment.parent : null;
|
||||
return Gerrit.Nav.getUrlForDiffById(this.changeNum, this.projectName,
|
||||
file, patchNum, basePatchNum, comment.line,
|
||||
this._isOnParent(comment));
|
||||
|
||||
@@ -83,21 +83,21 @@
|
||||
}
|
||||
return this.$.restAPI.getRepoBranches(
|
||||
input, this.project, SUGGESTIONS_LIMIT).then(response => {
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
});
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -62,21 +62,21 @@
|
||||
}
|
||||
return this.$.restAPI.getRepoBranches(
|
||||
input, this.project, SUGGESTIONS_LIMIT).then(response => {
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
const branches = [];
|
||||
let branch;
|
||||
for (const key in response) {
|
||||
if (!response.hasOwnProperty(key)) { continue; }
|
||||
if (response[key].ref.startsWith('refs/heads/')) {
|
||||
branch = response[key].ref.substring('refs/heads/'.length);
|
||||
} else {
|
||||
branch = response[key].ref;
|
||||
}
|
||||
branches.push({
|
||||
name: branch,
|
||||
});
|
||||
}
|
||||
return branches;
|
||||
});
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
_getChangeSuggestions(input) {
|
||||
return this._getRecentChanges().then(changes =>
|
||||
this._filterChanges(input, changes));
|
||||
this._filterChanges(input, changes));
|
||||
},
|
||||
|
||||
_filterChanges(input, changes) {
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
for (const rev of Object.values(change.revisions || {})) {
|
||||
if (this.patchNumEquals(rev._number, patchNum)) {
|
||||
const parentLength = rev.commit && rev.commit.parents ?
|
||||
rev.commit.parents.length : 0;
|
||||
rev.commit.parents.length : 0;
|
||||
return parentLength == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ limitations under the License.
|
||||
test('computed fields', () => {
|
||||
assert.equal(element._computeArchiveDownloadLink(
|
||||
{project: 'test/project', _number: 123}, 2, 'tgz'),
|
||||
'/changes/test%2Fproject~123/revisions/2/archive?format=tgz');
|
||||
'/changes/test%2Fproject~123/revisions/2/archive?format=tgz');
|
||||
});
|
||||
|
||||
test('close event', done => {
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
_computePatchSetDescription(change, patchNum) {
|
||||
const rev = this.getRevisionByPatchNum(change.revisions, patchNum);
|
||||
this._patchsetDescription = (rev && rev.description) ?
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
},
|
||||
|
||||
_handleDescriptionRemoved(e) {
|
||||
@@ -240,7 +240,7 @@
|
||||
_computeUploadHelpContainerClass(change, account) {
|
||||
const changeIsMerged = change && change.status === MERGED_STATUS;
|
||||
const ownerId = change && change.owner && change.owner._account_id ?
|
||||
change.owner._account_id : null;
|
||||
change.owner._account_id : null;
|
||||
const userId = account && account._account_id;
|
||||
const userIsOwner = ownerId && userId && ownerId === userId;
|
||||
const hideContainer = !userIsOwner || changeIsMerged;
|
||||
|
||||
@@ -809,7 +809,7 @@
|
||||
|
||||
_computeShowHideIcon(path, expandedFilesRecord) {
|
||||
return this._isFileExpanded(path, expandedFilesRecord) ?
|
||||
'gr-icons:expand-less' : 'gr-icons:expand-more';
|
||||
'gr-icons:expand-less' : 'gr-icons:expand-more';
|
||||
},
|
||||
|
||||
_computeFiles(filesByPath, changeComments, patchRange, reviewed, loading) {
|
||||
@@ -833,7 +833,7 @@
|
||||
|
||||
_computeFilesShown(numFilesShown, files) {
|
||||
const previousNumFilesShown = this._shownFiles ?
|
||||
this._shownFiles.length : 0;
|
||||
this._shownFiles.length : 0;
|
||||
|
||||
const filesShown = files.base.slice(0, numFilesShown);
|
||||
this.fire('files-shown-changed', {length: filesShown.length});
|
||||
@@ -900,7 +900,7 @@
|
||||
_computePatchSetDescription(revisions, patchNum) {
|
||||
const rev = this.getRevisionByPatchNum(revisions, patchNum);
|
||||
return (rev && rev.description) ?
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -912,7 +912,7 @@
|
||||
_computeFileStatusLabel(status) {
|
||||
const statusCode = this._computeFileStatus(status);
|
||||
return FileStatus.hasOwnProperty(statusCode) ?
|
||||
FileStatus[statusCode] : 'Status Unknown';
|
||||
FileStatus[statusCode] : 'Status Unknown';
|
||||
},
|
||||
|
||||
_isFileExpanded(path, expandedFilesRecord) {
|
||||
@@ -944,7 +944,7 @@
|
||||
// Clear content for any diffs that are not open so if they get re-opened
|
||||
// the stale content does not flash before it is cleared and reloaded.
|
||||
const collapsedDiffs = this.diffs.filter(diff =>
|
||||
this._expandedFilePaths.indexOf(diff.path) === -1);
|
||||
this._expandedFilePaths.indexOf(diff.path) === -1);
|
||||
this._clearCollapsedDiffs(collapsedDiffs);
|
||||
|
||||
if (!record) { return; } // Happens after "Collapse all" clicked.
|
||||
@@ -954,9 +954,9 @@
|
||||
|
||||
// Find the paths introduced by the new index splices:
|
||||
const newPaths = record.indexSplices
|
||||
.map(splice => splice.object.slice(
|
||||
splice.index, splice.index + splice.addedCount))
|
||||
.reduce((acc, paths) => acc.concat(paths), []);
|
||||
.map(splice => splice.object.slice(
|
||||
splice.index, splice.index + splice.addedCount))
|
||||
.reduce((acc, paths) => acc.concat(paths), []);
|
||||
|
||||
// Required so that the newly created diff view is included in this.diffs.
|
||||
Polymer.dom.flush();
|
||||
|
||||
@@ -438,10 +438,10 @@ limitations under the License.
|
||||
'/COMMIT_MSG', 'comment'), '3 comments (1 unresolved)');
|
||||
assert.equal(
|
||||
element._computeCommentsStringMobile(element.changeComments, parentTo1
|
||||
, '/COMMIT_MSG'), '2c');
|
||||
, '/COMMIT_MSG'), '2c');
|
||||
assert.equal(
|
||||
element._computeCommentsStringMobile(element.changeComments, _1To2
|
||||
, '/COMMIT_MSG'), '3c');
|
||||
, '/COMMIT_MSG'), '3c');
|
||||
assert.equal(
|
||||
element._computeDraftsString(element.changeComments, parentTo1,
|
||||
'unresolved.file'), '1 draft');
|
||||
@@ -637,7 +637,7 @@ limitations under the License.
|
||||
|
||||
assert(navStub.lastCall.calledWith(element.change,
|
||||
'file_added_in_rev2.txt', '2'),
|
||||
'Should navigate to /c/42/2/file_added_in_rev2.txt');
|
||||
'Should navigate to /c/42/2/file_added_in_rev2.txt');
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k');
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k');
|
||||
@@ -1652,7 +1652,7 @@ limitations under the License.
|
||||
|
||||
element.set('_filesByPath', _filesByPath);
|
||||
flushAsynchronousOperations();
|
||||
// Navigates when a file is selected.
|
||||
// Navigates when a file is selected.
|
||||
element._openSelectedFile();
|
||||
assert.isTrue(navStub.called);
|
||||
});
|
||||
@@ -1713,7 +1713,7 @@ limitations under the License.
|
||||
// Commit message should not have edit controls.
|
||||
const editControls =
|
||||
Polymer.dom(element.root).querySelectorAll('.row:not(.header)')
|
||||
.map(row => row.querySelector('gr-edit-file-controls'));
|
||||
.map(row => row.querySelector('gr-edit-file-controls'));
|
||||
assert.isTrue(editControls[0].classList.contains('invisible'));
|
||||
});
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
if (!labels[label.name]) { return null; }
|
||||
const labelValue = this._getLabelValue(labels, permittedLabels, label);
|
||||
const len = permittedLabels[label.name] != null ?
|
||||
permittedLabels[label.name].length : 0;
|
||||
permittedLabels[label.name].length : 0;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const val = permittedLabels[label.name][i];
|
||||
if (val === labelValue) {
|
||||
@@ -132,7 +132,7 @@
|
||||
const name = e.target.selectedItem.name;
|
||||
const value = e.target.selectedItem.getAttribute('value');
|
||||
this.dispatchEvent(new CustomEvent(
|
||||
'labels-changed', {detail: {name, value}, bubbles: true}));
|
||||
'labels-changed', {detail: {name, value}, bubbles: true}));
|
||||
},
|
||||
|
||||
_computeAnyPermittedLabelValues(permittedLabels, label) {
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
_computeHiddenClass(permittedLabels, label) {
|
||||
return !this._computeAnyPermittedLabelValues(permittedLabels, label) ?
|
||||
'hidden' : '';
|
||||
'hidden' : '';
|
||||
},
|
||||
|
||||
_computePermittedLabelValues(permittedLabels, label) {
|
||||
|
||||
@@ -121,7 +121,7 @@ limitations under the License.
|
||||
const labelName = 'Code-Review';
|
||||
assert.strictEqual(element._getVoteForAccount(
|
||||
element.change.labels, labelName, element.account),
|
||||
'+1');
|
||||
'+1');
|
||||
});
|
||||
|
||||
test('_computeColumns', () => {
|
||||
@@ -166,10 +166,10 @@ limitations under the License.
|
||||
{name: 'Verified', value: null}
|
||||
]);
|
||||
element.set(['change', 'labels', 'Verified', 'all'],
|
||||
[{_account_id: 123, value: 1}]);
|
||||
[{_account_id: 123, value: 1}]);
|
||||
assert.deepEqual(element._labels, [
|
||||
{name: 'Code-Review', value: null},
|
||||
{name: 'Verified', value: '+1'},
|
||||
{name: 'Code-Review', value: null},
|
||||
{name: 'Verified', value: '+1'},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
el.set('message.expanded', true);
|
||||
let top = el.offsetTop;
|
||||
for (let offsetParent = el.offsetParent;
|
||||
offsetParent;
|
||||
offsetParent = offsetParent.offsetParent) {
|
||||
offsetParent;
|
||||
offsetParent = offsetParent.offsetParent) {
|
||||
top += offsetParent.offsetTop;
|
||||
}
|
||||
window.scrollTo(0, top);
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
|
||||
_computeSubmittedTogetherClass(submittedTogether) {
|
||||
if (!submittedTogether || (
|
||||
submittedTogether.changes.length === 0 &&
|
||||
submittedTogether.changes.length === 0 &&
|
||||
!submittedTogether.non_visible_changes)) {
|
||||
return 'hidden';
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ limitations under the License.
|
||||
sandbox.stub(element, '_getCherryPicks')
|
||||
.returns(Promise.resolve());
|
||||
conflictsStub = sandbox.stub(element, '_getConflicts')
|
||||
.returns(Promise.resolve());
|
||||
.returns(Promise.resolve());
|
||||
});
|
||||
|
||||
test('request conflicts if open and mergeable', () => {
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
* @event comment-refresh
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fires when the state of the send button (enabled/disabled) changes.
|
||||
*
|
||||
* @event send-disabled-changed
|
||||
@@ -264,7 +264,7 @@
|
||||
this.fetchChangeUpdates(this.change, this.$.restAPI)
|
||||
.then(result => {
|
||||
this.knownLatestState = result.isLatest ?
|
||||
LatestPatchState.LATEST : LatestPatchState.NOT_LATEST;
|
||||
LatestPatchState.LATEST : LatestPatchState.NOT_LATEST;
|
||||
});
|
||||
|
||||
this._focusOn(opt_focusTarget);
|
||||
@@ -406,16 +406,16 @@
|
||||
|
||||
return this.$.restAPI.removeChangeReviewer(this.change._number,
|
||||
account._account_id).then(response => {
|
||||
if (!response.ok) { return response; }
|
||||
if (!response.ok) { return response; }
|
||||
|
||||
const reviewers = this.change.reviewers[type] || [];
|
||||
for (let i = 0; i < reviewers.length; i++) {
|
||||
if (reviewers[i]._account_id == account._account_id) {
|
||||
this.splice(['change', 'reviewers', type], i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
const reviewers = this.change.reviewers[type] || [];
|
||||
for (let i = 0; i < reviewers.length; i++) {
|
||||
if (reviewers[i]._account_id == account._account_id) {
|
||||
this.splice(['change', 'reviewers', type], i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_mapReviewer(reviewer) {
|
||||
|
||||
@@ -372,8 +372,8 @@ limitations under the License.
|
||||
}).then(() => {
|
||||
assert.isFalse(isVisible(element.$.reviewerConfirmationOverlay));
|
||||
const additions = cc ?
|
||||
element.$$('#ccs').additions() :
|
||||
element.$.reviewers.additions();
|
||||
element.$$('#ccs').additions() :
|
||||
element.$.reviewers.additions();
|
||||
assert.deepEqual(
|
||||
additions,
|
||||
[
|
||||
@@ -761,7 +761,7 @@ limitations under the License.
|
||||
// Send and purge and verify moves, delete cc3.
|
||||
element.send()
|
||||
.then(keepReviewers =>
|
||||
element._purgeReviewersPendingRemove(false, keepReviewers))
|
||||
element._purgeReviewersPendingRemove(false, keepReviewers))
|
||||
.then(() => {
|
||||
assert.deepEqual(
|
||||
mutations, [
|
||||
|
||||
@@ -194,7 +194,7 @@ limitations under the License.
|
||||
element.maxReviewersDisplayed = 5;
|
||||
for (let i = 0; i < 6; i++) {
|
||||
reviewers.push(
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
}
|
||||
element.ccsOnly = true;
|
||||
|
||||
@@ -217,7 +217,7 @@ limitations under the License.
|
||||
element.maxReviewersDisplayed = 5;
|
||||
for (let i = 0; i < 7; i++) {
|
||||
reviewers.push(
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
}
|
||||
element.ccsOnly = true;
|
||||
|
||||
@@ -240,7 +240,7 @@ limitations under the License.
|
||||
const reviewers = [];
|
||||
for (let i = 0; i < 7; i++) {
|
||||
reviewers.push(
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
}
|
||||
element.ccsOnly = true;
|
||||
|
||||
@@ -263,7 +263,7 @@ limitations under the License.
|
||||
element.maxReviewersDisplayed = 5;
|
||||
for (let i = 0; i < 100; i++) {
|
||||
reviewers.push(
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
|
||||
}
|
||||
element.ccsOnly = true;
|
||||
|
||||
@@ -296,7 +296,7 @@ limitations under the License.
|
||||
},
|
||||
Bar: {
|
||||
all: [{_account_id: 1, permitted_voting_range: {max: 1}},
|
||||
{_account_id: 7, permitted_voting_range: {max: 1}}],
|
||||
{_account_id: 7, permitted_voting_range: {max: 1}}],
|
||||
},
|
||||
FooBar: {
|
||||
all: [{_account_id: 7, value: 0}],
|
||||
|
||||
@@ -109,8 +109,8 @@
|
||||
|
||||
const lastNonDraftComment =
|
||||
(lastComment.__draft && thread.comments.length > 1) ?
|
||||
thread.comments[thread.comments.length - 2] :
|
||||
lastComment;
|
||||
thread.comments[thread.comments.length - 2] :
|
||||
lastComment;
|
||||
|
||||
return {
|
||||
thread,
|
||||
|
||||
@@ -76,7 +76,7 @@ limitations under the License.
|
||||
'none');
|
||||
assert.notEqual(getComputedStyle(element.$$('gr-account-dropdown'))
|
||||
.display,
|
||||
'none');
|
||||
'none');
|
||||
assert.notEqual(getComputedStyle(element.$$('.settingsButton')).display,
|
||||
'none');
|
||||
});
|
||||
|
||||
@@ -722,11 +722,11 @@ limitations under the License.
|
||||
getUserDashboard(user = 'self', sections = DEFAULT_SECTIONS,
|
||||
title = '') {
|
||||
sections = sections
|
||||
.filter(section => (user === 'self' || !section.selfOnly))
|
||||
.map(section => Object.assign({}, section, {
|
||||
name: section.name,
|
||||
query: section.query.replace(USER_PLACEHOLDER_PATTERN, user),
|
||||
}));
|
||||
.filter(section => (user === 'self' || !section.selfOnly))
|
||||
.map(section => Object.assign({}, section, {
|
||||
name: section.name,
|
||||
query: section.query.replace(USER_PLACEHOLDER_PATTERN, user),
|
||||
}));
|
||||
return {title, sections};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
console.error(eventValue.error || eventName);
|
||||
} else {
|
||||
console.log(eventName + (eventValue !== undefined ?
|
||||
(': ' + eventValue) : ''));
|
||||
(': ' + eventValue) : ''));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ limitations under the License.
|
||||
element.reporter.calledWithExactly(
|
||||
'timing-report', 'UI Latency', 'App Started',
|
||||
NOW_TIME - fakePerformance.navigationStart
|
||||
));
|
||||
));
|
||||
assert.isTrue(
|
||||
element.reporter.calledWithExactly(
|
||||
'lifecycle', 'Page Visibility', 'hidden'
|
||||
));
|
||||
));
|
||||
});
|
||||
|
||||
test('WebComponentsReady', () => {
|
||||
|
||||
@@ -442,8 +442,8 @@
|
||||
// If there is a repo name provided, make sure to substitute it into the
|
||||
// ${repo} (or legacy ${project}) query tokens.
|
||||
const query = opt_repoName ?
|
||||
section.query.replace(REPO_TOKEN_PATTERN, opt_repoName) :
|
||||
section.query;
|
||||
section.query.replace(REPO_TOKEN_PATTERN, opt_repoName) :
|
||||
section.query;
|
||||
return encodeURIComponent(section.name) + '=' +
|
||||
encodeURIComponent(query);
|
||||
});
|
||||
|
||||
@@ -59,8 +59,8 @@ limitations under the License.
|
||||
|
||||
getActiveElement = () => {
|
||||
return document.activeElement.shadowRoot ?
|
||||
document.activeElement.shadowRoot.activeElement :
|
||||
document.activeElement;
|
||||
document.activeElement.shadowRoot.activeElement :
|
||||
document.activeElement;
|
||||
};
|
||||
|
||||
test('enter in search input fires event', done => {
|
||||
|
||||
@@ -144,8 +144,8 @@
|
||||
return accounts.map(account => ({
|
||||
label: account.name || '',
|
||||
text: account.email ?
|
||||
`${predicate}:${account.email}` :
|
||||
`${predicate}:"${this._accountOrAnon(account)}"`,
|
||||
`${predicate}:${account.email}` :
|
||||
`${predicate}:"${this._accountOrAnon(account)}"`,
|
||||
}));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -268,9 +268,9 @@
|
||||
const all = comments.concat(drafts).concat(robotComments);
|
||||
|
||||
const baseComments = all.filter(c =>
|
||||
this._isInBaseOfPatchRange(c, patchRange));
|
||||
this._isInBaseOfPatchRange(c, patchRange));
|
||||
const revisionComments = all.filter(c =>
|
||||
this._isInRevisionOfPatchRange(c, patchRange));
|
||||
this._isInRevisionOfPatchRange(c, patchRange));
|
||||
|
||||
return {
|
||||
meta: {
|
||||
@@ -368,7 +368,7 @@
|
||||
const threads = this.getCommentThreads(this._sortComments(comments));
|
||||
|
||||
const unresolvedThreads = threads
|
||||
.filter(thread =>
|
||||
.filter(thread =>
|
||||
thread.comments.length &&
|
||||
thread.comments[thread.comments.length - 1].unresolved);
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
|
||||
return Promise.all(promises).then(([comments, robotComments, drafts]) => {
|
||||
this._changeComments = new ChangeComments(comments,
|
||||
robotComments, drafts, changeNum);
|
||||
robotComments, drafts, changeNum);
|
||||
return this._changeComments;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -107,7 +107,7 @@ limitations under the License.
|
||||
let draftStub;
|
||||
setup(() => {
|
||||
commentStub = sandbox.stub(element.$.restAPI, 'getDiffComments')
|
||||
.returns(Promise.resolve({}));
|
||||
.returns(Promise.resolve({}));
|
||||
robotCommentStub = sandbox.stub(element.$.restAPI,
|
||||
'getDiffRobotComments').returns(Promise.resolve({}));
|
||||
draftStub = sandbox.stub(element.$.restAPI, 'getDiffDrafts')
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
let tr = content.parentElement.parentElement;
|
||||
while (tr = tr.nextSibling) {
|
||||
if (tr.classList.contains('both') || (
|
||||
(side === 'left' && tr.classList.contains('remove')) ||
|
||||
(side === 'left' && tr.classList.contains('remove')) ||
|
||||
(side === 'right' && tr.classList.contains('add')))) {
|
||||
return tr.querySelector('.contentText');
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ limitations under the License.
|
||||
getLineNumberByChild(node) {
|
||||
const lineEl = this.getLineElByChild(node);
|
||||
return lineEl ?
|
||||
parseInt(lineEl.getAttribute('data-value'), 10) :
|
||||
null;
|
||||
parseInt(lineEl.getAttribute('data-value'), 10) :
|
||||
null;
|
||||
},
|
||||
|
||||
getContentByLine(lineNumber, opt_side, opt_root) {
|
||||
@@ -256,7 +256,7 @@ limitations under the License.
|
||||
|
||||
getSideByLineEl(lineEl) {
|
||||
return lineEl.classList.contains(GrDiffBuilder.Side.RIGHT) ?
|
||||
GrDiffBuilder.Side.RIGHT : GrDiffBuilder.Side.LEFT;
|
||||
GrDiffBuilder.Side.RIGHT : GrDiffBuilder.Side.LEFT;
|
||||
},
|
||||
|
||||
emitGroup(group, sectionEl) {
|
||||
@@ -309,7 +309,7 @@ limitations under the License.
|
||||
const createFn = this.createCommentFn;
|
||||
if (this.isImageDiff) {
|
||||
builder = new GrDiffBuilderImage(diff, comments, createFn, prefs,
|
||||
this.diffElement, this.baseImage, this.revisionImage);
|
||||
this.diffElement, this.baseImage, this.revisionImage);
|
||||
} else if (diff.binary) {
|
||||
// If the diff is binary, but not an image.
|
||||
return new GrDiffBuilderBinary(diff, comments, prefs,
|
||||
@@ -385,8 +385,8 @@ limitations under the License.
|
||||
|
||||
// If endIndex isn't present, continue to the end of the line.
|
||||
const endIndex = highlight.endIndex === undefined ?
|
||||
line.text.length :
|
||||
highlight.endIndex;
|
||||
line.text.length :
|
||||
highlight.endIndex;
|
||||
|
||||
GrAnnotation.annotateElement(
|
||||
el,
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
continue;
|
||||
}
|
||||
const lineNumber = opt_side === 'left' ?
|
||||
line.beforeNumber : line.afterNumber;
|
||||
line.beforeNumber : line.afterNumber;
|
||||
if (lineNumber < start || lineNumber > end) { continue; }
|
||||
|
||||
if (out_lines) { out_lines.push(line); }
|
||||
@@ -369,7 +369,7 @@
|
||||
// thread and append to it.
|
||||
if (comment.in_reply_to) {
|
||||
const thread = threads.find(thread =>
|
||||
thread.comments.some(c => c.id === comment.in_reply_to));
|
||||
thread.comments.some(c => c.id === comment.in_reply_to));
|
||||
if (thread) {
|
||||
thread.comments.push(comment);
|
||||
continue;
|
||||
|
||||
@@ -441,13 +441,13 @@ limitations under the License.
|
||||
};
|
||||
assert.deepEqual(builder._getCommentsForLine(comments, line),
|
||||
[{id: 'l3', line: 3, __commentSide: 'left'},
|
||||
{id: 'r5', line: 5, __commentSide: 'right'}]);
|
||||
{id: 'r5', line: 5, __commentSide: 'right'}]);
|
||||
assert.deepEqual(builder._getCommentsForLine(comments, line,
|
||||
GrDiffBuilder.Side.LEFT), [{id: 'l3', line: 3,
|
||||
__commentSide: 'left'}]);
|
||||
__commentSide: 'left'}]);
|
||||
assert.deepEqual(builder._getCommentsForLine(comments, line,
|
||||
GrDiffBuilder.Side.RIGHT), [{id: 'r5', line: 5,
|
||||
__commentSide: 'right'}]);
|
||||
__commentSide: 'right'}]);
|
||||
});
|
||||
|
||||
test('comment thread group creation', () => {
|
||||
@@ -901,7 +901,7 @@ limitations under the License.
|
||||
|
||||
test('no plugin layers', () => {
|
||||
const getDiffLayersStub = sinon.stub(element.$.jsAPI, 'getDiffLayers')
|
||||
.returns([]);
|
||||
.returns([]);
|
||||
element.attached();
|
||||
assert.isTrue(getDiffLayersStub.called);
|
||||
assert.equal(element._layers.length, initialLayersCount);
|
||||
@@ -909,7 +909,7 @@ limitations under the License.
|
||||
|
||||
test('with plugin layers', () => {
|
||||
const getDiffLayersStub = sinon.stub(element.$.jsAPI, 'getDiffLayers')
|
||||
.returns([{}, {}]);
|
||||
.returns([{}, {}]);
|
||||
element.attached();
|
||||
assert.isTrue(getDiffLayersStub.called);
|
||||
assert.equal(element._layers.length, initialLayersCount+2);
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
commentEl.collapsed = false;
|
||||
} else {
|
||||
const range = opt_range ? opt_range :
|
||||
lastComment ? lastComment.range : undefined;
|
||||
lastComment ? lastComment.range : undefined;
|
||||
const unresolved = lastComment ? lastComment.unresolved : undefined;
|
||||
this.addDraft(opt_lineNum, range, unresolved);
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ limitations under the License.
|
||||
done();
|
||||
});
|
||||
draftEl.fire('comment-discard', {comment: draftEl.comment},
|
||||
{bubbles: false});
|
||||
{bubbles: false});
|
||||
});
|
||||
|
||||
test('first editing comment does not add __otherEditing attribute', () => {
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
// Ignore saves started while already saving.
|
||||
if (this.disabled) { return; }
|
||||
const timingLabel = this.comment.id ?
|
||||
REPORT_UPDATE_DRAFT : REPORT_CREATE_DRAFT;
|
||||
REPORT_UPDATE_DRAFT : REPORT_CREATE_DRAFT;
|
||||
const timer = this.$.reporting.getTimer(timingLabel);
|
||||
this.set('comment.__editing', false);
|
||||
return this.save().then(() => { timer.end(); });
|
||||
@@ -568,13 +568,13 @@
|
||||
this._showStartRequest();
|
||||
return this.$.restAPI.deleteDiffDraft(this.changeNum, this.patchNum,
|
||||
draft).then(result => {
|
||||
if (result.ok) {
|
||||
this._showEndRequest();
|
||||
} else {
|
||||
this._handleFailedDraftRequest();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
if (result.ok) {
|
||||
this._showEndRequest();
|
||||
} else {
|
||||
this._handleFailedDraftRequest();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
},
|
||||
|
||||
_getPatchNum() {
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
if (this._getViewMode() === DiffViewMode.SIDE_BY_SIDE &&
|
||||
this._isTargetBlank()) {
|
||||
this.side = this.side === DiffSides.LEFT ?
|
||||
DiffSides.RIGHT : DiffSides.LEFT;
|
||||
DiffSides.RIGHT : DiffSides.LEFT;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -380,15 +380,15 @@
|
||||
splice = changeRecord.indexSplices[spliceIdx];
|
||||
|
||||
for (i = splice.index;
|
||||
i < splice.index + splice.addedCount;
|
||||
i++) {
|
||||
i < splice.index + splice.addedCount;
|
||||
i++) {
|
||||
this.listen(this.diffs[i], 'render-start', '_handleDiffRenderStart');
|
||||
this.listen(this.diffs[i], 'render-content', 'handleDiffUpdate');
|
||||
}
|
||||
|
||||
for (i = 0;
|
||||
i < splice.removed && splice.removed.length;
|
||||
i++) {
|
||||
i < splice.removed && splice.removed.length;
|
||||
i++) {
|
||||
this.unlisten(splice.removed[i],
|
||||
'render-start', '_handleDiffRenderStart');
|
||||
this.unlisten(splice.removed[i],
|
||||
|
||||
@@ -166,7 +166,7 @@ limitations under the License.
|
||||
assert.equal(layer4[0].textContent +
|
||||
layer4[1].textContent +
|
||||
layer4[2].textContent,
|
||||
layers[3]);
|
||||
layers[3]);
|
||||
});
|
||||
|
||||
test('splitTextNode', () => {
|
||||
|
||||
@@ -259,12 +259,12 @@ limitations under the License.
|
||||
};
|
||||
|
||||
const getActionRange = () =>
|
||||
Polymer.dom(element.root).querySelector(
|
||||
'gr-selection-action-box').range;
|
||||
Polymer.dom(element.root).querySelector(
|
||||
'gr-selection-action-box').range;
|
||||
|
||||
const getActionSide = () =>
|
||||
Polymer.dom(element.root).querySelector(
|
||||
'gr-selection-action-box').side;
|
||||
Polymer.dom(element.root).querySelector(
|
||||
'gr-selection-action-box').side;
|
||||
|
||||
const getLineElByChild = node => {
|
||||
const stubs = contentStubs.find(stub => stub.contentTd.contains(node));
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
// digits. Diffs with no delta are considered 0%.
|
||||
const totalDelta = rebaseDelta + nonRebaseDelta;
|
||||
const percentRebaseDelta = !totalDelta ? 0 :
|
||||
Math.round(100 * rebaseDelta / totalDelta);
|
||||
Math.round(100 * rebaseDelta / totalDelta);
|
||||
|
||||
// Report the due_to_rebase percentage in the "diff" category when
|
||||
// applicable.
|
||||
|
||||
@@ -177,7 +177,7 @@ limitations under the License.
|
||||
'getB64FileContents',
|
||||
(changeId, patchNum, path, opt_parentIndex) => {
|
||||
return Promise.resolve(opt_parentIndex === 1 ? mockFile1 :
|
||||
mockFile2);
|
||||
mockFile2);
|
||||
});
|
||||
|
||||
element.patchRange = {basePatchNum: 'PARENT', patchNum: 1};
|
||||
|
||||
@@ -87,8 +87,8 @@
|
||||
const side = this.diffBuilder.getSideByLineEl(lineEl);
|
||||
|
||||
targetClasses.push(side === 'left' ?
|
||||
SelectionClass.LEFT :
|
||||
SelectionClass.RIGHT);
|
||||
SelectionClass.LEFT :
|
||||
SelectionClass.RIGHT);
|
||||
|
||||
if (commentSelected) {
|
||||
targetClasses.push(SelectionClass.COMMENT);
|
||||
|
||||
@@ -257,8 +257,8 @@
|
||||
const patchRange = patchRangeRecord.base;
|
||||
return this.$.restAPI.getChangeFilePathsAsSpeciallySortedArray(
|
||||
changeNum, patchRange).then(files => {
|
||||
this._fileList = files;
|
||||
});
|
||||
this._fileList = files;
|
||||
});
|
||||
},
|
||||
|
||||
_getDiffPreferences() {
|
||||
@@ -550,8 +550,8 @@
|
||||
let idx = fileList.indexOf(path);
|
||||
if (idx === -1) {
|
||||
const file = direction > 0 ?
|
||||
fileList[0] :
|
||||
fileList[fileList.length - 1];
|
||||
fileList[0] :
|
||||
fileList[fileList.length - 1];
|
||||
return {path: file};
|
||||
}
|
||||
|
||||
@@ -681,8 +681,8 @@
|
||||
// is specified.
|
||||
this._getReviewedStatus(this.editMode, this._changeNum,
|
||||
this._patchRange.patchNum, this._path).then(status => {
|
||||
this.$.reviewed.checked = status;
|
||||
});
|
||||
this.$.reviewed.checked = status;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1080,7 +1080,7 @@
|
||||
// so we resolve the right "next" file.
|
||||
const unreviewedFiles = this._fileList
|
||||
.filter(file =>
|
||||
(file === this._path || !this._reviewedFiles.has(file)));
|
||||
(file === this._path || !this._reviewedFiles.has(file)));
|
||||
this._navToFile(this._path, unreviewedFiles, 1);
|
||||
},
|
||||
|
||||
|
||||
@@ -262,28 +262,28 @@ limitations under the License.
|
||||
assert.isTrue(element._loading);
|
||||
assert(diffNavStub.lastCall.calledWithExactly(element._change,
|
||||
'wheatley.md', '10', '5'),
|
||||
'Should navigate to /c/42/5..10/wheatley.md');
|
||||
'Should navigate to /c/42/5..10/wheatley.md');
|
||||
element._path = 'wheatley.md';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 219, null, '[');
|
||||
assert.isTrue(element._loading);
|
||||
assert(diffNavStub.lastCall.calledWithExactly(element._change,
|
||||
'glados.txt', '10', '5'),
|
||||
'Should navigate to /c/42/5..10/glados.txt');
|
||||
'Should navigate to /c/42/5..10/glados.txt');
|
||||
element._path = 'glados.txt';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 219, null, '[');
|
||||
assert.isTrue(element._loading);
|
||||
assert(diffNavStub.lastCall.calledWithExactly(element._change, 'chell.go',
|
||||
'10', '5'),
|
||||
'Should navigate to /c/42/5..10/chell.go');
|
||||
'Should navigate to /c/42/5..10/chell.go');
|
||||
element._path = 'chell.go';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 219, null, '[');
|
||||
assert.isTrue(element._loading);
|
||||
assert(changeNavStub.lastCall.calledWithExactly(element._change, '10',
|
||||
'5'),
|
||||
'Should navigate to /c/42/5..10');
|
||||
'Should navigate to /c/42/5..10');
|
||||
});
|
||||
|
||||
test('keyboard shortcuts with old patch number', () => {
|
||||
@@ -325,13 +325,13 @@ limitations under the License.
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 221, null, ']');
|
||||
assert(diffNavStub.lastCall.calledWithExactly(element._change,
|
||||
'wheatley.md', '1', PARENT),
|
||||
'Should navigate to /c/42/1/wheatley.md');
|
||||
'Should navigate to /c/42/1/wheatley.md');
|
||||
element._path = 'wheatley.md';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 219, null, '[');
|
||||
assert(diffNavStub.lastCall.calledWithExactly(element._change,
|
||||
'glados.txt', '1', PARENT),
|
||||
'Should navigate to /c/42/1/glados.txt');
|
||||
'Should navigate to /c/42/1/glados.txt');
|
||||
element._path = 'glados.txt';
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 219, null, '[');
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* @event diff-comments-modified
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Fired when a draft is added or edited.
|
||||
*
|
||||
* @event draft-interaction
|
||||
@@ -353,8 +353,8 @@
|
||||
return false;
|
||||
}
|
||||
const patchNum = el.classList.contains(DiffSide.LEFT) ?
|
||||
this.patchRange.basePatchNum :
|
||||
this.patchRange.patchNum;
|
||||
this.patchRange.basePatchNum :
|
||||
this.patchRange.patchNum;
|
||||
|
||||
const isEdit = this.patchNumEquals(patchNum, this.EDIT_NAME);
|
||||
const isEditBase = this.patchNumEquals(patchNum, this.PARENT_NAME) &&
|
||||
@@ -763,8 +763,8 @@
|
||||
chunkIndex--;
|
||||
chunk = diff.content[chunkIndex];
|
||||
} while (
|
||||
// We haven't reached the beginning.
|
||||
chunkIndex >= 0 &&
|
||||
// We haven't reached the beginning.
|
||||
chunkIndex >= 0 &&
|
||||
|
||||
// The chunk doesn't have both sides.
|
||||
!chunk.ab &&
|
||||
|
||||
@@ -339,7 +339,7 @@ limitations under the License.
|
||||
const threadGroup = contentEl.querySelector(
|
||||
'gr-diff-comment-thread-group');
|
||||
const threadLength = Polymer.dom(threadGroup.root).
|
||||
querySelectorAll('gr-diff-comment-thread').length;
|
||||
querySelectorAll('gr-diff-comment-thread').length;
|
||||
assert.equal(threadLength, 2);
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
changeComments, revisionInfo) {
|
||||
const parentCounts = revisionInfo.getParentCountMap();
|
||||
const currentParentCount = parentCounts.hasOwnProperty(patchNum) ?
|
||||
parentCounts[patchNum] : 1;
|
||||
parentCounts[patchNum] : 1;
|
||||
const maxParents = revisionInfo.getMaxParents();
|
||||
const isMerge = currentParentCount > 1;
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
_computePatchSetDescription(revisions, patchNum, opt_addFrontSpace) {
|
||||
const rev = this.getRevisionByPatchNum(revisions, patchNum);
|
||||
return (rev && rev.description) ?
|
||||
(opt_addFrontSpace ? ' ' : '') +
|
||||
(opt_addFrontSpace ? ' ' : '') +
|
||||
rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : '';
|
||||
},
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ limitations under the License.
|
||||
assert.deepEqual(element._computeBaseDropdownContent(availablePatches,
|
||||
patchNum, sortedRevisions, element.changeComments,
|
||||
element.revisionInfo),
|
||||
expectedResult);
|
||||
expectedResult);
|
||||
});
|
||||
|
||||
test('_computeBaseDropdownContent called when patchNum updates', () => {
|
||||
@@ -342,7 +342,7 @@ limitations under the License.
|
||||
|
||||
assert.deepEqual(element._computePatchDropdownContent(availablePatches,
|
||||
basePatchNum, sortedRevisions, element.changeComments),
|
||||
expectedResult);
|
||||
expectedResult);
|
||||
});
|
||||
|
||||
test('filesWeblinks', () => {
|
||||
|
||||
@@ -53,12 +53,12 @@
|
||||
annotate(el, line) {
|
||||
let ranges = [];
|
||||
if (line.type === GrDiffLine.Type.REMOVE || (
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
el.getAttribute('data-side') !== 'right')) {
|
||||
ranges = ranges.concat(this._getRangesForLine(line, 'left'));
|
||||
}
|
||||
if (line.type === GrDiffLine.Type.ADD || (
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
el.getAttribute('data-side') !== 'left')) {
|
||||
ranges = ranges.concat(this._getRangesForLine(line, 'right'));
|
||||
}
|
||||
@@ -165,8 +165,8 @@
|
||||
|
||||
for (const splice of record.indexSplices) {
|
||||
const ranges = splice.removed.length ?
|
||||
splice.removed.map(c => { return c.range; }) :
|
||||
[splice.object[splice.index].range];
|
||||
splice.removed.map(c => { return c.range; }) :
|
||||
[splice.object[splice.index].range];
|
||||
for (const range of ranges) {
|
||||
if (!range) { continue; }
|
||||
this._notifyUpdateRange(range.start_line, range.end_line, side);
|
||||
|
||||
@@ -177,11 +177,11 @@
|
||||
// Determine the side.
|
||||
let side;
|
||||
if (line.type === GrDiffLine.Type.REMOVE || (
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
line.type === GrDiffLine.Type.BOTH &&
|
||||
el.getAttribute('data-side') !== 'right')) {
|
||||
side = 'left';
|
||||
} else if (line.type === GrDiffLine.Type.ADD || (
|
||||
el.getAttribute('data-side') !== 'left')) {
|
||||
el.getAttribute('data-side') !== 'left')) {
|
||||
side = 'right';
|
||||
}
|
||||
|
||||
|
||||
@@ -207,17 +207,17 @@
|
||||
_handleRenameConfirm(e) {
|
||||
return this.$.restAPI.renameFileInChangeEdit(this.change._number,
|
||||
this._path, this._newPath).then(res => {
|
||||
if (!res.ok) { return; }
|
||||
this._closeDialog(this._getDialogFromEvent(e), true);
|
||||
Gerrit.Nav.navigateToChange(this.change);
|
||||
});
|
||||
if (!res.ok) { return; }
|
||||
this._closeDialog(this._getDialogFromEvent(e), true);
|
||||
Gerrit.Nav.navigateToChange(this.change);
|
||||
});
|
||||
},
|
||||
|
||||
_queryFiles(input) {
|
||||
return this.$.restAPI.queryChangeFiles(this.change._number,
|
||||
this.patchNum, input).then(res => res.map(file => {
|
||||
return {name: file};
|
||||
}));
|
||||
return {name: file};
|
||||
}));
|
||||
},
|
||||
|
||||
_computeIsInvisible(id, hiddenActions) {
|
||||
|
||||
@@ -136,11 +136,11 @@
|
||||
if (path === this._path) { return Promise.resolve(); }
|
||||
return this.$.restAPI.renameFileInChangeEdit(this._changeNum,
|
||||
this._path, path).then(res => {
|
||||
if (!res.ok) { return; }
|
||||
if (!res.ok) { return; }
|
||||
|
||||
this._successfulSave = true;
|
||||
this._viewEditInChangeView();
|
||||
});
|
||||
this._successfulSave = true;
|
||||
this._viewEditInChangeView();
|
||||
});
|
||||
},
|
||||
|
||||
_viewEditInChangeView() {
|
||||
@@ -183,13 +183,13 @@
|
||||
this.$.storage.eraseEditableContentItem(this.storageKey);
|
||||
return this.$.restAPI.saveChangeEdit(this._changeNum, this._path,
|
||||
this._newContent).then(res => {
|
||||
this._saving = false;
|
||||
this._showAlert(res.ok ? SAVED_MESSAGE : SAVE_FAILED_MSG);
|
||||
if (!res.ok) { return; }
|
||||
this._saving = false;
|
||||
this._showAlert(res.ok ? SAVED_MESSAGE : SAVE_FAILED_MSG);
|
||||
if (!res.ok) { return; }
|
||||
|
||||
this._content = this._newContent;
|
||||
this._successfulSave = true;
|
||||
});
|
||||
this._content = this._newContent;
|
||||
this._successfulSave = true;
|
||||
});
|
||||
},
|
||||
|
||||
_showAlert(message) {
|
||||
|
||||
@@ -104,7 +104,7 @@ suite('gr-editor-view tests', () => {
|
||||
// Calling with the same path should not navigate.
|
||||
return element._handlePathChanged({detail: mockParams.path}).then(() => {
|
||||
assert.isFalse(savePathStub.called);
|
||||
// !ok response
|
||||
// !ok response
|
||||
element._handlePathChanged({detail: 'newPath'}).then(() => {
|
||||
assert.isTrue(savePathStub.called);
|
||||
assert.isFalse(navigateStub.called);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
this._createHook();
|
||||
}
|
||||
this._hook.onAttached(element =>
|
||||
this.plugin.attributeHelper(element).bind('labels', callback));
|
||||
this.plugin.attributeHelper(element).bind('labels', callback));
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
@@ -91,15 +91,15 @@
|
||||
return helper.get('value').then(
|
||||
value => helper.bind('value',
|
||||
value => plugin.attributeHelper(el).set(paramName, value))
|
||||
);
|
||||
);
|
||||
});
|
||||
let timeoutId;
|
||||
const timeout = new Promise(
|
||||
resolve => timeoutId = setTimeout(() => {
|
||||
console.warn(
|
||||
'Timeout waiting for endpoint properties initialization: ' +
|
||||
resolve => timeoutId = setTimeout(() => {
|
||||
console.warn(
|
||||
'Timeout waiting for endpoint properties initialization: ' +
|
||||
`plugin ${plugin.getPluginName()}, endpoint ${this.name}`);
|
||||
}, INIT_PROPERTIES_TIMEOUT_MS));
|
||||
}, INIT_PROPERTIES_TIMEOUT_MS));
|
||||
return Promise.race([timeout, Promise.all(expectProperties)])
|
||||
.then(() => {
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
.filter(p => !Gerrit._isPluginPreloaded(p));
|
||||
const jsPlugins =
|
||||
this._handleMigrations(plugins.js_resource_paths || [], htmlPlugins)
|
||||
.map(p => this._urlFor(p))
|
||||
.filter(p => !Gerrit._isPluginPreloaded(p));
|
||||
.map(p => this._urlFor(p))
|
||||
.filter(p => !Gerrit._isPluginPreloaded(p));
|
||||
const shouldLoadTheme = config.default_theme &&
|
||||
!Gerrit._isPluginPreloaded('preloaded:gerrit-theme');
|
||||
const defaultTheme =
|
||||
|
||||
@@ -46,17 +46,17 @@
|
||||
if (!this._openingPromise) {
|
||||
this._openingPromise =
|
||||
this.plugin.hook('plugin-overlay').getLastAttached()
|
||||
.then(hookEl => {
|
||||
const popup = document.createElement('gr-plugin-popup');
|
||||
if (this._moduleName) {
|
||||
const el = Polymer.dom(popup).appendChild(
|
||||
document.createElement(this._moduleName));
|
||||
el.plugin = this.plugin;
|
||||
}
|
||||
this._popup = Polymer.dom(hookEl).appendChild(popup);
|
||||
Polymer.dom.flush();
|
||||
return this._popup.open().then(() => this);
|
||||
});
|
||||
.then(hookEl => {
|
||||
const popup = document.createElement('gr-plugin-popup');
|
||||
if (this._moduleName) {
|
||||
const el = Polymer.dom(popup).appendChild(
|
||||
document.createElement(this._moduleName));
|
||||
el.plugin = this.plugin;
|
||||
}
|
||||
this._popup = Polymer.dom(hookEl).appendChild(popup);
|
||||
Polymer.dom.flush();
|
||||
return this._popup.open().then(() => this);
|
||||
});
|
||||
}
|
||||
return this._openingPromise;
|
||||
};
|
||||
|
||||
@@ -123,20 +123,20 @@
|
||||
|
||||
_maybeSetName() {
|
||||
return this._hasNameChange && this.nameMutable ?
|
||||
this.$.restAPI.setAccountName(this._account.name) :
|
||||
Promise.resolve();
|
||||
this.$.restAPI.setAccountName(this._account.name) :
|
||||
Promise.resolve();
|
||||
},
|
||||
|
||||
_maybeSetUsername() {
|
||||
return this._hasUsernameChange && this.usernameMutable ?
|
||||
this.$.restAPI.setAccountUsername(this._username) :
|
||||
Promise.resolve();
|
||||
this.$.restAPI.setAccountUsername(this._username) :
|
||||
Promise.resolve();
|
||||
},
|
||||
|
||||
_maybeSetStatus() {
|
||||
return this._hasStatusChange ?
|
||||
this.$.restAPI.setAccountStatus(this._account.status) :
|
||||
Promise.resolve();
|
||||
this.$.restAPI.setAccountStatus(this._account.status) :
|
||||
Promise.resolve();
|
||||
},
|
||||
|
||||
_computeHasUnsavedChanges(nameChanged, usernameChanged, statusChanged) {
|
||||
|
||||
@@ -150,7 +150,7 @@ limitations under the License.
|
||||
usernameChangedSpy = sandbox.spy(element, '_usernameChanged');
|
||||
statusChangedSpy = sandbox.spy(element, '_statusChanged');
|
||||
element.set('_serverConfig',
|
||||
{auth: {editable_account_fields: ['FULL_NAME', 'USER_NAME']}});
|
||||
{auth: {editable_account_fields: ['FULL_NAME', 'USER_NAME']}});
|
||||
|
||||
nameStub = sandbox.stub(element.$.restAPI, 'setAccountName',
|
||||
name => Promise.resolve());
|
||||
@@ -278,7 +278,7 @@ limitations under the License.
|
||||
setup(() => {
|
||||
statusChangedSpy = sandbox.spy(element, '_statusChanged');
|
||||
element.set('_serverConfig',
|
||||
{auth: {editable_account_fields: []}});
|
||||
{auth: {editable_account_fields: []}});
|
||||
|
||||
statusStub = sandbox.stub(element.$.restAPI, 'setAccountStatus',
|
||||
status => Promise.resolve());
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
_hideAgreements(item, groups, signedAgreements) {
|
||||
return this._disableAgreements(item, groups, signedAgreements) ?
|
||||
'' : 'hide';
|
||||
'' : 'hide';
|
||||
},
|
||||
|
||||
_disableAgreementsText(text) {
|
||||
|
||||
@@ -46,11 +46,11 @@
|
||||
return;
|
||||
}
|
||||
this._keys = Object.keys(keys)
|
||||
.map(key => {
|
||||
const gpgKey = keys[key];
|
||||
gpgKey.id = key;
|
||||
return gpgKey;
|
||||
});
|
||||
.map(key => {
|
||||
const gpgKey = keys[key];
|
||||
gpgKey.id = key;
|
||||
return gpgKey;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -67,17 +67,17 @@ limitations under the License.
|
||||
name: 'Andrew Bonventre',
|
||||
email: 'andybons+gerrit@gmail.com',
|
||||
}),
|
||||
'Andrew Bonventre <andybons+gerrit@gmail.com>');
|
||||
'Andrew Bonventre <andybons+gerrit@gmail.com>');
|
||||
|
||||
assert.equal(element._computeAccountTitle(
|
||||
{name: 'Andrew Bonventre'}),
|
||||
'Andrew Bonventre');
|
||||
'Andrew Bonventre');
|
||||
|
||||
assert.equal(element._computeAccountTitle(
|
||||
{
|
||||
email: 'andybons+gerrit@gmail.com',
|
||||
}),
|
||||
'Anonymous <andybons+gerrit@gmail.com>');
|
||||
'Anonymous <andybons+gerrit@gmail.com>');
|
||||
|
||||
assert.equal(element._computeShowEmailClass(
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user