@gitlab/ui 64.11.0 → 64.11.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
+ ## [64.11.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.11.0...v64.11.1) (2023-06-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlCollapsibleListbox:** revert to previous clear all logic ([a9ef6d6](https://gitlab.com/gitlab-org/gitlab-ui/commit/a9ef6d6ce69b470be3d2f0c1471d164e0eea24bd))
7
+
1
8
  # [64.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.10.2...v64.11.0) (2023-06-16)
2
9
 
3
10
 
@@ -399,7 +399,7 @@ var script = {
399
399
  return false;
400
400
  }
401
401
  if (this.multiple) {
402
- return this.selected.length === this.items.length;
402
+ return this.selected.length > 0;
403
403
  }
404
404
  return Boolean(this.selected);
405
405
  },
@@ -418,7 +418,7 @@ var script = {
418
418
  if (!this.hasItems) {
419
419
  return false;
420
420
  }
421
- return this.selected.length !== this.items.length;
421
+ return this.selected.length === 0;
422
422
  },
423
423
  showIntersectionObserver() {
424
424
  return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
@@ -35,12 +35,6 @@ const mockOptions = [{
35
35
  value: 'sup',
36
36
  text: 'Support'
37
37
  }];
38
- const mockOptionsValues = mockOptions.map(_ref => {
39
- let {
40
- value
41
- } = _ref;
42
- return value;
43
- });
44
38
  const mockGroups = [{
45
39
  text: 'Branches',
46
40
  options: [{
@@ -109,4 +103,4 @@ const mockUsers = [{
109
103
  icon: 'bin'
110
104
  }];
111
105
 
112
- export { mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockOptionsValues, mockUsers };
106
+ export { mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockUsers };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "64.11.0",
3
+ "version": "64.11.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@ import GlIntersectionObserver from '../../../utilities/intersection_observer/int
18
18
  import GlCollapsibleListbox, { ITEM_SELECTOR } from './listbox.vue';
19
19
  import GlListboxItem from './listbox_item.vue';
20
20
  import GlListboxGroup from './listbox_group.vue';
21
- import { mockOptions, mockOptionsValues, mockGroups, mockGroupsWithTextSrOnly } from './mock_data';
21
+ import { mockOptions, mockGroups, mockGroupsWithTextSrOnly } from './mock_data';
22
22
 
23
23
  jest.mock('@floating-ui/dom');
24
24
  autoUpdate.mockImplementation(() => {
@@ -485,16 +485,16 @@ describe('GlCollapsibleListbox', () => {
485
485
  });
486
486
 
487
487
  it.each`
488
- title | multiple | selected
489
- ${'shows'} | ${true} | ${mockOptionsValues}
490
- ${'hides'} | ${false} | ${mockOptions[1].value}
488
+ multiple
489
+ ${true}
490
+ ${false}
491
491
  `(
492
- '$title the reset button if the label is provided and the selection is complete and mode if multiple mode is $multiple',
493
- ({ multiple, selected }) => {
492
+ 'shows the reset button if the label is provided and the selection is not empty and mode if multiple mode is $multiple',
493
+ ({ multiple }) => {
494
494
  buildWrapper({
495
495
  headerText: 'Select assignee',
496
496
  resetButtonLabel: 'Unassign',
497
- selected,
497
+ selected: mockOptions[1].value,
498
498
  items: mockOptions,
499
499
  multiple,
500
500
  });
@@ -503,7 +503,7 @@ describe('GlCollapsibleListbox', () => {
503
503
  }
504
504
  );
505
505
 
506
- it('hides reset button if the label is provided and the selection is not complete', () => {
506
+ it('shows the reset button if the label is provided and the selection is not empty', () => {
507
507
  buildWrapper({
508
508
  headerText: 'Select assignee',
509
509
  resetButtonLabel: 'Unassign',
@@ -512,7 +512,7 @@ describe('GlCollapsibleListbox', () => {
512
512
  multiple: true,
513
513
  });
514
514
 
515
- expect(findResetButton().exists()).toBe(false);
515
+ expect(findResetButton().text()).toBe('Unassign');
516
516
  });
517
517
 
518
518
  it('hides reset button if dropdown has no items', () => {
@@ -546,7 +546,7 @@ describe('GlCollapsibleListbox', () => {
546
546
  buildWrapper({
547
547
  headerText: 'Select assignee',
548
548
  resetButtonLabel: 'Unassign',
549
- selected: mockOptionsValues,
549
+ selected: mockOptions[1].value,
550
550
  items: mockOptions,
551
551
  multiple: true,
552
552
  });
@@ -605,32 +605,6 @@ describe('GlCollapsibleListbox', () => {
605
605
  expect(findSelectAllButton().exists()).toBe(false);
606
606
  });
607
607
 
608
- it('hides select all button if all items are selected', () => {
609
- buildWrapper({
610
- headerText: 'Select assignee',
611
- resetButtonLabel: 'Unassign',
612
- showSelectAllButtonLabel: 'Select All',
613
- selected: mockOptionsValues,
614
- items: mockOptions,
615
- multiple: true,
616
- });
617
-
618
- expect(findSelectAllButton().exists()).toBe(false);
619
- });
620
-
621
- it('has the label text "Select All" if the label is provided and some items are selected', () => {
622
- buildWrapper({
623
- headerText: 'Select assignee',
624
- resetButtonLabel: 'Unassign',
625
- showSelectAllButtonLabel: 'Select All',
626
- selected: [mockOptions[1].value],
627
- items: mockOptions,
628
- multiple: true,
629
- });
630
-
631
- expect(findSelectAllButton().text()).toBe('Select All');
632
- });
633
-
634
608
  it('has the label text "Select All" if the label is provided and the selection is empty', () => {
635
609
  buildWrapper({
636
610
  headerText: 'Select assignee',
@@ -411,7 +411,7 @@ export default {
411
411
  }
412
412
 
413
413
  if (this.multiple) {
414
- return this.selected.length === this.items.length;
414
+ return this.selected.length > 0;
415
415
  }
416
416
  return Boolean(this.selected);
417
417
  },
@@ -432,7 +432,7 @@ export default {
432
432
  return false;
433
433
  }
434
434
 
435
- return this.selected.length !== this.items.length;
435
+ return this.selected.length === 0;
436
436
  },
437
437
  showIntersectionObserver() {
438
438
  return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
@@ -49,8 +49,6 @@ export const mockOptions = [
49
49
  },
50
50
  ];
51
51
 
52
- export const mockOptionsValues = mockOptions.map(({ value }) => value);
53
-
54
52
  export const mockGroups = [
55
53
  {
56
54
  text: 'Branches',