diff options
author | Adriel Santiago <asantiago@gitlab.com> | 2019-04-06 00:59:57 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-04-06 00:59:57 +0300 |
commit | 8cf0af88e664b6e3da7d95180c48241591782419 (patch) | |
tree | fb311e574b24fa9f739b6cfe376b21b968f0eee4 /spec/javascripts/monitoring | |
parent | 3ba9e4e44b9a0b12e6078d8e550ac18d20614e93 (diff) |
Wrap long chart tooltip series label names
Resolves an issue where long series label names overflow
the popover chart tooltip container
Diffstat (limited to 'spec/javascripts/monitoring')
-rw-r--r-- | spec/javascripts/monitoring/charts/area_spec.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/javascripts/monitoring/charts/area_spec.js b/spec/javascripts/monitoring/charts/area_spec.js index 4ff519ae0e7..41a6c04efb9 100644 --- a/spec/javascripts/monitoring/charts/area_spec.js +++ b/spec/javascripts/monitoring/charts/area_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import { GlAreaChart } from '@gitlab/ui/dist/charts'; +import { GlAreaChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts'; import { shallowWrapperContainsSlotText } from 'spec/helpers/vue_test_utils_helper'; import Area from '~/monitoring/components/charts/area.vue'; import MonitoringStore from '~/monitoring/stores/monitoring_store'; @@ -121,13 +121,15 @@ describe('Area component', () => { }); it('formats tooltip content', () => { - expect(areaChart.vm.tooltip.content).toEqual([{ name: 'Core Usage', value: '5.556' }]); + const name = 'Core Usage'; + const value = '5.556'; + const seriesLabel = areaChart.find(GlChartSeriesLabel); + + expect(seriesLabel.vm.color).toBe(''); + expect(shallowWrapperContainsSlotText(seriesLabel, 'default', name)).toBe(true); + expect(areaChart.vm.tooltip.content).toEqual([{ name, value, color: undefined }]); expect( - shallowWrapperContainsSlotText( - areaChart.find(GlAreaChart), - 'tooltipContent', - 'Core Usage 5.556', - ), + shallowWrapperContainsSlotText(areaChart.find(GlAreaChart), 'tooltipContent', value), ).toBe(true); }); }); |