@gitlab/ui 38.3.0 → 38.5.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": "38.3.0",
3
+ "version": "38.5.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -88,7 +88,7 @@
88
88
  "@babel/preset-env": "^7.10.2",
89
89
  "@gitlab/eslint-plugin": "12.0.1",
90
90
  "@gitlab/stylelint-config": "4.0.0",
91
- "@gitlab/svgs": "2.7.0",
91
+ "@gitlab/svgs": "2.8.0",
92
92
  "@rollup/plugin-commonjs": "^11.1.0",
93
93
  "@rollup/plugin-node-resolve": "^7.1.3",
94
94
  "@rollup/plugin-replace": "^2.3.2",
@@ -73,6 +73,20 @@ describe('datepicker component', () => {
73
73
  expect(Pikaday.prototype.show).toHaveBeenCalled();
74
74
  });
75
75
 
76
+ describe('when `ariaLabel` prop is passed', () => {
77
+ it('configures pikaday with the given label', () => {
78
+ const ariaLabel = 'Meaningful description';
79
+
80
+ mountWithOptions({
81
+ propsData: {
82
+ ariaLabel,
83
+ },
84
+ });
85
+
86
+ expect(pikadayConfig().ariaLabel).toBe(ariaLabel);
87
+ });
88
+ });
89
+
76
90
  describe('when `target` prop is not passed', () => {
77
91
  it('sets calendar icon as `trigger` option', () => {
78
92
  const wrapper = mountWithOptions();
@@ -86,7 +86,7 @@ export default {
86
86
  'endRange',
87
87
  'disableDayFn',
88
88
  'firstDay',
89
- 'arialLabel',
89
+ 'ariaLabel',
90
90
  'placeholder',
91
91
  'autocomplete',
92
92
  'disabled',
@@ -99,7 +99,7 @@ export default {
99
99
  required: false,
100
100
  default: 0,
101
101
  },
102
- arialLabel: {
102
+ ariaLabel: {
103
103
  type: String,
104
104
  required: false,
105
105
  default: '',
@@ -244,7 +244,7 @@ export default {
244
244
  },
245
245
  disableDayFn: this.disableDayFn,
246
246
  firstDay: this.firstDay,
247
- arialLabel: this.ariaLabel,
247
+ ariaLabel: this.ariaLabel,
248
248
  toString: (date) => defaultDateFormatter(date),
249
249
  onSelect: this.selected.bind(this),
250
250
  onClose: this.closed.bind(this),
@@ -218,7 +218,7 @@ export const WithHeaderAndFooter = (args, { argTypes }) => ({
218
218
  <gl-dropdown-item>Fifth item</gl-dropdown-item>
219
219
  <gl-dropdown-item>Sixth item</gl-dropdown-item>
220
220
  <gl-dropdown-item>Seventh item</gl-dropdown-item>
221
- <gl-dropdown-item>Eigth item</gl-dropdown-item>
221
+ <gl-dropdown-item>Eighth item</gl-dropdown-item>
222
222
  <template #footer>
223
223
  <gl-dropdown-item>First footer item</gl-dropdown-item>
224
224
  <gl-dropdown-item>Second footer item</gl-dropdown-item>
@@ -730,4 +730,23 @@ describe('Filtered search integration tests', () => {
730
730
  wrapper.findAllComponents(GlFilteredSearchToken).wrappers.map((cmp) => cmp.props('active'))
731
731
  ).toEqual([false, false]);
732
732
  });
733
+
734
+ it('updates tokens list when value is passed dynamically', async () => {
735
+ mountComponent({ value: ['one'] });
736
+ await nextTick();
737
+
738
+ expect(wrapper.findAllComponents(GlFilteredSearchTerm)).toHaveLength(2);
739
+
740
+ await wrapper.setProps({
741
+ value: ['one two'],
742
+ });
743
+
744
+ const termComponents = wrapper.findAllComponents(GlFilteredSearchTerm).wrappers;
745
+ expect(termComponents).toHaveLength(3);
746
+ expect(termComponents.map((termComponent) => termComponent.props('value'))).toEqual([
747
+ { data: 'one' },
748
+ { data: 'two' },
749
+ { data: '' },
750
+ ]);
751
+ });
733
752
  });
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { cloneDeep } from 'lodash';
2
+ import { cloneDeep, isEqual } from 'lodash';
3
3
  import PortalVue from 'portal-vue';
4
4
  import Vue from 'vue';
5
5
  import { GlTooltipDirective } from '../../../directives/tooltip';
@@ -174,11 +174,14 @@ export default {
174
174
  deep: true,
175
175
  immediate: true,
176
176
  },
177
- },
178
- mounted() {
179
- if (this.value.length) {
180
- this.applyNewValue(cloneDeep(this.value));
181
- }
177
+ value: {
178
+ handler(newValue, oldValue) {
179
+ if (newValue.length && !isEqual(newValue, oldValue)) {
180
+ this.applyNewValue(cloneDeep(newValue));
181
+ }
182
+ },
183
+ immediate: true,
184
+ },
182
185
  },
183
186
 
184
187
  methods: {
@@ -36,6 +36,14 @@ describe('search box by click component', () => {
36
36
  expect(wrapper.emitted().input).toEqual([['new value']]);
37
37
  });
38
38
 
39
+ it('does not emit an input event when input is updated to the same value', async () => {
40
+ createComponent({ value: 'somevalue' });
41
+
42
+ await wrapper.setProps({ value: 'another value' });
43
+
44
+ expect(wrapper.emitted().input).toBe(undefined);
45
+ });
46
+
39
47
  it('does not displays history dropdown by default', () => {
40
48
  createComponent();
41
49
  expect(wrapper.findComponent({ ref: 'historyDropdown' }).exists()).toBe(false);
@@ -152,6 +152,7 @@ export default {
152
152
  immediate: true,
153
153
  },
154
154
  currentValue(newValue) {
155
+ if (newValue === this.value) return;
155
156
  this.$emit('input', newValue);
156
157
  },
157
158
  },
@@ -5436,6 +5436,16 @@
5436
5436
  .gl-ml-auto\! {
5437
5437
  margin-left: auto !important;
5438
5438
  }
5439
+ .gl-sm-ml-auto {
5440
+ @include gl-media-breakpoint-up(sm) {
5441
+ margin-left: auto;
5442
+ }
5443
+ }
5444
+ .gl-sm-ml-auto\! {
5445
+ @include gl-media-breakpoint-up(sm) {
5446
+ margin-left: auto !important;
5447
+ }
5448
+ }
5439
5449
  .gl-ml-0 {
5440
5450
  margin-left: 0;
5441
5451
  }
@@ -514,6 +514,12 @@
514
514
  margin-left: auto;
515
515
  }
516
516
 
517
+ @mixin gl-sm-ml-auto {
518
+ @include gl-media-breakpoint-up(sm) {
519
+ @include gl-ml-auto;
520
+ }
521
+ }
522
+
517
523
  @mixin gl-ml-0 {
518
524
  margin-left: 0;
519
525
  }