@gitlab/ui 32.40.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.
- package/CHANGELOG.md +7 -0
- package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -0
- package/dist/components/base/search_box_by_type/search_box_by_type.js +1 -1
- package/dist/components/charts/column/column.js +1 -1
- package/package.json +1 -1
- package/src/components/base/search_box_by_click/search_box_by_click.vue +1 -0
- package/src/components/base/search_box_by_type/search_box_by_type.vue +1 -1
- package/src/components/charts/column/column.vue +3 -2
- package/src/components/charts/column/column_chart.spec.js +35 -15
- package/src/components/charts/stacked_column/stacked_column.spec.js +2 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [32.41.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.40.0...v32.41.0) (2021-11-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **SearchBoxBy*:** add type search to improve on accessibility ([8d77905](https://gitlab.com/gitlab-org/gitlab-ui/commit/8d779051a8028aad12bbc39ccaa335d10637a225))
|
|
7
|
+
|
|
1
8
|
# [32.40.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.39.0...v32.40.0) (2021-11-22)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -219,7 +219,7 @@ var script = {
|
|
|
219
219
|
const __vue_script__ = script;
|
|
220
220
|
|
|
221
221
|
/* template */
|
|
222
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left}
|
|
222
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"position-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.options},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.showTooltip,"chart":_vm.chart,"top":_vm.tooltipPosition.top,"left":_vm.tooltipPosition.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_vm._v(_vm._s(_vm.tooltipTitle)+" ("+_vm._s(_vm.xAxisTitle)+")")])]},proxy:true}],null,false,643259221)},[_vm._v(" "),_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltipContent}})],1):_vm._e()],1)};
|
|
223
223
|
var __vue_staticRenderFns__ = [];
|
|
224
224
|
|
|
225
225
|
/* style */
|
package/package.json
CHANGED
|
@@ -207,8 +207,9 @@ export default {
|
|
|
207
207
|
:top="tooltipPosition.top"
|
|
208
208
|
:left="tooltipPosition.left"
|
|
209
209
|
>
|
|
210
|
-
|
|
211
|
-
|
|
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:
|
|
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
|
});
|
|
@@ -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;
|
|
@@ -29,18 +29,8 @@ const defaultChartProps = {
|
|
|
29
29
|
yAxisTitle: 'Commits',
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const ChartTooltipStub = {
|
|
33
|
-
props: ChartTooltip.props,
|
|
34
|
-
template: `
|
|
35
|
-
<div>
|
|
36
|
-
<slot name="title" />
|
|
37
|
-
<slot />
|
|
38
|
-
</div>`,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
32
|
describe('stacked column chart component', () => {
|
|
42
33
|
let wrapper;
|
|
43
|
-
let options;
|
|
44
34
|
|
|
45
35
|
const findChart = () => wrapper.findComponent(Chart);
|
|
46
36
|
const findLegend = () => wrapper.findComponent(ChartLegend);
|
|
@@ -62,24 +52,7 @@ describe('stacked column chart component', () => {
|
|
|
62
52
|
};
|
|
63
53
|
|
|
64
54
|
beforeEach(() => {
|
|
65
|
-
|
|
66
|
-
series: [],
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
mockChartInstance = {
|
|
70
|
-
getDom: () => {
|
|
71
|
-
return {
|
|
72
|
-
addEventListener: jest.fn(),
|
|
73
|
-
removeEventListener: jest.fn(),
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
on: jest.fn(),
|
|
77
|
-
off: jest.fn(),
|
|
78
|
-
convertToPixel: jest.fn(),
|
|
79
|
-
getOption: () => {
|
|
80
|
-
return options;
|
|
81
|
-
},
|
|
82
|
-
};
|
|
55
|
+
mockChartInstance = createMockChartInstance();
|
|
83
56
|
});
|
|
84
57
|
|
|
85
58
|
afterEach(() => {
|