Merge "Don't allow "show 2 more" reviewers" into stable-3.1

This commit is contained in:
David Pursehouse
2019-11-14 06:18:52 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 7 deletions

View File

@@ -186,10 +186,10 @@
return reviewer._account_id != owner._account_id;
});
// If there is one more than the max reviewers, don't show the 'show
// more' button, because it takes up just as much space.
// If there is one or two more than the max reviewers, don't show the
// 'show more' button, because it takes up just as much space.
if (this.maxReviewersDisplayed &&
this._reviewers.length > this.maxReviewersDisplayed + 1) {
this._reviewers.length > this.maxReviewersDisplayed + 2) {
this._displayedReviewers =
this._reviewers.slice(0, this.maxReviewersDisplayed);
} else {

View File

@@ -214,10 +214,10 @@ limitations under the License.
assert.isTrue(element.$$('.hiddenReviewers').hidden);
});
test('show all reviewers button with 7 reviewers', () => {
test('show all reviewers button with 8 reviewers', () => {
const reviewers = [];
element.maxReviewersDisplayed = 5;
for (let i = 0; i < 7; i++) {
for (let i = 0; i < 8; i++) {
reviewers.push(
{email: i+'reviewer@google.com', name: 'reviewer-' + i});
}
@@ -231,9 +231,9 @@ limitations under the License.
CC: reviewers,
},
};
assert.equal(element._hiddenReviewerCount, 2);
assert.equal(element._hiddenReviewerCount, 3);
assert.equal(element._displayedReviewers.length, 5);
assert.equal(element._reviewers.length, 7);
assert.equal(element._reviewers.length, 8);
assert.isFalse(element.$$('.hiddenReviewers').hidden);
});