@gitlab/ui 64.12.0 → 64.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [64.13.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.12.0...v64.13.0) (2023-06-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlKeysetPagination:** hides component when hasPreviousPage & hasNextPage is falsy ([93dbdfc](https://gitlab.com/gitlab-org/gitlab-ui/commit/93dbdfc3f94cfdd407e17316c3c329d1180786a0))
7
+
1
8
  # [64.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.11.1...v64.12.0) (2023-06-19)
2
9
 
3
10
 
@@ -104,6 +104,11 @@ var script = {
104
104
  required: false,
105
105
  default: false
106
106
  }
107
+ },
108
+ computed: {
109
+ isVisible() {
110
+ return this.hasPreviousPage || this.hasNextPage;
111
+ }
107
112
  }
108
113
  };
109
114
 
@@ -111,7 +116,7 @@ var script = {
111
116
  const __vue_script__ = script;
112
117
 
113
118
  /* template */
114
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"gl-pagination",attrs:{"aria-label":_vm.navigationLabel}},[_c('gl-button-group',_vm._g(_vm._b({staticClass:"gl-keyset-pagination"},'gl-button-group',_vm.$attrs,false),_vm.$listeners),[_c('gl-button',{attrs:{"href":_vm.prevButtonLink,"disabled":_vm.disabled || !_vm.hasPreviousPage,"data-testid":"prevButton"},on:{"click":function($event){return _vm.$emit('prev', _vm.startCursor)}}},[_vm._t("previous-button-content",function(){return [_c('div',{staticClass:"gl-display-flex gl-align-center"},[_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v("\n "+_vm._s(_vm.prevText)+"\n ")],1)]})],2),_vm._v(" "),_c('gl-button',{attrs:{"href":_vm.nextButtonLink,"disabled":_vm.disabled || !_vm.hasNextPage,"data-testid":"nextButton"},on:{"click":function($event){return _vm.$emit('next', _vm.endCursor)}}},[_vm._t("next-button-content",function(){return [_c('div',{staticClass:"gl-display-flex gl-align-center"},[_vm._v("\n "+_vm._s(_vm.nextText)+"\n "),_c('gl-icon',{attrs:{"name":"chevron-right"}})],1)]})],2)],1)],1)};
119
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.isVisible)?_c('nav',{staticClass:"gl-pagination",attrs:{"aria-label":_vm.navigationLabel}},[_c('gl-button-group',_vm._g(_vm._b({staticClass:"gl-keyset-pagination"},'gl-button-group',_vm.$attrs,false),_vm.$listeners),[_c('gl-button',{attrs:{"href":_vm.prevButtonLink,"disabled":_vm.disabled || !_vm.hasPreviousPage,"data-testid":"prevButton"},on:{"click":function($event){return _vm.$emit('prev', _vm.startCursor)}}},[_vm._t("previous-button-content",function(){return [_c('div',{staticClass:"gl-display-flex gl-align-center"},[_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v("\n "+_vm._s(_vm.prevText)+"\n ")],1)]})],2),_vm._v(" "),_c('gl-button',{attrs:{"href":_vm.nextButtonLink,"disabled":_vm.disabled || !_vm.hasNextPage,"data-testid":"nextButton"},on:{"click":function($event){return _vm.$emit('next', _vm.endCursor)}}},[_vm._t("next-button-content",function(){return [_c('div',{staticClass:"gl-display-flex gl-align-center"},[_vm._v("\n "+_vm._s(_vm.nextText)+"\n "),_c('gl-icon',{attrs:{"name":"chevron-right"}})],1)]})],2)],1)],1):_vm._e()};
115
120
  var __vue_staticRenderFns__ = [];
116
121
 
117
122
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "64.12.0",
3
+ "version": "64.13.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -12,7 +12,11 @@ describe('GlKeysetPagination', () => {
12
12
 
13
13
  const createComponent = (props = {}, scopedSlots = {}) => {
14
14
  wrapper = mount(GlKeysetPagination, {
15
- propsData: props,
15
+ propsData: {
16
+ hasPreviousPage: true,
17
+ hasNextPage: true,
18
+ ...props,
19
+ },
16
20
  scopedSlots,
17
21
  });
18
22
  };
@@ -56,14 +60,14 @@ describe('GlKeysetPagination', () => {
56
60
  });
57
61
  });
58
62
 
59
- describe('without any props', () => {
63
+ describe('when both hasNextPage & hasPreviousPage is false', () => {
60
64
  beforeEach(() => {
61
- createComponent();
65
+ createComponent({ hasNextPage: false, hasPreviousPage: false });
62
66
  });
63
67
 
64
- it('renders with two disabled buttons', () => {
65
- expectPrevButtonToBeDisabled();
66
- expectNextButtonToBeDisabled();
68
+ it('does not render pagination', () => {
69
+ expect(findPrevButton().exists()).toBe(false);
70
+ expect(findNextButton().exists()).toBe(false);
67
71
  });
68
72
  });
69
73
 
@@ -105,11 +105,16 @@ export default {
105
105
  default: false,
106
106
  },
107
107
  },
108
+ computed: {
109
+ isVisible() {
110
+ return this.hasPreviousPage || this.hasNextPage;
111
+ },
112
+ },
108
113
  };
109
114
  </script>
110
115
 
111
116
  <template>
112
- <nav class="gl-pagination" :aria-label="navigationLabel">
117
+ <nav v-if="isVisible" class="gl-pagination" :aria-label="navigationLabel">
113
118
  <gl-button-group class="gl-keyset-pagination" v-bind="$attrs" v-on="$listeners">
114
119
  <gl-button
115
120
  :href="prevButtonLink"