Merge "Fix implicitly declared variables"

This commit is contained in:
Dmitrii Filippov
2020-03-06 08:26:25 +00:00
committed by Gerrit Code Review
18 changed files with 26 additions and 22 deletions

View File

@@ -637,7 +637,7 @@ limitations under the License.
test('_computeAddAndRemove sections', () => { test('_computeAddAndRemove sections', () => {
// Add a new permission to a section // Add a new permission to a section
expectedInput = { let expectedInput = {
add: { add: {
'refs/*': { 'refs/*': {
permissions: { permissions: {
@@ -742,7 +742,7 @@ limitations under the License.
test('_computeAddAndRemove new section', () => { test('_computeAddAndRemove new section', () => {
// Add a new permission to a section // Add a new permission to a section
expectedInput = { let expectedInput = {
add: { add: {
'refs/for/*': { 'refs/for/*': {
added: true, added: true,

View File

@@ -123,6 +123,7 @@ limitations under the License.
}); });
suite('filter', () => { suite('filter', () => {
let reposFiltered;
setup(() => { setup(() => {
repos = _.times(25, repoGenerator); repos = _.times(25, repoGenerator);
reposFiltered = _.times(1, repoGenerator); reposFiltered = _.times(1, repoGenerator);

View File

@@ -41,6 +41,7 @@ limitations under the License.
let element; let element;
let sandbox; let sandbox;
let paramsChangedPromise; let paramsChangedPromise;
let getChangesStub;
setup(() => { setup(() => {
stub('gr-rest-api-interface', { stub('gr-rest-api-interface', {

View File

@@ -1666,7 +1666,6 @@ limitations under the License.
.returns(Promise.resolve({revert_changes: [ .returns(Promise.resolve({revert_changes: [
{change_id: 12345}, {change_id: 12345},
]})); ]}));
showActionDialogStub = sandbox.stub(element, '_showActionDialog');
navigateToSearchQueryStub = sandbox.stub(Gerrit.Nav, navigateToSearchQueryStub = sandbox.stub(Gerrit.Nav,
'navigateToSearchQuery'); 'navigateToSearchQuery');
}); });

View File

@@ -334,7 +334,8 @@ limitations under the License.
}); });
}); });
getCustomCssValue = cssParam => util.getComputedStyleValue(cssParam, element); const getCustomCssValue =
cssParam => util.getComputedStyleValue(cssParam, element);
test('_handleMessageAnchorTap', () => { test('_handleMessageAnchorTap', () => {
element._changeNum = '1'; element._changeNum = '1';
@@ -875,7 +876,7 @@ limitations under the License.
}, },
}; };
element._mergeable = true; element._mergeable = true;
expectedStatuses = ['Merged', 'WIP']; const expectedStatuses = ['Merged', 'WIP'];
assert.deepEqual(element._changeStatuses, expectedStatuses); assert.deepEqual(element._changeStatuses, expectedStatuses);
assert.equal(element._changeStatus, expectedStatuses.join(', ')); assert.equal(element._changeStatus, expectedStatuses.join(', '));
flushAsynchronousOperations(); flushAsynchronousOperations();

View File

@@ -149,7 +149,6 @@ limitations under the License.
// comment API. // comment API.
commentApiWrapper = fixture('basic'); commentApiWrapper = fixture('basic');
element = commentApiWrapper.$.messagesList; element = commentApiWrapper.$.messagesList;
loadCommentSpy = sandbox.spy(commentApiWrapper.$.commentAPI, 'loadAll');
element.messages = messages; element.messages = messages;
// Stub methods on the changeComments object after changeComments has // Stub methods on the changeComments object after changeComments has
@@ -476,7 +475,7 @@ limitations under the License.
// comment API. // comment API.
commentApiWrapper = fixture('basic'); commentApiWrapper = fixture('basic');
element = commentApiWrapper.$.messagesList; element = commentApiWrapper.$.messagesList;
loadCommentSpy = sandbox.spy(commentApiWrapper.$.commentAPI, 'loadAll'); sandbox.spy(commentApiWrapper.$.commentAPI, 'loadAll');
element.messages = messages; element.messages = messages;
// Stub methods on the changeComments object after changeComments has // Stub methods on the changeComments object after changeComments has
@@ -506,7 +505,7 @@ limitations under the License.
element._hideAutomated = false; element._hideAutomated = false;
MockInteractions.tap(element.$.automatedMessageToggle); MockInteractions.tap(element.$.automatedMessageToggle);
flushAsynchronousOperations(); flushAsynchronousOperations();
allMessageEls = getMessages(); const allMessageEls = getMessages();
allHiddenMessageEls = getHiddenMessages(); allHiddenMessageEls = getHiddenMessages();
// Autogenerated messages are now hidden. // Autogenerated messages are now hidden.

View File

@@ -62,7 +62,7 @@ limitations under the License.
assert.equal(element._inputVal, 'foo'); assert.equal(element._inputVal, 'foo');
}); });
getActiveElement = () => (document.activeElement.shadowRoot ? const getActiveElement = () => (document.activeElement.shadowRoot ?
document.activeElement.shadowRoot.activeElement : document.activeElement.shadowRoot.activeElement :
document.activeElement); document.activeElement);

View File

@@ -85,7 +85,7 @@ limitations under the License.
suite('annotate', () => { suite('annotate', () => {
function createLine(lineNumber) { function createLine(lineNumber) {
lineEl = document.createElement('div'); const lineEl = document.createElement('div');
lineEl.setAttribute('data-side', 'right'); lineEl.setAttribute('data-side', 'right');
lineEl.setAttribute('data-value', lineNumber); lineEl.setAttribute('data-value', lineNumber);
lineEl.className = 'right'; lineEl.className = 'right';

View File

@@ -1199,7 +1199,7 @@ limitations under the License.
line: 1, line: 1,
}]; }];
expectedThreads = [ const expectedThreads = [
{ {
start_datetime: '2015-12-24 15:00:10.396000000', start_datetime: '2015-12-24 15:00:10.396000000',
commentSide: 'left', commentSide: 'left',
@@ -1297,7 +1297,7 @@ limitations under the License.
assert.equal(threads[0].patchNum, 2); assert.equal(threads[0].patchNum, 2);
// Try to fetch a thread with a different range. // Try to fetch a thread with a different range.
range = { const range = {
start_line: 1, start_line: 1,
start_character: 1, start_character: 1,
end_line: 1, end_line: 1,

View File

@@ -472,7 +472,6 @@ limitations under the License.
}); });
test('_computeCommentString', done => { test('_computeCommentString', done => {
loadCommentSpy = sandbox.spy(element.$.commentAPI, 'loadAll');
const path = '/test'; const path = '/test';
element.$.commentAPI.loadAll().then(comments => { element.$.commentAPI.loadAll().then(comments => {
const commentCountStub = const commentCountStub =
@@ -1365,6 +1364,8 @@ limitations under the License.
}); });
suite('gr-diff-view tests unmodified files with comments', () => { suite('gr-diff-view tests unmodified files with comments', () => {
let sandbox;
let element;
setup(() => { setup(() => {
sandbox = sinon.sandbox.create(); sandbox = sinon.sandbox.create();
const changedFiles = { const changedFiles = {

View File

@@ -1052,7 +1052,7 @@ limitations under the License.
test('`render` event has contentRendered field in detail', done => { test('`render` event has contentRendered field in detail', done => {
element = fixture('basic'); element = fixture('basic');
element.prefs = {}; element.prefs = {};
renderStub = sandbox.stub(element.$.diffBuilder, 'render') sandbox.stub(element.$.diffBuilder, 'render')
.returns(Promise.resolve()); .returns(Promise.resolve());
element.addEventListener('render', event => { element.addEventListener('render', event => {
assert.isTrue(event.detail.contentRendered); assert.isTrue(event.detail.contentRendered);

View File

@@ -88,7 +88,7 @@ limitations under the License.
suite('filter', () => { suite('filter', () => {
setup(() => { setup(() => {
documentationSearches = _.times(25, documentationGenerator); documentationSearches = _.times(25, documentationGenerator);
documentationSearchesFiltered = _.times(1, documentationSearches); _.times(1, documentationSearches);
}); });
test('_paramsChanged', done => { test('_paramsChanged', done => {

View File

@@ -41,6 +41,7 @@ limitations under the License.
suite('gr-account-entry tests', async () => { suite('gr-account-entry tests', async () => {
await readyToTest(); await readyToTest();
let sandbox; let sandbox;
let element;
const suggestion1 = { const suggestion1 = {
email: 'email1@example.com', email: 'email1@example.com',

View File

@@ -149,7 +149,7 @@ limitations under the License.
}); });
test('updated suggestions resets cursor stops', () => { test('updated suggestions resets cursor stops', () => {
resetStopsSpy = sandbox.spy(element, '_resetCursorStops'); const resetStopsSpy = sandbox.spy(element, '_resetCursorStops');
element.suggestions = []; element.suggestions = [];
assert.isTrue(resetStopsSpy.called); assert.isTrue(resetStopsSpy.called);
}); });

View File

@@ -68,7 +68,7 @@ limitations under the License.
}); });
test('test annotateRange', () => { test('test annotateRange', () => {
annotateElementSpy = sandbox.spy(GrAnnotation, 'annotateElement'); const annotateElementSpy = sandbox.spy(GrAnnotation, 'annotateElement');
const start = 0; const start = 0;
const end = 100; const end = 100;
const cssStyleObject = plugin.styles().css('background-color: #000000'); const cssStyleObject = plugin.styles().css('background-color: #000000');

View File

@@ -60,7 +60,7 @@ limitations under the License.
test('add/get layer', () => { test('add/get layer', () => {
const str = 'lorem ipsum blah blah'; const str = 'lorem ipsum blah blah';
const line = {text: str}; const line = {text: str};
el = document.createElement('div'); const el = document.createElement('div');
el.textContent = str; el.textContent = str;
const changeNum = 1234; const changeNum = 1234;
const patchNum = 2; const patchNum = 2;
@@ -91,6 +91,7 @@ limitations under the License.
const layer2Spy = sandbox.spy(annotationLayer2, 'notifyListeners'); const layer2Spy = sandbox.spy(annotationLayer2, 'notifyListeners');
let notify; let notify;
let notifyFuncCalled;
const notifyFunc = n => { const notifyFunc = n => {
notifyFuncCalled = true; notifyFuncCalled = true;
notify = n; notify = n;
@@ -119,7 +120,7 @@ limitations under the License.
}); });
test('toggle checkbox', () => { test('toggle checkbox', () => {
fakeEl = {content: fixture('basic')}; const fakeEl = {content: fixture('basic')};
const hookStub = {onAttached: sandbox.stub()}; const hookStub = {onAttached: sandbox.stub()};
sandbox.stub(plugin, 'hook').returns(hookStub); sandbox.stub(plugin, 'hook').returns(hookStub);
@@ -130,7 +131,7 @@ limitations under the License.
onAttachedFuncCalled = true; onAttachedFuncCalled = true;
}; };
annotationActions.enableToggleCheckbox('test label', onAttachedFunc); annotationActions.enableToggleCheckbox('test label', onAttachedFunc);
emulateAttached = () => hookStub.onAttached.callArgWith(0, fakeEl); const emulateAttached = () => hookStub.onAttached.callArgWith(0, fakeEl);
emulateAttached(); emulateAttached();
// Assert that onAttachedFunc is called and HTML elements have the // Assert that onAttachedFunc is called and HTML elements have the

View File

@@ -52,7 +52,7 @@ limitations under the License.
a[k] = (...args) => restApiStub[k](...args); a[k] = (...args) => restApiStub[k](...args);
return a; return a;
}, {})); }, {}));
Gerrit.install(p => { plugin = p; }, '0.1', Gerrit.install(p => {}, '0.1',
'http://test.com/plugins/testplugin/static/test.js'); 'http://test.com/plugins/testplugin/static/test.js');
instance = new GrPluginRestApi(); instance = new GrPluginRestApi();
}); });

View File

@@ -100,7 +100,7 @@ limitations under the License.
test('next button', done => { test('next button', done => {
element.itemsPerPage = 25; element.itemsPerPage = 25;
projects = new Array(26); let projects = new Array(26);
flush(() => { flush(() => {
let loading; let loading;