Commit 539996f7 authored by Clement Ho's avatar Clement Ho

Merge branch '33609-hide-pagination' into 'master'

Do not show Vue pagination if only one page

Closes #33609

See merge request gitlab-org/gitlab-ce!15999
parents 4eb5c3a2 e1f5c2b1
......@@ -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"
......
---
title: Disable Vue pagination when only one page of content is available
merge_request: 15999
author: Mario de la Ossa
type: fixed
......@@ -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({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment