@gitlab/ui 32.37.0 → 32.41.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/carousel/carousel.documentation.js +1 -4
  3. package/dist/components/base/filtered_search/filtered_search.js +1 -1
  4. package/dist/components/base/filtered_search/filtered_search_token_segment.js +10 -2
  5. package/dist/components/base/form/form_input_group/form_input_group.js +6 -1
  6. package/dist/components/base/markdown/markdown.documentation.js +2 -6
  7. package/dist/components/base/search_box_by_click/search_box_by_click.js +2 -1
  8. package/dist/components/base/search_box_by_type/search_box_by_type.js +1 -1
  9. package/dist/components/base/table/constants.js +5 -0
  10. package/dist/components/base/table/table.js +19 -1
  11. package/dist/components/charts/bar/bar.js +1 -1
  12. package/dist/components/charts/column/column.js +1 -1
  13. package/dist/components/charts/sparkline/sparkline.js +1 -1
  14. package/dist/components/charts/stacked_column/stacked_column.js +1 -1
  15. package/dist/utils/utils.js +12 -2
  16. package/documentation/documented_stories.js +2 -0
  17. package/package.json +3 -3
  18. package/src/components/base/carousel/carousel.documentation.js +0 -2
  19. package/src/components/base/carousel/carousel.md +0 -2
  20. package/src/components/base/carousel/carousel.stories.js +24 -11
  21. package/src/components/base/filtered_search/filtered_search.vue +1 -0
  22. package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +17 -1
  23. package/src/components/base/filtered_search/filtered_search_token_segment.vue +9 -1
  24. package/src/components/base/form/form_input_group/form_input_group.spec.js +18 -1
  25. package/src/components/base/form/form_input_group/form_input_group.vue +6 -1
  26. package/src/components/base/markdown/markdown.documentation.js +0 -3
  27. package/src/components/base/markdown/markdown.md +0 -2
  28. package/src/components/base/markdown/markdown.stories.js +25 -24
  29. package/src/components/base/search_box_by_click/search_box_by_click.vue +2 -0
  30. package/src/components/base/search_box_by_type/search_box_by_type.vue +1 -1
  31. package/src/components/base/table/constants.js +49 -0
  32. package/src/components/base/table/table.spec.js +49 -0
  33. package/src/components/base/table/table.vue +16 -0
  34. package/src/components/charts/bar/bar.spec.js +0 -15
  35. package/src/components/charts/bar/bar.vue +3 -2
  36. package/src/components/charts/column/column.vue +3 -2
  37. package/src/components/charts/column/column_chart.spec.js +35 -15
  38. package/src/components/charts/sparkline/sparkline.spec.js +21 -27
  39. package/src/components/charts/sparkline/sparkline.vue +24 -12
  40. package/src/components/charts/stacked_column/stacked_column.spec.js +4 -21
  41. package/src/components/charts/stacked_column/stacked_column.vue +5 -8
  42. package/src/utils/utils.js +11 -1
  43. package/dist/components/base/carousel/examples/carousel.basic.example.js +0 -38
  44. package/dist/components/base/carousel/examples/index.js +0 -13
  45. package/dist/components/base/markdown/examples/index.js +0 -13
  46. package/dist/components/base/markdown/examples/markdown.basic.example.js +0 -38
  47. package/src/components/base/carousel/examples/carousel.basic.example.vue +0 -26
  48. package/src/components/base/carousel/examples/index.js +0 -15
  49. package/src/components/base/markdown/examples/index.js +0 -15
  50. package/src/components/base/markdown/examples/markdown.basic.example.vue +0 -15
@@ -94,6 +94,7 @@ export default {
94
94
  computed: {
95
95
  inputAttributes() {
96
96
  const attributes = {
97
+ type: 'search',
97
98
  placeholder: this.placeholder,
98
99
  ...this.$attrs,
99
100
  };
@@ -210,6 +211,7 @@ export default {
210
211
  :title="clearButtonTitle"
211
212
  :tooltip-container="tooltipContainer"
212
213
  class="gl-search-box-by-click-icon-button gl-search-box-by-click-clear-button gl-clear-icon-button"
214
+ data-testid="filtered-search-clear-button"
213
215
  @click="clearInput"
214
216
  />
215
217
  <template #append class="gl-search-box-by-click-input-group-control">
@@ -49,7 +49,7 @@ export default {
49
49
  computed: {
50
50
  inputAttributes() {
51
51
  const attributes = {
52
- type: 'text',
52
+ type: 'search',
53
53
  placeholder: 'Search',
54
54
  ...this.$attrs,
55
55
  };
@@ -0,0 +1,49 @@
1
+ export const tableFullSlots = [
2
+ 'bottom-row',
3
+ 'empty',
4
+ 'emptyfiltered',
5
+ 'table-busy',
6
+ 'thead-top',
7
+ 'top-row',
8
+ ];
9
+
10
+ export const tableFullProps = [
11
+ 'api-url',
12
+ 'busy',
13
+ 'current-page',
14
+ 'empty-filtered-html',
15
+ 'empty-filtered-text',
16
+ 'empty-html',
17
+ 'empty-text',
18
+ 'filter',
19
+ 'filter-debounce',
20
+ 'filter-function',
21
+ 'filter-ignored-fields',
22
+ 'filter-included-fields',
23
+ 'label-sort-asc',
24
+ 'label-sort-clear',
25
+ 'label-sort-desc',
26
+ 'no-footer-sorting',
27
+ 'no-local-sorting',
28
+ 'no-provider-filtering',
29
+ 'no-provider-paging',
30
+ 'no-provider-sorting',
31
+ 'no-select-on-click',
32
+ 'no-sort-reset',
33
+ 'per-page',
34
+ 'select-mode',
35
+ 'selectable',
36
+ 'selected-variant',
37
+ 'show-empty',
38
+ 'sort-by',
39
+ 'sort-compare',
40
+ 'sort-compare-locale',
41
+ 'sort-compare-options',
42
+ 'sort-desc',
43
+ 'sort-direction',
44
+ 'sort-icon-left',
45
+ 'sort-null-last',
46
+ ];
47
+
48
+ export const glTableLiteWarning =
49
+ 'This GlTable could be a GlTableLite component, please consider using GlTableLite instead of GlTable to reduce the page bundlesize more about this here: https://gitlab-org.gitlab.io/gitlab-ui/?path=/docs/base-table-table-lite--default';
@@ -0,0 +1,49 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { logWarning } from '../../../utils/utils';
3
+ import { waitForAnimationFrame } from '../../../utils/test_utils';
4
+ import { glTableLiteWarning } from './constants';
5
+ import Table from './table.vue';
6
+
7
+ jest.mock('../../../utils/utils', () => ({
8
+ isDev: () => true,
9
+ logWarning: jest.fn(),
10
+ }));
11
+
12
+ describe('GlTable', () => {
13
+ const slotsTemplate = {
14
+ empty: `
15
+ <p>Placeholder empty text</p>`,
16
+ };
17
+
18
+ const factory = ({ props = {}, scopedSlots = {} } = {}) => {
19
+ shallowMount(Table, {
20
+ scopedSlots,
21
+ propsData: props,
22
+ });
23
+ };
24
+
25
+ afterEach(() => {
26
+ logWarning.mockClear();
27
+ });
28
+
29
+ it('should log a warning when not given any props or slots which qualifies for the usage of GlTable', async () => {
30
+ factory();
31
+ await waitForAnimationFrame();
32
+
33
+ expect(logWarning).toHaveBeenCalledWith(glTableLiteWarning);
34
+ });
35
+
36
+ it('should not log a warning when given a prop which qualifies for the usage of GlTable', async () => {
37
+ factory({ props: { busy: true } });
38
+ await waitForAnimationFrame();
39
+
40
+ expect(logWarning).not.toHaveBeenCalled();
41
+ });
42
+
43
+ it('should not log a warning when given a slot which qualifies for the usage of GlTable', async () => {
44
+ factory({ scopedSlots: slotsTemplate });
45
+ await waitForAnimationFrame();
46
+
47
+ expect(logWarning).not.toHaveBeenCalled();
48
+ });
49
+ });
@@ -1,11 +1,27 @@
1
1
  <script>
2
2
  import { BTable } from 'bootstrap-vue';
3
+ import { logWarning, isDev } from '../../../utils/utils';
4
+ import { tableFullSlots, tableFullProps, glTableLiteWarning } from './constants';
5
+
6
+ const shouldUseFullTable = ({ $attrs, $scopedSlots }) => {
7
+ return (
8
+ tableFullProps.some((prop) => $attrs[prop] !== undefined) ||
9
+ tableFullSlots.some((slot) => $scopedSlots[slot] !== undefined)
10
+ );
11
+ };
3
12
 
4
13
  export default {
5
14
  components: {
6
15
  BTable,
7
16
  },
8
17
  inheritAttrs: false,
18
+ mounted() {
19
+ // logWarning will call isDev before logging any message
20
+ // this additional call to isDev is being made to exit the condition early when run in production
21
+ if (isDev() && !shouldUseFullTable(this)) {
22
+ logWarning(glTableLiteWarning);
23
+ }
24
+ },
9
25
  };
10
26
  </script>
11
27
 
@@ -1,7 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import Chart from '../chart/chart.vue';
3
3
  import BarChart from './bar.vue';
4
- import ChartTooltip from '~/components/charts/tooltip/tooltip.vue';
5
4
  import TooltipDefaultFormat from '~/components/shared_components/charts/tooltip_default_format.vue';
6
5
 
7
6
  const mockChartInstance = {
@@ -34,7 +33,6 @@ describe('Bar chart component', () => {
34
33
  let wrapper;
35
34
 
36
35
  const findChart = () => wrapper.findComponent(Chart);
37
- const findChartTooltip = () => wrapper.findComponent(ChartTooltip);
38
36
  const getOptions = () => findChart().props('options');
39
37
  const emitChartCreated = () => findChart().vm.$emit('created', mockChartInstance);
40
38
 
@@ -123,19 +121,6 @@ describe('Bar chart component', () => {
123
121
  );
124
122
  });
125
123
  });
126
-
127
- it('render accurate tooltip title and content', () => {
128
- const expectedTooltipTitle = `${labelParams.value} (${defaultChartProps.yAxisTitle})`;
129
-
130
- getOptions().yAxis.axisPointer.label.formatter(labelParams);
131
- return wrapper.vm.$nextTick(() => {
132
- const tooltipTextContent = findChartTooltip().element.textContent;
133
-
134
- expect(tooltipTextContent).toContain(expectedTooltipTitle);
135
- expect(tooltipTextContent).toContain(defaultChartProps.xAxisTitle);
136
- expect(tooltipTextContent).toContain(labelParams.seriesData[0].data[0]);
137
- });
138
- });
139
124
  });
140
125
  });
141
126
  });
@@ -238,8 +238,9 @@ export default {
238
238
  :top="tooltipPosition.top"
239
239
  :left="tooltipPosition.left"
240
240
  >
241
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
242
- <div slot="title">{{ tooltipTitle }} ({{ yAxisTitle }})</div>
241
+ <template #title>
242
+ <div>{{ tooltipTitle }} ({{ yAxisTitle }})</div>
243
+ </template>
243
244
  <tooltip-default-format :tooltip-content="tooltipContent" />
244
245
  </chart-tooltip>
245
246
  </div>
@@ -207,8 +207,9 @@ export default {
207
207
  :top="tooltipPosition.top"
208
208
  :left="tooltipPosition.left"
209
209
  >
210
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
211
- <div slot="title">{{ tooltipTitle }} ({{ xAxisTitle }})</div>
210
+ <template #title>
211
+ <div>{{ tooltipTitle }} ({{ xAxisTitle }})</div>
212
+ </template>
212
213
  <tooltip-default-format :tooltip-content="tooltipContent" />
213
214
  </chart-tooltip>
214
215
  </div>
@@ -6,6 +6,13 @@ import {
6
6
  } from '../../../utils/charts/mock_data';
7
7
  import Chart from '../chart/chart.vue';
8
8
  import ColumnChart from './column.vue';
9
+ import { createMockChartInstance, ChartTooltipStub } from '~helpers/chart_stubs';
10
+
11
+ let mockChartInstance;
12
+
13
+ jest.mock('echarts', () => ({
14
+ getInstanceByDom: () => mockChartInstance,
15
+ }));
9
16
 
10
17
  describe('column chart component', () => {
11
18
  const defaultChartProps = {
@@ -16,35 +23,32 @@ describe('column chart component', () => {
16
23
  };
17
24
  let wrapper;
18
25
 
19
- const TooltipStub = {
20
- name: 'chart-tooltip',
21
- template: '<div />',
22
- };
23
-
24
26
  const chartItemClickedSpy = jest.fn();
25
27
  const findChart = () => wrapper.findComponent(Chart);
28
+ const findTooltip = () => wrapper.findComponent(ChartTooltipStub);
29
+ const getChartOptions = () => findChart().props('options');
26
30
 
27
- const factory = (props = defaultChartProps) => {
31
+ const factory = (props = defaultChartProps, slots) => {
28
32
  wrapper = shallowMount(ColumnChart, {
29
33
  propsData: { ...props },
30
34
  stubs: {
31
- chart: true,
32
- 'chart-tooltip': TooltipStub,
35
+ 'chart-tooltip': ChartTooltipStub,
33
36
  },
34
37
  listeners: {
35
38
  chartItemClicked: chartItemClickedSpy,
36
39
  },
40
+ data() {
41
+ return {
42
+ chart: mockChartInstance,
43
+ };
44
+ },
45
+ slots,
37
46
  });
38
- const chart = {
39
- getDom: jest.fn(() => ({
40
- addEventListener: jest.fn(),
41
- removeEventListener: jest.fn(),
42
- })),
43
- };
44
- wrapper.setData({ chart });
45
47
  };
46
48
 
47
49
  beforeEach(() => {
50
+ mockChartInstance = createMockChartInstance();
51
+
48
52
  factory();
49
53
  });
50
54
 
@@ -104,4 +108,20 @@ describe('column chart component', () => {
104
108
  expect(chart.props('options').yAxis[1].name).toEqual(secondaryDataTitle);
105
109
  });
106
110
  });
111
+
112
+ describe('tooltip', () => {
113
+ it('displays the generic tooltip content', async () => {
114
+ const params = {
115
+ seriesData: [{ seriesIndex: '0', seriesName: 'Full', value: ['Mary', 934] }],
116
+ };
117
+
118
+ getChartOptions().xAxis.axisPointer.label.formatter(params);
119
+
120
+ await wrapper.vm.$nextTick();
121
+
122
+ const expectedTooltipTitle = `${params.seriesData[0].value[0]} (${defaultChartProps.xAxisTitle})`;
123
+
124
+ expect(findTooltip().text()).toContain(expectedTooltipTitle);
125
+ });
126
+ });
107
127
  });
@@ -1,6 +1,5 @@
1
1
  import { shallowMount, createLocalVue } from '@vue/test-utils';
2
2
  import Chart from '../chart/chart.vue';
3
- import ChartTooltip from '../tooltip/tooltip.vue';
4
3
  import SparklineChart from './sparkline.vue';
5
4
  import { waitForAnimationFrame } from '~/utils/test_utils';
6
5
 
@@ -12,18 +11,6 @@ const mockChartInstance = {
12
11
  resize: mockResize,
13
12
  };
14
13
 
15
- // echarts need to be mocked to prevent prop-validation in chart-tooltips to fail
16
- jest.mock('echarts', () => ({
17
- getInstanceByDom: () => mockChartInstance,
18
- }));
19
-
20
- jest.mock('~/utils/charts/theme', () => ({
21
- sparkline: {
22
- variants: { foo: 'foo', bar: 'bar' },
23
- defaultVariant: 'foo',
24
- },
25
- }));
26
-
27
14
  let triggerResize = () => {};
28
15
  jest.mock('~/directives/resize_observer/resize_observer', () => ({
29
16
  GlResizeObserverDirective: {
@@ -35,6 +22,11 @@ jest.mock('~/directives/resize_observer/resize_observer', () => ({
35
22
 
36
23
  const localVue = createLocalVue();
37
24
 
25
+ const ChartToolTipStub = {
26
+ name: 'chart-tooltip-stub',
27
+ template: '<div><slot name="default"></slot><slot name="title"></slot></div>',
28
+ };
29
+
38
30
  describe('sparkline chart component', () => {
39
31
  let wrapper;
40
32
  let componentOptions;
@@ -46,19 +38,23 @@ describe('sparkline chart component', () => {
46
38
  variant: null,
47
39
  },
48
40
  scopedSlots: { latestSeriesEntry: jest.fn() },
41
+ stubs: {
42
+ 'chart-tooltip': ChartToolTipStub,
43
+ },
49
44
  };
50
45
 
51
46
  wrapper = shallowMount(SparklineChart, componentOptions);
52
47
  };
53
48
 
54
49
  // helpers
50
+ const getByTestId = (id) => wrapper.find(`[data-testid="${id}"]`);
55
51
  const getChart = () => wrapper.findComponent(Chart);
56
52
 
57
- const getTooltip = () => wrapper.findComponent(ChartTooltip);
58
- const getTooltipTitle = () => getTooltip().find('.js-tooltip-title');
59
- const getTooltipContent = () => getTooltip().find('.js-tooltip-content');
53
+ const getTooltip = () => wrapper.findComponent(ChartToolTipStub);
54
+ const getTooltipTitle = () => getByTestId('tooltip-title');
55
+ const getTooltipContent = () => getByTestId('tooltip-content');
60
56
 
61
- const getLastYValue = () => wrapper.find('.js-last-y-value');
57
+ const getLastYValue = () => getByTestId('last-y-value');
62
58
 
63
59
  const getChartOptions = () => getChart().props('options');
64
60
  const getXAxisLabelFormatter = () => {
@@ -87,7 +83,7 @@ describe('sparkline chart component', () => {
87
83
  });
88
84
 
89
85
  it('emits `chartCreated`, which passes on the chart instance', () => {
90
- expect(wrapper.emitted('chartCreated').length).toBe(1);
86
+ expect(wrapper.emitted('chartCreated')).toHaveLength(1);
91
87
  expect(wrapper.emitted('chartCreated')[0][0]).toBe(mockChartInstance);
92
88
  });
93
89
 
@@ -153,7 +149,7 @@ describe('sparkline chart component', () => {
153
149
  expect(getTooltip().attributes('show')).toBeFalsy();
154
150
  });
155
151
 
156
- it('adds the right content to the tooltip', () => {
152
+ it('adds the right content to the tooltip', async () => {
157
153
  const xValue = 'foo';
158
154
  const yValue = 'bar';
159
155
  const mockData = { seriesData: [{ data: [xValue, yValue] }] };
@@ -163,10 +159,9 @@ describe('sparkline chart component', () => {
163
159
  expect(getTooltipTitle().text()).toBe('');
164
160
  expect(getTooltipContent().text()).toBe('');
165
161
 
166
- return waitForAnimationFrame().then(() => {
167
- expect(getTooltipTitle().text()).toBe(xValue);
168
- expect(getTooltipContent().text()).toBe(yValue);
169
- });
162
+ await waitForAnimationFrame();
163
+ expect(getTooltipTitle().text()).toBe(xValue);
164
+ expect(getTooltipContent().text()).toBe(yValue);
170
165
  });
171
166
 
172
167
  it(`shows the last entry's y-value per default`, async () => {
@@ -182,13 +177,12 @@ describe('sparkline chart component', () => {
182
177
  expect(getLastYValue().text()).toBe(latestEntryYValue);
183
178
  });
184
179
 
185
- it(`does not show the last entry's y-value if 'showLastYValue' is false`, () => {
180
+ it(`does not show the last entry's y-value if 'showLastYValue' is false`, async () => {
186
181
  expect(getLastYValue().exists()).toBe(true);
187
182
 
188
183
  wrapper.setProps({ showLastYValue: false });
189
184
 
190
- return wrapper.vm.$nextTick().then(() => {
191
- expect(getLastYValue().exists()).toBe(false);
192
- });
185
+ await wrapper.vm.$nextTick();
186
+ expect(getLastYValue().exists()).toBe(false);
193
187
  });
194
188
  });
@@ -174,9 +174,13 @@ export default {
174
174
  </script>
175
175
 
176
176
  <template>
177
- <div v-resize-observer="handleResize" class="d-flex align-items-center" @mouseleave="hideTooltip">
177
+ <div
178
+ v-resize-observer="handleResize"
179
+ class="gl-display-flex gl-align-items-center"
180
+ @mouseleave="hideTooltip"
181
+ >
178
182
  <slot name="default"></slot>
179
- <div class="flex-grow-1 position-relative">
183
+ <div class="gl-flex-grow-1 gl-relative">
180
184
  <chart :height="height" :options="options" @created="onChartCreated" />
181
185
  <chart-tooltip
182
186
  v-if="chartInstance"
@@ -187,17 +191,25 @@ export default {
187
191
  :style="{ pointerEvents: 'none' }"
188
192
  placement="top"
189
193
  >
190
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
191
- <div slot="title" class="js-tooltip-title text-nowrap">{{ tooltip.title }}</div>
192
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
193
- <div slot="default" class="js-tooltip-content d-flex">
194
- <span v-if="tooltipLabel" class="pr-4 mr-auto">{{ tooltipLabel }}</span>
195
- <strong>{{ tooltip.content }}</strong>
196
- </div>
194
+ <template #title>
195
+ <div data-testid="tooltip-title" class="gl-white-space-nowrap">
196
+ {{ tooltip.title }}
197
+ </div>
198
+ </template>
199
+ <template #default>
200
+ <div class="gl-display-flex" data-testid="tooltip-content">
201
+ <span v-if="tooltipLabel" class="gl-pr-6 gl-mr-auto">{{ tooltipLabel }}</span>
202
+ <strong>{{ tooltip.content }}</strong>
203
+ </div>
204
+ </template>
197
205
  </chart-tooltip>
198
206
  </div>
199
- <span v-if="showLastYValue" class="js-last-y-value d-inline-flex justify-content-center ml-3">{{
200
- lastYValue
201
- }}</span>
207
+ <span
208
+ v-if="showLastYValue"
209
+ class="gl-display-inline-flex gl-justify-content-center gl-ml-5"
210
+ data-testid="last-y-value"
211
+ >
212
+ {{ lastYValue }}
213
+ </span>
202
214
  </div>
203
215
  </template>
@@ -9,9 +9,9 @@ import Chart from '../chart/chart.vue';
9
9
  import ChartLegend from '../legend/legend.vue';
10
10
  import * as themeUtils from '../../../utils/charts/theme';
11
11
  import StackedColumnChart from './stacked_column.vue';
12
- import ChartTooltip from '~/components/charts/tooltip/tooltip.vue';
13
12
  import TooltipDefaultFormat from '~/components/shared_components/charts/tooltip_default_format.vue';
14
13
 
14
+ import { createMockChartInstance, ChartTooltipStub } from '~helpers/chart_stubs';
15
15
  import { LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE } from '~/utils/charts/constants';
16
16
 
17
17
  let mockChartInstance;
@@ -31,12 +31,11 @@ const defaultChartProps = {
31
31
 
32
32
  describe('stacked column chart component', () => {
33
33
  let wrapper;
34
- let options;
35
34
 
36
35
  const findChart = () => wrapper.findComponent(Chart);
37
36
  const findLegend = () => wrapper.findComponent(ChartLegend);
38
37
  const getOptions = () => findChart().props('options');
39
- const findDataTooltip = () => wrapper.findComponent(ChartTooltip);
38
+ const findDataTooltip = () => wrapper.findComponent(ChartTooltipStub);
40
39
 
41
40
  const emitChartCreated = () => findChart().vm.$emit('created', mockChartInstance);
42
41
 
@@ -45,6 +44,7 @@ describe('stacked column chart component', () => {
45
44
  propsData: { ...defaultChartProps, ...props },
46
45
  stubs: {
47
46
  'tooltip-default-format': TooltipDefaultFormat,
47
+ ChartTooltip: ChartTooltipStub,
48
48
  },
49
49
  slots,
50
50
  });
@@ -52,24 +52,7 @@ describe('stacked column chart component', () => {
52
52
  };
53
53
 
54
54
  beforeEach(() => {
55
- options = {
56
- series: [],
57
- };
58
-
59
- mockChartInstance = {
60
- getDom: () => {
61
- return {
62
- addEventListener: jest.fn(),
63
- removeEventListener: jest.fn(),
64
- };
65
- },
66
- on: jest.fn(),
67
- off: jest.fn(),
68
- convertToPixel: jest.fn(),
69
- getOption: () => {
70
- return options;
71
- },
72
- };
55
+ mockChartInstance = createMockChartInstance();
73
56
  });
74
57
 
75
58
  afterEach(() => {
@@ -308,16 +308,13 @@ export default {
308
308
  :top="tooltipPosition.top"
309
309
  :left="tooltipPosition.left"
310
310
  >
311
- <template v-if="formatTooltipText">
312
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
313
- <slot slot="title" name="tooltip-title"></slot>
314
- <slot name="tooltip-content"></slot>
311
+ <template #title>
312
+ <slot name="tooltip-title">{{ tooltipTitle }} ({{ xAxisTitle }})</slot>
315
313
  </template>
316
- <template v-else>
317
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
318
- <div slot="title">{{ tooltipTitle }} ({{ xAxisTitle }})</div>
314
+
315
+ <slot name="tooltip-content">
319
316
  <tooltip-default-format :tooltip-content="tooltipContent" />
320
- </template>
317
+ </slot>
321
318
  </chart-tooltip>
322
319
  <chart-legend
323
320
  v-if="compiledOptions"
@@ -103,12 +103,22 @@ export function focusFirstFocusableElement(elts) {
103
103
  if (focusableElt) focusableElt.focus();
104
104
  }
105
105
 
106
+ /**
107
+ * Returns true if the current environment is considered a development environment (it's not
108
+ * production or test).
109
+ *
110
+ * @returns {boolean}
111
+ */
112
+ export function isDev() {
113
+ return !['test', 'production'].includes(process.env.NODE_ENV);
114
+ }
115
+
106
116
  /**
107
117
  * Prints a warning message to the console in non-test and non-production environments.
108
118
  * @param {string} message message to print to the console
109
119
  */
110
120
  export function logWarning(message = '') {
111
- if (message.length && !['test', 'production'].includes(process.env.NODE_ENV)) {
121
+ if (message.length && isDev()) {
112
122
  console.warn(message); // eslint-disable-line no-console
113
123
  }
114
124
  }
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-carousel',{staticStyle:{"text-shadow":"1px 1px 2px #333"},attrs:{"interval":4000,"controls":"","indicators":"","background":"#ababab","img-width":"1024","img-height":"480"}},[_c('gl-carousel-slide',{attrs:{"caption":"First slide","text":"Nulla vitae elit libero, a pharetra augue mollis interdum.","img-src":"https://picsum.photos/1024/480/?image=52"}}),_vm._v(" "),_c('gl-carousel-slide',{attrs:{"img-src":"https://picsum.photos/1024/480/?image=54"}},[_c('h1',[_vm._v("Hello world!")])]),_vm._v(" "),_c('gl-carousel-slide',{attrs:{"img-src":"https://picsum.photos/1024/480/?image=58"}})],1)};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,13 +0,0 @@
1
- import CarouselBasicExample from './carousel.basic.example';
2
-
3
- var index = [{
4
- name: 'Basic',
5
- items: [{
6
- id: 'carousel-basic',
7
- name: 'Basic',
8
- description: 'Basic Carousel',
9
- component: CarouselBasicExample
10
- }]
11
- }];
12
-
13
- export default index;
@@ -1,13 +0,0 @@
1
- import BasicExample from './markdown.basic.example';
2
-
3
- var index = [{
4
- name: 'Basic',
5
- items: [{
6
- id: 'markdown-basic',
7
- name: 'Basic',
8
- description: 'Basic Markdown',
9
- component: BasicExample
10
- }]
11
- }];
12
-
13
- export default index;