Do not show Vue pagination if only one page

This commit is contained in:
Mario de la Ossa 2017-12-18 17:08:28 -06:00
parent f7a9ced235
commit e1f5c2b194
No known key found for this signature in database
GPG Key ID: 20CA8F4C6A20761B
3 changed files with 28 additions and 1 deletions

View File

@ -122,11 +122,17 @@ export default {
return items;
},
showPagination() {
return this.pageInfo.totalPages > 1;
},
},
};
</script>
<template>
<div class="gl-pagination">
<div
v-if="showPagination"
class="gl-pagination"
>
<ul class="pagination clearfix">
<li
v-for="item in getItems"

View File

@ -0,0 +1,5 @@
---
title: Disable Vue pagination when only one page of content is available
merge_request: 15999
author: Mario de la Ossa
type: fixed

View File

@ -19,6 +19,22 @@ describe('Pagination component', () => {
});
describe('render', () => {
it('should not render anything', () => {
component = mountComponet({
pageInfo: {
nextPage: 1,
page: 1,
perPage: 20,
previousPage: null,
total: 15,
totalPages: 1,
},
change: spy,
});
expect(component.$el.innerHTML).not.toBeDefined();
});
describe('prev button', () => {
it('should be disabled and non clickable', () => {
component = mountComponet({