Don't allow "show 2 more" reviewers

Collapsing reviewers only starts to make sense when you collapse more
than 2 reviewers.

Change-Id: I3952e7b64da66616a8e5abfd7c9f03ca3289fdf7
This commit is contained in:
Ben Rohlfs
2019-11-13 12:07:48 -08:00
parent 280da3682b
commit 2f555d5444
2 changed files with 7 additions and 7 deletions

View File

@@ -185,10 +185,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);
});