@gitlab/ui 64.17.0 → 64.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "64.17.0",
3
+ "version": "64.18.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -118,7 +118,7 @@
118
118
  "babel-loader": "^8.0.5",
119
119
  "babel-plugin-require-context-hook": "^1.0.0",
120
120
  "bootstrap": "4.6.2",
121
- "cypress": "12.14.0",
121
+ "cypress": "12.16.0",
122
122
  "emoji-regex": "^10.0.0",
123
123
  "eslint": "8.42.0",
124
124
  "eslint-import-resolver-jest": "3.0.2",
@@ -485,31 +485,33 @@ 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
+ description | props
489
+ ${'multi-select'} | ${{ multiple: true, selected: mockOptionsValues }}
490
+ ${'single-select'} | ${{ multiple: false, selected: mockOptions[1].value }}
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 button if the label is provided and the selection is complete in $description mode',
493
+ ({ props }) => {
494
494
  buildWrapper({
495
495
  headerText: 'Select assignee',
496
496
  resetButtonLabel: 'Unassign',
497
- selected,
498
497
  items: mockOptions,
499
- multiple,
498
+ ...props,
500
499
  });
501
500
 
502
- expect(findResetButton().exists()).toBe(multiple);
501
+ expect(findResetButton().exists()).toBe(true);
503
502
  }
504
503
  );
505
504
 
506
- it('hides reset button if the label is provided and the selection is not complete', () => {
505
+ it.each`
506
+ description | props
507
+ ${'multi-select'} | ${{ multiple: true, selected: [] }}
508
+ ${'single-select'} | ${{ multiple: false, selected: [] }}
509
+ `('hides the button if the selection is empty in $description mode', ({ props }) => {
507
510
  buildWrapper({
508
511
  headerText: 'Select assignee',
509
512
  resetButtonLabel: 'Unassign',
510
- selected: mockOptions[1].value,
511
513
  items: mockOptions,
512
- multiple: true,
514
+ ...props,
513
515
  });
514
516
 
515
517
  expect(findResetButton().exists()).toBe(false);
@@ -527,22 +529,7 @@ describe('GlCollapsibleListbox', () => {
527
529
  expect(findResetButton().exists()).toBe(false);
528
530
  });
529
531
 
530
- it.each`
531
- description | props
532
- ${'multi-select'} | ${{ multiple: true, selected: [] }}
533
- ${'single-select'} | ${{ multiple: false, selected: null }}
534
- `('hides the button if the selection is empty in $description mode', ({ props }) => {
535
- buildWrapper({
536
- headerText: 'Select assignee',
537
- resetButtonLabel: 'Unassign',
538
- items: mockOptions,
539
- ...props,
540
- });
541
-
542
- expect(findResetButton().exists()).toBe(false);
543
- });
544
-
545
- it('on click, emits the reset event does not and call closeAndFocus() for multiple mode', () => {
532
+ it('on click, emits the `reset` event but does not call `closeAndFocus`', () => {
546
533
  buildWrapper({
547
534
  headerText: 'Select assignee',
548
535
  resetButtonLabel: 'Unassign',
@@ -572,24 +559,31 @@ describe('GlCollapsibleListbox', () => {
572
559
  expect(wrapper).toHaveLoggedVueErrors();
573
560
  });
574
561
 
575
- it.each`
576
- multiple | resetVisible | selectAllVisible
577
- ${false} | ${false} | ${false}
578
- ${true} | ${false} | ${true}
562
+ describe.each`
563
+ multiple | resetVisible | selectAllVisible | selected
564
+ ${false} | ${false} | ${false} | ${[]}
565
+ ${true} | ${false} | ${true} | ${[]}
579
566
  `(
580
- 'shows the select all button if the label is provided and the selection is empty and multiple option is $multiple',
581
- ({ multiple, resetVisible, selectAllVisible }) => {
582
- buildWrapper({
583
- headerText: 'Select assignee',
584
- resetButtonLabel: 'Unassign',
585
- showSelectAllButtonLabel: 'Select All',
586
- selected: [],
587
- items: mockOptions,
588
- multiple,
567
+ 'when label is provided, selection is empty and multiple option is $multiple',
568
+ ({ multiple, resetVisible, selectAllVisible, selected }) => {
569
+ beforeEach(() => {
570
+ buildWrapper({
571
+ headerText: 'Select assignee',
572
+ resetButtonLabel: 'Unassign',
573
+ showSelectAllButtonLabel: 'Select All',
574
+ items: mockOptions,
575
+ selected,
576
+ multiple,
577
+ });
578
+ });
579
+
580
+ it(`${selectAllVisible ? 'shows' : 'does not show'} the Select all button`, () => {
581
+ expect(findSelectAllButton().exists()).toBe(selectAllVisible);
589
582
  });
590
583
 
591
- expect(findResetButton().exists()).toBe(resetVisible);
592
- expect(findSelectAllButton().exists()).toBe(selectAllVisible);
584
+ it(`${resetVisible ? 'shows' : 'does not show'} the Reset button`, () => {
585
+ expect(findResetButton().exists()).toBe(resetVisible);
586
+ });
593
587
  }
594
588
  );
595
589
 
@@ -644,7 +638,7 @@ describe('GlCollapsibleListbox', () => {
644
638
  expect(findSelectAllButton().text()).toBe('Select All');
645
639
  });
646
640
 
647
- it('on click, emits the select-all event and calls closeAndFocus()', () => {
641
+ it('on click, emits the `select-all` event and calls `closeAndFocus`', () => {
648
642
  buildWrapper({
649
643
  headerText: 'Select assignee',
650
644
  resetButtonLabel: 'Unassign',
@@ -398,10 +398,6 @@ export default {
398
398
  return false;
399
399
  }
400
400
 
401
- if (!this.multiple) {
402
- return false;
403
- }
404
-
405
401
  /**
406
402
  * if dropdown has no items
407
403
  * reset all should be hidden
@@ -410,6 +406,13 @@ export default {
410
406
  return false;
411
407
  }
412
408
 
409
+ /**
410
+ * hide if no selection
411
+ */
412
+ if (this.selected.length === 0) {
413
+ return false;
414
+ }
415
+
413
416
  if (this.multiple) {
414
417
  return this.selected.length === this.items.length;
415
418
  }
@@ -1149,6 +1149,14 @@
1149
1149
  border-left-color: transparent !important;
1150
1150
  }
1151
1151
 
1152
+ .gl-border-gray-10 {
1153
+ border-color: $gray-10;
1154
+ }
1155
+
1156
+ .gl-border-gray-10\! {
1157
+ border-color: $gray-10 !important;
1158
+ }
1159
+
1152
1160
  .gl-border-gray-50 {
1153
1161
  border-color: $gray-50;
1154
1162
  }
@@ -119,6 +119,10 @@
119
119
  border-left-color: transparent;
120
120
  }
121
121
 
122
+ @mixin gl-border-gray-10 {
123
+ border-color: $gray-10;
124
+ }
125
+
122
126
  @mixin gl-border-gray-50 {
123
127
  border-color: $gray-50;
124
128
  }