@gitlab/ui 42.6.0 → 42.9.0

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": "42.6.0",
3
+ "version": "42.9.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -105,7 +105,7 @@
105
105
  "bootstrap": "4.5.3",
106
106
  "cypress": "^6.6.0",
107
107
  "emoji-regex": "^10.0.0",
108
- "eslint": "8.17.0",
108
+ "eslint": "8.18.0",
109
109
  "eslint-import-resolver-jest": "3.0.2",
110
110
  "eslint-plugin-cypress": "2.12.1",
111
111
  "eslint-plugin-storybook": "0.5.12",
@@ -32,6 +32,7 @@ describe('GlAccordionItem', () => {
32
32
 
33
33
  const findButton = () => wrapper.findComponent(GlButton);
34
34
  const findCollapse = () => wrapper.findComponent(BCollapse);
35
+ const findHeader = () => wrapper.find('.gl-accordion-item-header');
35
36
 
36
37
  it('renders button text', () => {
37
38
  createComponent();
@@ -64,6 +65,15 @@ describe('GlAccordionItem', () => {
64
65
  expect(wrapper.find('h4.gl-accordion-item-header').exists()).toBeTruthy();
65
66
  });
66
67
 
68
+ it.each(['custom-header-class', ['custom-header-class'], { 'custom-header-class': true }])(
69
+ 'applies custom classes to the header',
70
+ (customClassProp) => {
71
+ createComponent({ headerClass: customClassProp }, { defaultHeaderLevel: 3 });
72
+
73
+ expect(findHeader().classes()).toContain('custom-header-class');
74
+ }
75
+ );
76
+
67
77
  it('renders slot text', () => {
68
78
  createComponent();
69
79
 
@@ -54,6 +54,14 @@ When set, it will ensure the accordion item is initially visible
54
54
  return value > 0 && value <= 6;
55
55
  },
56
56
  },
57
+ /**
58
+ * Additional CSS class(es) to be applied to the header.
59
+ */
60
+ headerClass: {
61
+ type: [String, Object, Array],
62
+ required: false,
63
+ default: '',
64
+ },
57
65
  },
58
66
  data() {
59
67
  return {
@@ -89,7 +97,7 @@ When set, it will ensure the accordion item is initially visible
89
97
 
90
98
  <template>
91
99
  <div class="gl-accordion-item">
92
- <component :is="headerComponent" class="gl-accordion-item-header">
100
+ <component :is="headerComponent" class="gl-accordion-item-header" :class="headerClass">
93
101
  <gl-button
94
102
  v-gl-collapse-toggle="accordionItemId"
95
103
  variant="link"
@@ -1,6 +1,6 @@
1
1
  import isFunction from 'lodash/isFunction';
2
2
 
3
- const DELAY_ON_HOVER = 100;
3
+ export const DELAY_ON_HOVER = 100;
4
4
  let mouseOverTimer;
5
5
  let mouseOverHandler;
6
6
 
@@ -1,5 +1,7 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { HoverLoadDirective as hoverLoad } from './hover_load';
2
+ import { HoverLoadDirective as hoverLoad, DELAY_ON_HOVER } from './hover_load';
3
+
4
+ jest.useFakeTimers();
3
5
 
4
6
  describe('hover load directive', () => {
5
7
  let wrapper;
@@ -26,28 +28,25 @@ describe('hover load directive', () => {
26
28
  });
27
29
 
28
30
  it.each`
29
- hoverDuration | action
30
- ${150} | ${'triggers'}
31
- ${99} | ${'does not trigger'}
32
- `(
33
- 'if hover durations is $hoverDuration, directive $action the handler',
34
- async ({ hoverDuration }) => {
35
- const mockHandleLoad = jest.fn();
36
- createComponent(mockHandleLoad);
31
+ hoverDuration | action | expectedCalls
32
+ ${DELAY_ON_HOVER} | ${'triggers'} | ${1}
33
+ ${DELAY_ON_HOVER - 1} | ${'does not trigger'} | ${0}
34
+ `('$action the callback after $hoverDuration ms', ({ hoverDuration, expectedCalls }) => {
35
+ const mockHandleLoad = jest.fn();
36
+ createComponent(mockHandleLoad);
37
+
38
+ findTarget().trigger('mouseover');
39
+
40
+ jest.advanceTimersByTime(hoverDuration);
37
41
 
38
- findTarget().trigger('mouseover');
39
- await new Promise((resolve) => {
40
- setTimeout(resolve, hoverDuration);
41
- });
42
- findTarget().trigger('mouseout');
42
+ findTarget().trigger('mouseout');
43
43
 
44
- if (hoverDuration < 100) {
45
- expect(mockHandleLoad).not.toHaveBeenCalled();
46
- } else {
47
- expect(mockHandleLoad).toHaveBeenCalledTimes(1);
48
- }
44
+ expect(mockHandleLoad).toHaveBeenCalledTimes(expectedCalls);
45
+
46
+ if (expectedCalls) {
47
+ expect(mockHandleLoad).toHaveBeenCalledWith(findTarget().element);
49
48
  }
50
- );
49
+ });
51
50
 
52
51
  it('cleans up the mouseover event when component is destroyed', () => {
53
52
  createComponent(jest.fn());
@@ -3599,14 +3599,6 @@
3599
3599
  }
3600
3600
  }
3601
3601
 
3602
- .gl-grid-gap-6 {
3603
- gap: $gl-spacing-scale-6;
3604
- }
3605
-
3606
- .gl-grid-gap-6\! {
3607
- gap: $gl-spacing-scale-6 !important;
3608
- }
3609
-
3610
3602
  .gl-list-style-none {
3611
3603
  list-style-type: none
3612
3604
  }
@@ -5592,6 +5584,18 @@
5592
5584
  .gl-mt-7\! {
5593
5585
  margin-top: $gl-spacing-scale-7 !important;
5594
5586
  }
5587
+ .gl-mt-8 {
5588
+ margin-top: $gl-spacing-scale-8;
5589
+ }
5590
+ .gl-mt-8\! {
5591
+ margin-top: $gl-spacing-scale-8 !important;
5592
+ }
5593
+ .gl-mt-9 {
5594
+ margin-top: $gl-spacing-scale-9;
5595
+ }
5596
+ .gl-mt-9\! {
5597
+ margin-top: $gl-spacing-scale-9 !important;
5598
+ }
5595
5599
  .gl-mt-11 {
5596
5600
  margin-top: $gl-spacing-scale-11;
5597
5601
  }
@@ -5742,6 +5746,12 @@
5742
5746
  .gl-mb-8\! {
5743
5747
  margin-bottom: $gl-spacing-scale-8 !important;
5744
5748
  }
5749
+ .gl-mb-9 {
5750
+ margin-bottom: $gl-spacing-scale-9;
5751
+ }
5752
+ .gl-mb-9\! {
5753
+ margin-bottom: $gl-spacing-scale-9 !important;
5754
+ }
5745
5755
  .gl-ml-auto {
5746
5756
  margin-left: auto;
5747
5757
  }
@@ -6120,6 +6130,24 @@
6120
6130
  margin-left: #{$gl-spacing-scale-5} !important;
6121
6131
  }
6122
6132
  }
6133
+ .gl-gap-3 {
6134
+ gap: $gl-spacing-scale-3;
6135
+ }
6136
+ .gl-gap-3\! {
6137
+ gap: $gl-spacing-scale-3 !important;
6138
+ }
6139
+ .gl-gap-6 {
6140
+ gap: $gl-spacing-scale-6;
6141
+ }
6142
+ .gl-gap-6\! {
6143
+ gap: $gl-spacing-scale-6 !important;
6144
+ }
6145
+ .gl-grid-gap-6 {
6146
+ gap: $gl-spacing-scale-6;
6147
+ }
6148
+ .gl-grid-gap-6\! {
6149
+ gap: $gl-spacing-scale-6 !important;
6150
+ }
6123
6151
  .gl-xs-mb-3 {
6124
6152
  @include gl-media-breakpoint-down(sm) {
6125
6153
  margin-bottom: $gl-spacing-scale-3;
@@ -26,7 +26,3 @@
26
26
  grid-template-columns: 1fr 1fr;
27
27
  }
28
28
  }
29
-
30
- @mixin gl-grid-gap-6 {
31
- gap: $gl-spacing-scale-6;
32
- }
@@ -418,6 +418,14 @@
418
418
  margin-top: $gl-spacing-scale-7;
419
419
  }
420
420
 
421
+ @mixin gl-mt-8 {
422
+ margin-top: $gl-spacing-scale-8;
423
+ }
424
+
425
+ @mixin gl-mt-9 {
426
+ margin-top: $gl-spacing-scale-9;
427
+ }
428
+
421
429
  @mixin gl-mt-11 {
422
430
  margin-top: $gl-spacing-scale-11;
423
431
  }
@@ -518,6 +526,10 @@
518
526
  margin-bottom: $gl-spacing-scale-8;
519
527
  }
520
528
 
529
+ @mixin gl-mb-9 {
530
+ margin-bottom: $gl-spacing-scale-9;
531
+ }
532
+
521
533
  @mixin gl-ml-auto {
522
534
  margin-left: auto;
523
535
  }
@@ -773,6 +785,19 @@
773
785
  }
774
786
  }
775
787
 
788
+ @mixin gl-gap-3 {
789
+ gap: $gl-spacing-scale-3;
790
+ }
791
+
792
+ @mixin gl-gap-6 {
793
+ gap: $gl-spacing-scale-6;
794
+ }
795
+
796
+ /* Deprecated */
797
+ @mixin gl-grid-gap-6 {
798
+ @include gl-gap-6;
799
+ }
800
+
776
801
  /**
777
802
  * Responsive margin utilities.
778
803
  *