Merge "Don't show next arrow when there are not more changes on next page"
This commit is contained in:
commit
de9f76de42
@ -62,7 +62,7 @@ limitations under the License.
|
||||
hidden$="[[_hidePrevArrow(_offset)]]" hidden>← Prev</a>
|
||||
<a id="nextArrow"
|
||||
href$="[[_computeNavLink(_query, _offset, 1, _changesPerPage)]]"
|
||||
hidden$="[[_hideNextArrow(_loading, _changesPerPage)]]" hidden>
|
||||
hidden$="[[_hideNextArrow(_loading)]]" hidden>
|
||||
Next →</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -134,8 +134,9 @@
|
||||
return offset === 0;
|
||||
},
|
||||
|
||||
_hideNextArrow: function(loading, changesPerPage) {
|
||||
return loading || !this._changes || this._changes.length < changesPerPage;
|
||||
_hideNextArrow: function(loading) {
|
||||
return loading || !this._changes || !this._changes.length ||
|
||||
!this._changes[this._changes.length - 1]._more_changes;
|
||||
},
|
||||
|
||||
_handleNextPage: function() {
|
||||
|
@ -86,16 +86,21 @@ limitations under the License.
|
||||
|
||||
test('_hideNextArrow', function() {
|
||||
var loading = true;
|
||||
var changesPerPage = 25;
|
||||
assert.isTrue(element._hideNextArrow(loading, changesPerPage));
|
||||
assert.isTrue(element._hideNextArrow(loading));
|
||||
loading = false;
|
||||
assert.isTrue(element._hideNextArrow(loading, changesPerPage));
|
||||
assert.isTrue(element._hideNextArrow(loading));
|
||||
element._changes = [];
|
||||
assert.isTrue(element._hideNextArrow(loading));
|
||||
element._changes =
|
||||
Array.apply(null, Array(5)).map(Number.prototype.valueOf, 0);
|
||||
assert.isTrue(element._hideNextArrow(loading, changesPerPage));
|
||||
Array.apply(null, Array(5)).map(Object.prototype.valueOf, {});
|
||||
assert.isTrue(element._hideNextArrow(loading));
|
||||
element._changes =
|
||||
Array.apply(null, Array(25)).map(Number.prototype.valueOf, 0);
|
||||
assert.isFalse(element._hideNextArrow(loading, changesPerPage));
|
||||
Array.apply(null, Array(25)).map(Object.prototype.valueOf,
|
||||
{_more_changes: true});
|
||||
assert.isFalse(element._hideNextArrow(loading));
|
||||
element._changes =
|
||||
Array.apply(null, Array(25)).map(Object.prototype.valueOf, {});
|
||||
assert.isTrue(element._hideNextArrow(loading));
|
||||
});
|
||||
|
||||
test('_handleNextPage', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user