Fix gr-account-list test failure in Firefox
Also fixes lint error in gr-rest-api-interface. Change-Id: I3211018091fba5f471e0b62653eb348306c670e1
This commit is contained in:
@@ -48,6 +48,7 @@ limitations under the License.
|
|||||||
|
|
||||||
var existingReviewer1;
|
var existingReviewer1;
|
||||||
var existingReviewer2;
|
var existingReviewer2;
|
||||||
|
var sandbox;
|
||||||
var element;
|
var element;
|
||||||
|
|
||||||
function getChips() {
|
function getChips() {
|
||||||
@@ -55,6 +56,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup(function() {
|
setup(function() {
|
||||||
|
sandbox = sinon.sandbox.create();
|
||||||
existingReviewer1 = makeAccount();
|
existingReviewer1 = makeAccount();
|
||||||
existingReviewer2 = makeAccount();
|
existingReviewer2 = makeAccount();
|
||||||
|
|
||||||
@@ -65,6 +67,10 @@ limitations under the License.
|
|||||||
element.accounts = [existingReviewer1, existingReviewer2];
|
element.accounts = [existingReviewer1, existingReviewer2];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
teardown(function() {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
test('account entry only appears when editable', function() {
|
test('account entry only appears when editable', function() {
|
||||||
element.readonly = false;
|
element.readonly = false;
|
||||||
assert.isFalse(element.$.entry.hasAttribute('hidden'));
|
assert.isFalse(element.$.entry.hasAttribute('hidden'));
|
||||||
@@ -230,52 +236,42 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
|
|
||||||
suite('keyboard interactions', function() {
|
suite('keyboard interactions', function() {
|
||||||
var sandbox;
|
|
||||||
setup(function() {
|
|
||||||
sandbox = sinon.sandbox.create();
|
|
||||||
});
|
|
||||||
|
|
||||||
teardown(function() {
|
test('backspace at text input start removes last account', function() {
|
||||||
sandbox.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('backspace from input removes account iff cursor is in start pos',
|
|
||||||
function(done) {
|
|
||||||
var input = element.$.entry.$.input;
|
var input = element.$.entry.$.input;
|
||||||
sandbox.stub(element.$.entry, '_getReviewerSuggestions');
|
sandbox.stub(element.$.entry, '_getReviewerSuggestions');
|
||||||
sandbox.stub(input, '_updateSuggestions');
|
sandbox.stub(input, '_updateSuggestions');
|
||||||
|
// Next line is a workaround for Firefix not moving cursor
|
||||||
|
// on input field update
|
||||||
|
assert.equal(input.$.input.selectionStart, 0);
|
||||||
input.text = 'test';
|
input.text = 'test';
|
||||||
MockInteractions.focus(input.$.input);
|
MockInteractions.focus(input.$.input);
|
||||||
flush(function() {
|
flushAsynchronousOperations();
|
||||||
assert.equal(element.accounts.length, 2);
|
assert.equal(element.accounts.length, 2);
|
||||||
MockInteractions.pressAndReleaseKeyOn(input.$.input, 8); // Backspace
|
MockInteractions.pressAndReleaseKeyOn(input.$.input, 8); // Backspace
|
||||||
assert.equal(element.accounts.length, 2);
|
assert.equal(element.accounts.length, 2);
|
||||||
input.text = '';
|
input.text = '';
|
||||||
MockInteractions.pressAndReleaseKeyOn(input.$.input, 8); // Backspace
|
MockInteractions.pressAndReleaseKeyOn(input.$.input, 8); // Backspace
|
||||||
assert.equal(element.accounts.length, 1);
|
assert.equal(element.accounts.length, 1);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('arrow key navigation', function(done) {
|
test('arrow key navigation', function() {
|
||||||
var input = element.$.entry.$.input;
|
var input = element.$.entry.$.input;
|
||||||
input.text = '';
|
input.text = '';
|
||||||
element.accounts = [makeAccount(), makeAccount()];
|
element.accounts = [makeAccount(), makeAccount()];
|
||||||
MockInteractions.focus(input.$.input);
|
MockInteractions.focus(input.$.input);
|
||||||
flush(function() {
|
flushAsynchronousOperations();
|
||||||
var chips = element.accountChips;
|
var chips = element.accountChips;
|
||||||
var chipsOneSpy = sandbox.spy(chips[1], 'focus');
|
var chipsOneSpy = sandbox.spy(chips[1], 'focus');
|
||||||
MockInteractions.pressAndReleaseKeyOn(input.$.input, 37); // Left
|
MockInteractions.pressAndReleaseKeyOn(input.$.input, 37); // Left
|
||||||
assert.isTrue(chipsOneSpy.called);
|
assert.isTrue(chipsOneSpy.called);
|
||||||
var chipsZeroSpy = sandbox.spy(chips[0], 'focus');
|
var chipsZeroSpy = sandbox.spy(chips[0], 'focus');
|
||||||
MockInteractions.pressAndReleaseKeyOn(chips[1], 37); // Left
|
MockInteractions.pressAndReleaseKeyOn(chips[1], 37); // Left
|
||||||
assert.isTrue(chipsZeroSpy.called);
|
assert.isTrue(chipsZeroSpy.called);
|
||||||
MockInteractions.pressAndReleaseKeyOn(chips[0], 37); // Left
|
MockInteractions.pressAndReleaseKeyOn(chips[0], 37); // Left
|
||||||
assert.isTrue(chipsZeroSpy.calledOnce);
|
assert.isTrue(chipsZeroSpy.calledOnce);
|
||||||
MockInteractions.pressAndReleaseKeyOn(chips[0], 39); // Right
|
MockInteractions.pressAndReleaseKeyOn(chips[0], 39); // Right
|
||||||
assert.isTrue(chipsOneSpy.calledTwice);
|
assert.isTrue(chipsOneSpy.calledTwice);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('delete', function(done) {
|
test('delete', function(done) {
|
||||||
|
@@ -373,7 +373,8 @@
|
|||||||
q: [
|
q: [
|
||||||
'is:open owner:self',
|
'is:open owner:self',
|
||||||
'is:open ((reviewer:self -owner:self -star:ignore) OR assignee:self)',
|
'is:open ((reviewer:self -owner:self -star:ignore) OR assignee:self)',
|
||||||
'is:closed (owner:self OR reviewer:self OR assignee:self) -age:4w limit:10',
|
'is:closed (owner:self OR reviewer:self OR assignee:self) -age:4w ' +
|
||||||
|
'limit:10',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
return this.fetchJSON('/changes/', null, null, params);
|
return this.fetchJSON('/changes/', null, null, params);
|
||||||
|
Reference in New Issue
Block a user