@gitlab/ui 66.31.0 → 66.31.1

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
+ ## [66.31.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.31.0...v66.31.1) (2023-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlCollapsibleListbox:** Visibility of Reset button ([f71f767](https://gitlab.com/gitlab-org/gitlab-ui/commit/f71f767553a93237167c65772479e990c8913f93))
7
+
1
8
  # [66.31.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.30.0...v66.31.0) (2023-10-13)
2
9
 
3
10
 
@@ -408,10 +408,9 @@ var script = {
408
408
  if (!this.selected || this.selected.length === 0) {
409
409
  return false;
410
410
  }
411
- if (this.multiple) {
412
- return this.selected.length === this.flattenedOptions.length;
413
- }
414
- return Boolean(this.selected);
411
+
412
+ // only show reset button if show all button is not there
413
+ return !this.showSelectAllButton;
415
414
  },
416
415
  showSelectAllButton() {
417
416
  if (!this.showSelectAllButtonLabel) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ // Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 13 Oct 2023 10:34:59 GMT
3
+ // Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.31.0",
3
+ "version": "66.31.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -517,6 +517,18 @@ describe('GlCollapsibleListbox', () => {
517
517
  }
518
518
  );
519
519
 
520
+ it('shows the button if the label is provided and only one option is selected in multi select', () => {
521
+ buildWrapper({
522
+ headerText: 'Select assignee',
523
+ resetButtonLabel: 'Unassign',
524
+ items: mockOptions,
525
+ multiple: true,
526
+ selected: mockOptionsValues.slice(0, 1),
527
+ });
528
+
529
+ expect(findResetButton().exists()).toBe(true);
530
+ });
531
+
520
532
  it.each`
521
533
  description | props
522
534
  ${'multi-select'} | ${{ multiple: true, selected: [] }}
@@ -598,6 +610,7 @@ describe('GlCollapsibleListbox', () => {
598
610
  describe.each`
599
611
  multiple | resetVisible | selectAllVisible | selected
600
612
  ${false} | ${false} | ${false} | ${[]}
613
+ ${false} | ${false} | ${false} | ${undefined}
601
614
  ${true} | ${false} | ${true} | ${[]}
602
615
  `(
603
616
  'when label is provided, selection is empty and multiple option is $multiple',
@@ -623,6 +636,20 @@ describe('GlCollapsibleListbox', () => {
623
636
  }
624
637
  );
625
638
 
639
+ it('when label is provided and one option is selected in multiselect', () => {
640
+ buildWrapper({
641
+ headerText: 'Select assignee',
642
+ resetButtonLabel: 'Unassign',
643
+ showSelectAllButtonLabel: 'Select All',
644
+ items: mockOptions,
645
+ selected: mockOptionsValues.slice(0, 1),
646
+ multiple: true,
647
+ });
648
+
649
+ expect(findSelectAllButton().exists()).toBe(true);
650
+ expect(findResetButton().exists()).toBe(false);
651
+ });
652
+
626
653
  it('hides select all button if dropdown has no items', () => {
627
654
  buildWrapper({
628
655
  headerText: 'Select assignee',
@@ -419,10 +419,8 @@ export default {
419
419
  return false;
420
420
  }
421
421
 
422
- if (this.multiple) {
423
- return this.selected.length === this.flattenedOptions.length;
424
- }
425
- return Boolean(this.selected);
422
+ // only show reset button if show all button is not there
423
+ return !this.showSelectAllButton;
426
424
  },
427
425
  showSelectAllButton() {
428
426
  if (!this.showSelectAllButtonLabel) {
@@ -1,6 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
  import { nextTick } from 'vue';
3
- import { GlButton } from '../../../../index';
3
+ import GlButton from '../../button/button.vue';
4
4
  import { tabsButtonDefaults } from '../../../../utils/constants';
5
5
  import GlTab from '../tab/tab.vue';
6
6
  import GlTabs from './tabs.vue';
@@ -1,6 +1,6 @@
1
1
  import { nextTick } from 'vue';
2
2
  import { shallowMount } from '@vue/test-utils';
3
- import { GlDuoUserFeedback } from '../../../../../../index';
3
+ import GlDuoUserFeedback from '../../../user_feedback/user_feedback.vue';
4
4
  import {
5
5
  MOCK_USER_PROMPT_MESSAGE,
6
6
  MOCK_RESPONSE_MESSAGE,
@@ -1,5 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlIcon, GlLink } from '../../../../../../index';
2
+ import GlIcon from '../../../../../base/icon/icon.vue';
3
+ import GlLink from '../../../../../base/link/link.vue';
3
4
  import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
4
5
  import GlDuoChatMessageSources from './duo_chat_message_sources.vue';
5
6
 
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlButton } from '../../../../../../index';
2
+ import GlButton from '../../../../../base/button/button.vue';
3
3
  import GlDuoChatPredefinedPrompts from './duo_chat_predefined_prompts.vue';
4
4
 
5
5
  describe('GlDuoChatPredefinedPrompts', () => {
@@ -1,6 +1,6 @@
1
1
  import { nextTick } from 'vue';
2
2
  import { shallowMount } from '@vue/test-utils';
3
- import { GlButton } from '../../../../index';
3
+ import GlButton from '../../../base/button/button.vue';
4
4
  import FeedbackModal from './user_feedback_modal.vue';
5
5
  import UserFeedback, { i18n } from './user_feedback.vue';
6
6
 
@@ -1,4 +1,6 @@
1
- import { GlAlert, GlFormGroup, GlFormTextarea } from '../../../../index';
1
+ import GlAlert from '../../../base/alert/alert.vue';
2
+ import GlFormGroup from '../../../base/form/form_group/form_group.vue';
3
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
2
4
  import GlDuoUserFeedback from './user_feedback.vue';
3
5
  import readme from './user_feedback.md';
4
6
 
@@ -1,5 +1,8 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlModal, GlFormCheckboxGroup, GlFormCheckbox, GlFormTextarea } from '../../../../index';
2
+ import GlModal from '../../../base/modal/modal.vue';
3
+ import GlFormCheckbox from '../../../base/form/form_checkbox/form_checkbox.vue';
4
+ import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group.vue';
5
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
3
6
  import FeedbackModal, { feedbackOptions } from './user_feedback_modal.vue';
4
7
 
5
8
  const DummyComponent = {