Commit d682be1f authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch '32375-wrong-label-on-the-size-of-mrs' into 'master'

Resolve "Wrong label on the size of MRs"

Closes #32375

See merge request gitlab-org/gitlab!17320
parents d7b32ec1 c9f10589
...@@ -289,7 +289,7 @@ export default { ...@@ -289,7 +289,7 @@ export default {
:data="{ full: getChartData(chartKeys.commitBasedHistogram) }" :data="{ full: getChartData(chartKeys.commitBasedHistogram) }"
:option="getColumnChartOption(chartKeys.commitBasedHistogram)" :option="getColumnChartOption(chartKeys.commitBasedHistogram)"
:y-axis-title="__('Merge requests')" :y-axis-title="__('Merge requests')"
:x-axis-title="__('Commits')" :x-axis-title="getMetricDropdownLabel(chartKeys.commitBasedHistogram)"
x-axis-type="category" x-axis-type="category"
/> />
</template> </template>
......
...@@ -274,6 +274,15 @@ describe('ProductivityApp component', () => { ...@@ -274,6 +274,15 @@ describe('ProductivityApp component', () => {
store.state.charts.charts[chartKeys.commitBasedHistogram].data = { 1: 2, 2: 3 }; store.state.charts.charts[chartKeys.commitBasedHistogram].data = { 1: 2, 2: 3 };
}); });
it('renders a column chart', () => {
expect(
findCommitBasedSection()
.find(GlColumnChart)
.exists(),
).toBe(true);
});
describe('metric dropdown', () => {
it('renders a metric type dropdown', () => { it('renders a metric type dropdown', () => {
expect( expect(
findCommitBasedSection() findCommitBasedSection()
...@@ -282,24 +291,26 @@ describe('ProductivityApp component', () => { ...@@ -282,24 +291,26 @@ describe('ProductivityApp component', () => {
).toBe(true); ).toBe(true);
}); });
it('should change the metric type', () => { describe('when the user changes the metric', () => {
beforeEach(() => {
findCommitBasedSection() findCommitBasedSection()
.findAll(GlDropdownItem) .findAll(GlDropdownItem)
.at(0) .at(0)
.vm.$emit('click'); .vm.$emit('click');
});
it('should dispatch setMetricType action', () => {
expect(actionSpies.setMetricType).toHaveBeenCalledWith({ expect(actionSpies.setMetricType).toHaveBeenCalledWith({
metricType: 'commits_count', metricType: 'commits_count',
chartKey: chartKeys.commitBasedHistogram, chartKey: chartKeys.commitBasedHistogram,
}); });
}); });
it('renders a column chart', () => { it("should update the chart's x axis label", () => {
expect( const columnChart = findCommitBasedSection().find(GlColumnChart);
findCommitBasedSection() expect(columnChart.props('xAxisTitle')).toBe('Number of commits per MR');
.find(GlColumnChart) });
.exists(), });
).toBe(true);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment