@gitlab/ui 56.1.0 → 56.1.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
+ ## [56.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.1.0...v56.1.1) (2023-02-20)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * **GlCollapsibleDropdown:** avoid unnecessary loop ([2d13b6e](https://gitlab.com/gitlab-org/gitlab-ui/commit/2d13b6ecc80154e70a4d637974b8434d50e53928))
7
+
1
8
  # [56.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v56.0.1...v56.1.0) (2023-02-20)
2
9
 
3
10
 
@@ -25,7 +25,11 @@ const hasOnlyListItems = _ref => {
25
25
  return false;
26
26
  }
27
27
  const nodes = defaultSlot();
28
- return Array.isArray(nodes) && nodes.filter(vNode => vNode.tag).length && (nodes.filter(vNode => vNode.tag).every(isValidSlotTagVue2) || nodes.filter(vNode => vNode.tag).every(isValidSlotTag));
28
+ if (!Array.isArray(nodes)) {
29
+ return false;
30
+ }
31
+ const tags = nodes.filter(vNode => vNode.tag);
32
+ return tags.length && tags.every(tag => isValidSlotTag(tag) || isValidSlotTagVue2(tag));
29
33
  };
30
34
 
31
35
  export { hasOnlyListItems, isGroup, isItem, itemsValidator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "56.1.0",
3
+ "version": "56.1.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -277,5 +277,20 @@ describe('GlDisclosureDropdown', () => {
277
277
  buildWrapper({}, { default: 'Some other content' });
278
278
  expect(findDisclosureContent().element.tagName).toBe('DIV');
279
279
  });
280
+
281
+ describe('discouraged usage', () => {
282
+ it('should render `ul` as content tag when default slot contains LI tags', () => {
283
+ const slots = {
284
+ default: `
285
+ <li>Item</li>
286
+ <li>Item</li>
287
+ <li>Item</li>
288
+ `,
289
+ };
290
+
291
+ buildWrapper({}, slots);
292
+ expect(findDisclosureContent().element.tagName).toBe('UL');
293
+ });
294
+ });
280
295
  });
281
296
  });
@@ -52,15 +52,15 @@ function openDisclosure(component) {
52
52
  });
53
53
  }
54
54
 
55
- const template = (content, { bindingOverrides = {} } = {}, after) => `
55
+ const template = (content = '', { bindingOverrides = {}, after = '' } = {}) => `
56
56
  <div>
57
57
  <gl-disclosure-dropdown
58
58
  ref="disclosure"
59
59
  ${makeBindings(bindingOverrides)}
60
60
  >
61
- ${content || ''}
61
+ ${content}
62
62
  </gl-disclosure-dropdown>
63
- ${after || ''}
63
+ ${after}
64
64
  </div>
65
65
  `;
66
66
 
@@ -252,12 +252,13 @@ export const CustomGroupsItemsAndToggle = makeGroupedExample({
252
252
  </gl-disclosure-dropdown-group>
253
253
  <gl-disclosure-dropdown-group bordered :group="$options.groups[1]"/>
254
254
  `,
255
- {},
256
- `
255
+ {
256
+ after: `
257
257
  <gl-modal :visible="feedBackModalVisible" @change="toggleModalVisibility" modal-id="feedbackModal" size="sm">
258
258
  <textarea class="gl-w-full">Tell us what you think!</textarea>
259
259
  </gl-modal>
260
- `
260
+ `,
261
+ }
261
262
  ),
262
263
  data() {
263
264
  return {
@@ -31,12 +31,14 @@ const hasOnlyListItems = ({ default: defaultSlot }) => {
31
31
  return false;
32
32
  }
33
33
  const nodes = defaultSlot();
34
- return (
35
- Array.isArray(nodes) &&
36
- nodes.filter((vNode) => vNode.tag).length &&
37
- (nodes.filter((vNode) => vNode.tag).every(isValidSlotTagVue2) ||
38
- nodes.filter((vNode) => vNode.tag).every(isValidSlotTag))
39
- );
34
+
35
+ if (!Array.isArray(nodes)) {
36
+ return false;
37
+ }
38
+
39
+ const tags = nodes.filter((vNode) => vNode.tag);
40
+
41
+ return tags.length && tags.every((tag) => isValidSlotTag(tag) || isValidSlotTagVue2(tag));
40
42
  };
41
43
 
42
44
  export { itemsValidator, isItem, isGroup, hasOnlyListItems };