Catch-all fix for merged linter errors

Bug: Issue 6179
Change-Id: I436b6dbd88e83b4d901d5446a0c7900678be157d
This commit is contained in:
Kasper Nilsson
2017-05-17 16:00:33 -07:00
parent 75f5614895
commit fbad19e18e
12 changed files with 80 additions and 85 deletions

View File

@@ -51,7 +51,7 @@ limitations under the License.
return document.activeElement.shadowRoot ?
document.activeElement.shadowRoot.activeElement :
document.activeElement;
}
};
test('tap on search button triggers nav', done => {
sinon.stub(page, 'show', () => {
@@ -203,11 +203,11 @@ limitations under the License.
});
test('Autocomplete doesnt override exact matches to input', done => {
element._getSearchSuggestions('ownerin:gerrit').then(s => {
assert.equal(s[0].value, 'ownerin:gerrit');
done();
});
});
element._getSearchSuggestions('ownerin:gerrit').then(s => {
assert.equal(s[0].value, 'ownerin:gerrit');
done();
});
});
test('Autocomplete respects spaces', done => {
element._getSearchSuggestions('is:ope').then(s => {

View File

@@ -33,16 +33,16 @@
message: String,
},
resetFocus: function() {
resetFocus() {
this.$.messageInput.textarea.focus();
},
_handleConfirmTap: function(e) {
_handleConfirmTap(e) {
e.preventDefault();
this.fire('confirm', {reason: this.message}, {bubbles: false});
},
_handleCancelTap: function(e) {
_handleCancelTap(e) {
e.preventDefault();
this.fire('cancel', null, {bubbles: false});
},

View File

@@ -246,12 +246,12 @@ limitations under the License.
assert.isTrue(element._handleSave.called);
});
});
test('delete comment button for non-admins is hidden', function() {
test('delete comment button for non-admins is hidden', () => {
element._isAdmin = false;
assert.isTrue(element.$$('.action.delete').hidden);
});
test('delete comment', function(done) {
test('delete comment', done => {
sandbox.stub(
element.$.restAPI, 'deleteComment').returns(Promise.resolve());
sandbox.spy(element.$.overlay, 'open');
@@ -259,7 +259,7 @@ limitations under the License.
element.patchNum = 0xDEADBEEF;
element._isAdmin = true;
MockInteractions.tap(element.$$('.action.delete'));
element.$.overlay.open.lastCall.returnValue.then(function() {
element.$.overlay.open.lastCall.returnValue.then(() => {
element.$.confirmDeleteComment.message = 'removal reason';
element._handleConfirmDeleteComment();
assert.isTrue(element.$.restAPI.deleteComment.calledWith(
@@ -494,7 +494,7 @@ limitations under the License.
test('draft saving/editing', done => {
const fireStub = sinon.stub(element, 'fire');
let cancelDebounce = sandbox.stub(element, 'cancelDebouncer');
const cancelDebounce = sandbox.stub(element, 'cancelDebouncer');
element.draft = true;
MockInteractions.tap(element.$$('.edit'));

View File

@@ -46,7 +46,6 @@
*/
annotateElement(parent, offset, length, cssClass) {
const nodes = [].slice.apply(parent.childNodes);
let node;
let nodeLength;
let subLength;

View File

@@ -928,7 +928,7 @@ limitations under the License.
test('saving a draft', () => {
const draftID = 'tempID';
const id = 'savedID';
let comment = {
const comment = {
__draft: true,
__draftID: draftID,
side: 'PARENT',

View File

@@ -57,8 +57,7 @@ limitations under the License.
if (element.isOpen) element.close();
});
test('the dropdown has not been moved from the text fixture to the body',
() => {
test('dropdown has not been moved from text fixture to the body', () => {
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 1);
const dropdown = Polymer.dom(document.root)
@@ -148,54 +147,53 @@ limitations under the License.
element.suggestions = [];
assert.isTrue(resetStopsSpy.called);
});
});
suite('gr-autocomplete-dropdown to root', () => {
let element;
let sandbox;
setup(() => {
sandbox = sinon.sandbox.create();
fixture('move').open();
// The element was moved to the body, so look for it there.
element = Polymer.dom(document.root)
.querySelector('gr-autocomplete-dropdown');
element.suggestions = [
{value: 'test value 1', name: 'test name 1', text: 1},
{value: 'test value 2', name: 'test name 2', text: 2}];
});
teardown(() => {
sandbox.restore();
if (!element.hidden) element.close();
});
suite('gr-autocomplete-dropdown to root', () => {
let element;
let sandbox;
test('the dropdown has been moved from the text fixture to the body',
() => {
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 1);
const dropdown = Polymer.dom(document.root)
.querySelector('gr-autocomplete-dropdown');
assert.isOk(dropdown);
assert.deepEqual(dropdown.parentElement, Polymer.dom(document.root)
.querySelector('body'));
});
setup(() => {
sandbox = sinon.sandbox.create();
fixture('move').open();
// The element was moved to the body, so look for it there.
element = Polymer.dom(document.root)
.querySelector('gr-autocomplete-dropdown');
element.suggestions = [
{value: 'test value 1', name: 'test name 1', text: 1},
{value: 'test value 2', name: 'test name 2', text: 2}];
});
test('closing removes from body and adding adds to body', () => {
element.close();
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 0);
element.open();
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 1);
});
teardown(() => {
sandbox.restore();
if (!element.hidden) element.close();
});
test('setPosition', () => {
const top = '10px';
const left = '20px';
element.setPosition(top, left);
assert.equal(getComputedStyle(element).top, top);
assert.equal(getComputedStyle(element).left, left);
test('dropdown has been moved from the text fixture to the body', () => {
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 1);
const dropdown = Polymer.dom(document.root)
.querySelector('gr-autocomplete-dropdown');
assert.isOk(dropdown);
assert.deepEqual(dropdown.parentElement, Polymer.dom(document.root)
.querySelector('body'));
});
test('closing removes from body and adding adds to body', () => {
element.close();
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 0);
element.open();
assert.equal(Polymer.dom(document.root)
.querySelectorAll('gr-autocomplete-dropdown').length, 1);
});
test('setPosition', () => {
const top = '10px';
const left = '20px';
element.setPosition(top, left);
assert.equal(getComputedStyle(element).top, top);
assert.equal(getComputedStyle(element).left, left);
});
});
});
</script>

View File

@@ -1126,13 +1126,11 @@
'POST', this.getChangeActionURL(changeNum, null, '/ready'), review);
},
deleteComment: function(changeNum, patchNum, commentID, reason) {
var url = this._changeBaseURL(changeNum, patchNum) +
deleteComment(changeNum, patchNum, commentID, reason) {
const url = this._changeBaseURL(changeNum, patchNum) +
'/comments/' + commentID + '/delete';
return this.send('POST', url, {reason: reason}).then(
function(response) {
return this.getResponseObject(response);
}.bind(this));
return this.send('POST', url, {reason}).then(response =>
this.getResponseObject(response));
},
});
})();

View File

@@ -635,13 +635,13 @@ limitations under the License.
sandbox.stub(element, 'send').returns(Promise.resolve());
sandbox.stub(element, 'getResponseObject').returns('some response');
element.deleteComment('foo', 'bar', '01234', 'removal reason')
.then(response => {
assert.equal(response, 'some response');
done();
});
.then(response => {
assert.equal(response, 'some response');
done();
});
assert.isTrue(element.send.calledWith(
'POST', '/changes/foo/revisions/bar/comments/01234/delete',
{reason:'removal reason'}));
{reason: 'removal reason'}));
});
});
</script>

View File

@@ -214,7 +214,7 @@
if (nextMessageDate && date > nextMessageDate) {
break;
}
};
}
});
};

View File

@@ -262,25 +262,25 @@ limitations under the License.
type: 'REVIEWER_UPDATE',
updates: [{
message: 'same time update',
}]
}],
}, {
date: tplus(200),
type: 'REVIEWER_UPDATE',
updates: [{
message: 'update within threshold',
}]
}],
}, {
date: tplus(600),
type: 'REVIEWER_UPDATE',
updates: [{
message: 'update between messages',
}]
}],
}, {
date: tplus(1000),
type: 'REVIEWER_UPDATE',
updates: [{
message: 'late update',
}]
}],
}],
messages: [{
id: '6734489eb9d642de28dbf2bcf9bda875923800d8',
@@ -307,12 +307,12 @@ limitations under the License.
type: 'REVIEWER_UPDATE',
updates: [{
message: 'update within threshold',
}]
}],
});
const makeRubbishMessage = () => ({
id: '6734489eb9d642de28dbf2bcf9bda875923800d8',
date: '2016-02-17 19:04:18.000000000',
message: 'Uploaded patch set 2.',
id: '6734489eb9d642de28dbf2bcf9bda875923800d8',
date: '2016-02-17 19:04:18.000000000',
message: 'Uploaded patch set 2.',
});
instance = new GrReviewerUpdatesParser({
messages: _.times(500, makeRubbishMessage),

View File

@@ -1,7 +1,7 @@
<dom-module id="my-plugin">
<script>
Gerrit.install(plugin =>
plugin.registerStyleModule('app-theme', 'myplugin-app-theme');
plugin.registerStyleModule('app-theme', 'myplugin-app-theme')
);
</script>
</dom-module>

View File

@@ -18,10 +18,10 @@
window.Gerrit.hiddenscroll = undefined;
window.addEventListener('WebComponentsReady', function() {
var elem = document.createElement('div');
window.addEventListener('WebComponentsReady', () => {
const elem = document.createElement('div');
elem.setAttribute(
'style', 'width:100px;height:100px;overflow:scroll');
'style', 'width:100px;height:100px;overflow:scroll');
document.body.appendChild(elem);
window.Gerrit.hiddenscroll = elem.offsetWidth === elem.clientWidth;
elem.remove();