@gitlab/ui 42.22.1 → 42.24.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.22.1",
3
+ "version": "42.24.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -83,7 +83,7 @@
83
83
  "@babel/preset-env": "^7.10.2",
84
84
  "@gitlab/eslint-plugin": "14.0.0",
85
85
  "@gitlab/stylelint-config": "4.1.0",
86
- "@gitlab/svgs": "2.28.0",
86
+ "@gitlab/svgs": "2.30.0",
87
87
  "@rollup/plugin-commonjs": "^11.1.0",
88
88
  "@rollup/plugin-node-resolve": "^7.1.3",
89
89
  "@rollup/plugin-replace": "^2.3.2",
@@ -96,8 +96,9 @@
96
96
  "@storybook/theming": "6.5.9",
97
97
  "@storybook/vue": "6.5.9",
98
98
  "@vue/test-utils": "1.3.0",
99
+ "@vue/vue2-jest": "27.0.0",
99
100
  "autoprefixer": "^9.7.6",
100
- "babel-jest": "^26.6.3",
101
+ "babel-jest": "^27.5.1",
101
102
  "babel-loader": "^8.0.5",
102
103
  "babel-plugin-lodash": "^3.3.4",
103
104
  "babel-plugin-require-context-hook": "^1.0.0",
@@ -113,7 +114,9 @@
113
114
  "glob": "^7.2.0",
114
115
  "identity-obj-proxy": "^3.0.0",
115
116
  "inquirer-select-directory": "^1.2.0",
116
- "jest": "^26.6.3",
117
+ "jest": "^27.5.1",
118
+ "jest-circus": "27.5.1",
119
+ "jest-environment-jsdom": "27.5.1",
117
120
  "jest-raw-loader": "^1.0.1",
118
121
  "jest-serializer-vue": "^2.0.2",
119
122
  "markdownlint-cli": "^0.29.0",
@@ -144,7 +147,6 @@
144
147
  "stylelint-config-prettier": "9.0.3",
145
148
  "stylelint-prettier": "2.0.0",
146
149
  "vue": "2.6.11",
147
- "vue-jest": "4.0.0-rc.0",
148
150
  "vue-loader": "^15.8.3",
149
151
  "vue-template-compiler": "2.6.11"
150
152
  },
@@ -64,6 +64,7 @@ const SHAPE = {
64
64
  ___.4
65
65
  ___.5
66
66
  `,
67
+
67
68
  COMPLEX: `
68
69
  _.1
69
70
  __.2
@@ -149,11 +150,10 @@ describe('GlFormCheckboxTree', () => {
149
150
  `('when checking a parent checkbox in a $description tree', ({ shape, boxToCheck }) => {
150
151
  let checkbox;
151
152
 
152
- beforeEach(() => {
153
+ beforeEach(async () => {
153
154
  createWrapper({ options: getOptions(shape) });
154
155
  checkbox = wrapper.find(`[data-qa-selector="${QA_PREFIX}${boxToCheck}"]`);
155
- checkbox.find('input').trigger('click');
156
- return wrapper.vm.$nextTick();
156
+ await checkbox.find('input').setChecked();
157
157
  });
158
158
 
159
159
  it("checks all of the checkbox's children, if any", () => {
@@ -174,10 +174,11 @@ describe('GlFormCheckboxTree', () => {
174
174
  `(
175
175
  'when checking child checkboxes in a $description tree',
176
176
  ({ shape, boxesToCheck, indeterminateBoxes, checkedParents }) => {
177
- beforeEach(() => {
177
+ beforeEach(async () => {
178
178
  createWrapper({ options: getOptions(shape) });
179
- boxesToCheck.forEach((box) => findCheckboxInput(findCheckboxByValue(box)).trigger('click'));
180
- return wrapper.vm.$nextTick();
179
+ await Promise.allSettled(
180
+ boxesToCheck.map((box) => findCheckboxInput(findCheckboxByValue(box)).setChecked())
181
+ );
181
182
  });
182
183
 
183
184
  it('parents that have remaining unchecked children become indeterminate', () => {
@@ -205,12 +206,11 @@ describe('GlFormCheckboxTree', () => {
205
206
  `(
206
207
  'when unchecking checkboxes in a $description tree',
207
208
  ({ shape, initiallyChecked, boxesToUncheck, indeterminateBoxes, uncheckedBoxes }) => {
208
- beforeEach(() => {
209
+ beforeEach(async () => {
209
210
  createWrapper({ options: getOptions(shape), [V_MODEL.PROP]: initiallyChecked });
210
- boxesToUncheck.forEach((box) =>
211
- findCheckboxInput(findCheckboxByValue(box)).trigger('click')
211
+ await Promise.allSettled(
212
+ boxesToUncheck.map((box) => findCheckboxInput(findCheckboxByValue(box)).setChecked(false))
212
213
  );
213
- return wrapper.vm.$nextTick();
214
214
  });
215
215
 
216
216
  it("unchecks all of the checkbox's children if any", () => {
@@ -253,12 +253,11 @@ describe('GlFormCheckboxTree', () => {
253
253
  });
254
254
 
255
255
  it('once toggled, puts all checkboxes in the correct state', async () => {
256
- await toggleAllCheckbox.trigger('click');
257
- return wrapper.vm.$nextTick(() => {
258
- findCheckboxes().wrappers.forEach((checkbox) => {
259
- expect(findCheckboxInput(checkbox).element.checked).toBe(finallyChecked);
260
- expect(findCheckboxInput(checkbox).element.indeterminate).toBe(false);
261
- });
256
+ await toggleAllCheckbox.setChecked(finallyChecked);
257
+
258
+ findCheckboxes().wrappers.forEach((checkbox) => {
259
+ expect(findCheckboxInput(checkbox).element.checked).toBe(finallyChecked);
260
+ expect(findCheckboxInput(checkbox).element.indeterminate).toBe(false);
262
261
  });
263
262
  });
264
263
  }
@@ -1,5 +1,4 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import { nextTick } from 'vue';
3
2
  import GlFormRadio from './form_radio.vue';
4
3
 
5
4
  describe('GlFormRadio', () => {
@@ -64,7 +63,6 @@ describe('GlFormRadio', () => {
64
63
  describe('when the selected value is changed programmatically', () => {
65
64
  beforeEach(() => {
66
65
  wrapper.vm.selected = secondOption.value;
67
- return nextTick();
68
66
  });
69
67
 
70
68
  it('emits an input event, but not a change event on each radio', () => {
@@ -83,11 +81,14 @@ describe('GlFormRadio', () => {
83
81
  describe('when the selected value is changed by the user', () => {
84
82
  let radio;
85
83
 
86
- beforeEach(() => {
84
+ beforeEach(async () => {
87
85
  radio = findRadio(secondOption.value);
88
86
 
89
- radio.trigger('click');
90
- return nextTick();
87
+ // NOTE: We can't use "setChecked" here because
88
+ // it sets value programmatically under the hood and this
89
+ // does not pass value for the "change" event.
90
+ await radio.trigger('click');
91
+ await radio.trigger('change');
91
92
  });
92
93
 
93
94
  it('emits an input event on each radio, and a change event on the newly selected radio', () => {
@@ -1,5 +1,4 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import { nextTick } from 'vue';
3
2
  import GlFormRadioGroup from './form_radio_group.vue';
4
3
 
5
4
  describe('GlFormRadioGroup', () => {
@@ -43,7 +42,6 @@ describe('GlFormRadioGroup', () => {
43
42
  describe('when the selected value is changed programmatically', () => {
44
43
  beforeEach(() => {
45
44
  wrapper.vm.selected = secondOption.value;
46
- return nextTick();
47
45
  });
48
46
 
49
47
  it('emits an input event, but not a change event', () => {
@@ -60,14 +58,17 @@ describe('GlFormRadioGroup', () => {
60
58
  describe('when the selected value is changed by the user', () => {
61
59
  let radio;
62
60
 
63
- beforeEach(() => {
61
+ beforeEach(async () => {
64
62
  radio = findRadio(secondOption.value);
65
63
 
66
- radio.trigger('click');
67
- return nextTick();
64
+ // NOTE: We can't use "setChecked" here because
65
+ // it sets value programmatically under the hood and this
66
+ // does not pass value for the "change" event.
67
+ await radio.trigger('click');
68
+ await radio.trigger('change');
68
69
  });
69
70
 
70
- it('emits an input event and a change event', () => {
71
+ it('emits an input event and a change event', async () => {
71
72
  expect(wrapper.findComponent(GlFormRadioGroup).emitted()).toEqual({
72
73
  input: [[secondOption.value]],
73
74
  change: [[secondOption.value]],
@@ -5,6 +5,12 @@ import { defaultHeight, defaultWidth, validRenderers } from '../../../utils/char
5
5
  import createTheme, { themeName } from '../../../utils/charts/theme';
6
6
  import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
7
7
 
8
+ /**
9
+ * Allowed values by eCharts
10
+ * https://echarts.apache.org/en/api.html#echartsInstance.resize
11
+ */
12
+ const sizeValidator = (size) => Number.isFinite(size) || size === 'auto' || size == null;
13
+
8
14
  export default {
9
15
  directives: {
10
16
  resizeObserver: GlResizeObserverDirective,
@@ -25,14 +31,16 @@ export default {
25
31
  default: false,
26
32
  },
27
33
  width: {
28
- type: Number,
34
+ type: [Number, String],
29
35
  required: false,
30
36
  default: null,
37
+ validator: sizeValidator,
31
38
  },
32
39
  height: {
33
- type: Number,
40
+ type: [Number, String],
34
41
  required: false,
35
42
  default: null,
43
+ validator: sizeValidator,
36
44
  },
37
45
  groupId: {
38
46
  type: String,
@@ -4795,6 +4795,14 @@
4795
4795
  min-width: fit-content !important;
4796
4796
  }
4797
4797
 
4798
+ .gl-min-h-0 {
4799
+ min-height: 0;
4800
+ }
4801
+
4802
+ .gl-min-h-0\! {
4803
+ min-height: 0 !important;
4804
+ }
4805
+
4798
4806
  .gl-min-h-6 {
4799
4807
  min-height: $gl-spacing-scale-6;
4800
4808
  }
@@ -6340,6 +6348,16 @@
6340
6348
  margin-bottom: $gl-spacing-scale-5 !important;
6341
6349
  }
6342
6350
  }
6351
+ .gl-md-ml-2 {
6352
+ @include gl-media-breakpoint-up(md) {
6353
+ margin-left: $gl-spacing-scale-2;
6354
+ }
6355
+ }
6356
+ .gl-md-ml-2\! {
6357
+ @include gl-media-breakpoint-up(md) {
6358
+ margin-left: $gl-spacing-scale-2 !important;
6359
+ }
6360
+ }
6343
6361
  .gl-md-ml-3 {
6344
6362
  @include gl-media-breakpoint-up(md) {
6345
6363
  margin-left: $gl-spacing-scale-3;
@@ -333,6 +333,10 @@
333
333
  min-width: fit-content;
334
334
  }
335
335
 
336
+ @mixin gl-min-h-0 {
337
+ min-height: 0;
338
+ }
339
+
336
340
  @mixin gl-min-h-6 {
337
341
  min-height: $gl-spacing-scale-6;
338
342
  }
@@ -911,6 +911,12 @@
911
911
  }
912
912
  }
913
913
 
914
+ @mixin gl-md-ml-2 {
915
+ @include gl-media-breakpoint-up(md) {
916
+ @include gl-ml-2;
917
+ }
918
+ }
919
+
914
920
  @mixin gl-md-ml-3 {
915
921
  @include gl-media-breakpoint-up(md) {
916
922
  @include gl-ml-3;