Merge "Fixes bug in gr-account-list#_filterSuggestion"
This commit is contained in:
commit
cc16797b3c
@ -91,9 +91,12 @@
|
||||
},
|
||||
|
||||
_filterSuggestion: function(reviewer) {
|
||||
// If the reviewer is already on the change.
|
||||
if (!this.$.entry.notOwnerOrReviewer(reviewer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the reviewer is in the pending list to be added to the change.
|
||||
for (var i = 0; i < this.accounts.length; i++) {
|
||||
var account = this.accounts[i];
|
||||
if (!account._pendingAdd) {
|
||||
@ -104,10 +107,11 @@
|
||||
return false;
|
||||
}
|
||||
if (reviewer.account && !account._group &&
|
||||
account._account_id === account._account_id) {
|
||||
reviewer.account._account_id === account._account_id) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -232,5 +232,57 @@ limitations under the License.
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
suite('_filterSuggestion', function() {
|
||||
var notOwnerOrReviewerStub;
|
||||
|
||||
setup(function() {
|
||||
notOwnerOrReviewerStub = sinon.stub(element.$.entry,
|
||||
'notOwnerOrReviewer');
|
||||
});
|
||||
|
||||
teardown(function() {
|
||||
notOwnerOrReviewerStub.restore();
|
||||
});
|
||||
|
||||
|
||||
test('_filterSuggestion owner or reviewer', function() {
|
||||
notOwnerOrReviewerStub.returns(false);
|
||||
var reviewer = {account: makeAccount()};
|
||||
|
||||
var result = element._filterSuggestion(reviewer);
|
||||
|
||||
assert.isFalse(result);
|
||||
});
|
||||
|
||||
test('_filterSuggestion new', function() {
|
||||
notOwnerOrReviewerStub.returns(true);
|
||||
var reviewer = {account: makeAccount()};
|
||||
|
||||
var result = element._filterSuggestion(reviewer);
|
||||
|
||||
assert.isTrue(result);
|
||||
});
|
||||
|
||||
test('_filterSuggestion pending', function() {
|
||||
notOwnerOrReviewerStub.returns(true);
|
||||
var reviewer = {account: element.accounts[1]};
|
||||
element.accounts[1]._pendingAdd = true;
|
||||
|
||||
var result = element._filterSuggestion(reviewer);
|
||||
|
||||
assert.isFalse(result);
|
||||
});
|
||||
|
||||
test('_filterSuggestion new with pending', function() {
|
||||
notOwnerOrReviewerStub.returns(true);
|
||||
var reviewer = {account: makeAccount()};
|
||||
element.accounts[1]._pendingAdd = true;
|
||||
|
||||
var result = element._filterSuggestion(reviewer);
|
||||
|
||||
assert.isTrue(result);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user