@gitlab/ui 64.10.1 → 64.10.2
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 +7 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +2 -2
- package/dist/components/base/new_dropdowns/listbox/mock_data.js +7 -1
- package/package.json +3 -3
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +36 -10
- package/src/components/base/new_dropdowns/listbox/listbox.vue +2 -2
- package/src/components/base/new_dropdowns/listbox/mock_data.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [64.10.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.10.1...v64.10.2) (2023-06-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlCollapsibleListbox:** reverse clear all logic ([270777b](https://gitlab.com/gitlab-org/gitlab-ui/commit/270777bd74cfa2e76eff594ec1612ea408b4372f))
|
|
7
|
+
|
|
1
8
|
## [64.10.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.10.0...v64.10.1) (2023-06-14)
|
|
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
|
|
402
|
+
return this.selected.length === this.items.length;
|
|
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
|
|
421
|
+
return this.selected.length !== this.items.length;
|
|
422
422
|
},
|
|
423
423
|
showIntersectionObserver() {
|
|
424
424
|
return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
|
|
@@ -35,6 +35,12 @@ 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
|
+
});
|
|
38
44
|
const mockGroups = [{
|
|
39
45
|
text: 'Branches',
|
|
40
46
|
options: [{
|
|
@@ -103,4 +109,4 @@ const mockUsers = [{
|
|
|
103
109
|
icon: 'bin'
|
|
104
110
|
}];
|
|
105
111
|
|
|
106
|
-
export { mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockUsers };
|
|
112
|
+
export { mockGroups, mockGroupsWithTextSrOnly, mockOptions, mockOptionsValues, mockUsers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "64.10.
|
|
3
|
+
"version": "64.10.2",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
"storybook": "7.0.20",
|
|
157
157
|
"storybook-dark-mode": "3.0.0",
|
|
158
158
|
"stylelint": "14.9.1",
|
|
159
|
-
"stylelint-config-prettier": "9.0.
|
|
160
|
-
"stylelint-prettier": "
|
|
159
|
+
"stylelint-config-prettier": "^9.0.5",
|
|
160
|
+
"stylelint-prettier": "3.0.0",
|
|
161
161
|
"vue": "2.7.14",
|
|
162
162
|
"vue-loader": "^15.8.3",
|
|
163
163
|
"vue-loader-vue3": "npm:vue-loader@17",
|
|
@@ -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, mockGroups, mockGroupsWithTextSrOnly } from './mock_data';
|
|
21
|
+
import { mockOptions, mockOptionsValues, 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
|
-
multiple
|
|
489
|
-
${true}
|
|
490
|
-
${false}
|
|
488
|
+
title | multiple | selected
|
|
489
|
+
${'shows'} | ${true} | ${mockOptionsValues}
|
|
490
|
+
${'hides'} | ${false} | ${mockOptions[1].value}
|
|
491
491
|
`(
|
|
492
|
-
'
|
|
493
|
-
({ multiple }) => {
|
|
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 }) => {
|
|
494
494
|
buildWrapper({
|
|
495
495
|
headerText: 'Select assignee',
|
|
496
496
|
resetButtonLabel: 'Unassign',
|
|
497
|
-
selected
|
|
497
|
+
selected,
|
|
498
498
|
items: mockOptions,
|
|
499
499
|
multiple,
|
|
500
500
|
});
|
|
@@ -503,7 +503,7 @@ describe('GlCollapsibleListbox', () => {
|
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
505
|
|
|
506
|
-
it('
|
|
506
|
+
it('hides reset button if the label is provided and the selection is not complete', () => {
|
|
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().
|
|
515
|
+
expect(findResetButton().exists()).toBe(false);
|
|
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:
|
|
549
|
+
selected: mockOptionsValues,
|
|
550
550
|
items: mockOptions,
|
|
551
551
|
multiple: true,
|
|
552
552
|
});
|
|
@@ -605,6 +605,32 @@ 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
|
+
|
|
608
634
|
it('has the label text "Select All" if the label is provided and the selection is empty', () => {
|
|
609
635
|
buildWrapper({
|
|
610
636
|
headerText: 'Select assignee',
|
|
@@ -411,7 +411,7 @@ export default {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
if (this.multiple) {
|
|
414
|
-
return this.selected.length
|
|
414
|
+
return this.selected.length === this.items.length;
|
|
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
|
|
435
|
+
return this.selected.length !== this.items.length;
|
|
436
436
|
},
|
|
437
437
|
showIntersectionObserver() {
|
|
438
438
|
return this.infiniteScroll && !this.infiniteScrollLoading && !this.loading && !this.searching;
|