2019-08-21 13:43:01 +00:00
|
|
|
import { GlLink } from '@gitlab/ui';
|
2020-04-01 18:07:56 +00:00
|
|
|
import {
|
|
|
|
GlAreaChart,
|
|
|
|
GlLineChart,
|
|
|
|
GlChartSeriesLabel,
|
|
|
|
GlChartLegend,
|
|
|
|
} from '@gitlab/ui/dist/charts';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { mount, shallowMount } from '@vue/test-utils';
|
|
|
|
import timezoneMock from 'timezone-mock';
|
2022-01-25 12:14:14 +00:00
|
|
|
import { nextTick } from 'vue';
|
2021-02-01 15:08:56 +00:00
|
|
|
import { TEST_HOST } from 'helpers/test_constants';
|
|
|
|
import { setTestTimeout } from 'helpers/timeout';
|
2019-11-05 09:21:54 +00:00
|
|
|
import { shallowWrapperContainsSlotText } from 'helpers/vue_test_utils_helper';
|
2019-08-21 13:43:01 +00:00
|
|
|
import TimeSeries from '~/monitoring/components/charts/time_series.vue';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { panelTypes, chartHeight } from '~/monitoring/constants';
|
|
|
|
import { timeSeriesGraphData } from '../../graph_data';
|
2020-08-10 06:09:53 +00:00
|
|
|
import {
|
|
|
|
deploymentData,
|
|
|
|
mockProjectDir,
|
|
|
|
annotationsData,
|
|
|
|
mockFixedTimeRange,
|
|
|
|
} from '../../mock_data';
|
2020-07-09 09:09:27 +00:00
|
|
|
|
2020-02-07 12:09:13 +00:00
|
|
|
jest.mock('lodash/throttle', () =>
|
|
|
|
// this throttle mock executes immediately
|
2020-12-23 21:10:24 +00:00
|
|
|
jest.fn((func) => {
|
2020-02-07 12:09:13 +00:00
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
func.cancel = jest.fn();
|
|
|
|
return func;
|
|
|
|
}),
|
|
|
|
);
|
2019-11-05 09:21:54 +00:00
|
|
|
jest.mock('~/lib/utils/icon_utils', () => ({
|
2020-12-23 21:10:24 +00:00
|
|
|
getSvgIconPathContent: jest.fn().mockImplementation((icon) => Promise.resolve(`${icon}-content`)),
|
2019-11-05 09:21:54 +00:00
|
|
|
}));
|
2019-08-21 13:43:01 +00:00
|
|
|
|
|
|
|
describe('Time series component', () => {
|
2020-07-09 09:09:27 +00:00
|
|
|
const defaultGraphData = timeSeriesGraphData();
|
2020-05-29 18:08:26 +00:00
|
|
|
let wrapper;
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
const createWrapper = (
|
2020-07-09 09:09:27 +00:00
|
|
|
{ graphData = defaultGraphData, ...props } = {},
|
2020-05-29 18:08:26 +00:00
|
|
|
mountingMethod = shallowMount,
|
|
|
|
) => {
|
|
|
|
wrapper = mountingMethod(TimeSeries, {
|
2020-02-24 18:09:05 +00:00
|
|
|
propsData: {
|
2020-04-23 21:09:31 +00:00
|
|
|
graphData,
|
2020-07-09 09:09:27 +00:00
|
|
|
deploymentData,
|
|
|
|
annotations: annotationsData,
|
2020-04-16 06:09:39 +00:00
|
|
|
projectPath: `${TEST_HOST}${mockProjectDir}`,
|
2020-08-10 06:09:53 +00:00
|
|
|
timeRange: mockFixedTimeRange,
|
2020-05-29 18:08:26 +00:00
|
|
|
...props,
|
2020-02-24 18:09:05 +00:00
|
|
|
},
|
2020-04-01 18:07:56 +00:00
|
|
|
stubs: {
|
|
|
|
GlPopover: true,
|
2021-06-25 00:08:34 +00:00
|
|
|
GlLineChart,
|
|
|
|
GlAreaChart,
|
2020-04-01 18:07:56 +00:00
|
|
|
},
|
2020-12-25 18:10:00 +00:00
|
|
|
attachTo: document.body,
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2020-05-29 18:08:26 +00:00
|
|
|
};
|
2019-11-13 18:06:51 +00:00
|
|
|
|
2020-07-09 09:09:27 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
setTestTimeout(1000);
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-07-09 09:09:27 +00:00
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-07-09 09:09:27 +00:00
|
|
|
describe('With a single time series', () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('general functions', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const findChart = () => wrapper.find({ ref: 'chart' });
|
2019-09-30 12:06:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper({}, mount);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2019-12-31 12:08:51 +00:00
|
|
|
});
|
2019-09-30 12:06:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('allows user to override legend label texts using props', async () => {
|
2020-06-16 18:09:01 +00:00
|
|
|
const legendRelatedProps = {
|
|
|
|
legendMinText: 'legendMinText',
|
|
|
|
legendMaxText: 'legendMaxText',
|
|
|
|
legendAverageText: 'legendAverageText',
|
|
|
|
legendCurrentText: 'legendCurrentText',
|
|
|
|
};
|
|
|
|
wrapper.setProps({
|
|
|
|
...legendRelatedProps,
|
|
|
|
});
|
2019-11-13 18:06:51 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(findChart().props()).toMatchObject(legendRelatedProps);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-04-23 21:09:31 +00:00
|
|
|
it('chart sets a default height', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper();
|
2020-04-23 21:09:31 +00:00
|
|
|
expect(wrapper.props('height')).toBe(chartHeight);
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('chart has a configurable height', async () => {
|
2020-04-23 21:09:31 +00:00
|
|
|
const mockHeight = 599;
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper();
|
2020-04-23 21:09:31 +00:00
|
|
|
|
|
|
|
wrapper.setProps({ height: mockHeight });
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(wrapper.props('height')).toBe(mockHeight);
|
2020-04-23 21:09:31 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('events', () => {
|
|
|
|
describe('datazoom', () => {
|
|
|
|
let eChartMock;
|
|
|
|
let startValue;
|
|
|
|
let endValue;
|
2019-11-19 09:06:16 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
eChartMock = {
|
|
|
|
handlers: {},
|
|
|
|
getOption: () => ({
|
|
|
|
dataZoom: [
|
|
|
|
{
|
|
|
|
startValue,
|
|
|
|
endValue,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
2020-12-23 21:10:24 +00:00
|
|
|
off: jest.fn((eChartEvent) => {
|
2020-02-24 18:09:05 +00:00
|
|
|
delete eChartMock.handlers[eChartEvent];
|
|
|
|
}),
|
|
|
|
on: jest.fn((eChartEvent, fn) => {
|
|
|
|
eChartMock.handlers[eChartEvent] = fn;
|
|
|
|
}),
|
|
|
|
};
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper({}, mount);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
findChart().vm.$emit('created', eChartMock);
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('handles datazoom event from chart', () => {
|
|
|
|
startValue = 1577836800000; // 2020-01-01T00:00:00.000Z
|
|
|
|
endValue = 1577840400000; // 2020-01-01T01:00:00.000Z
|
|
|
|
eChartMock.handlers.datazoom();
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.emitted('datazoom')).toHaveLength(1);
|
|
|
|
expect(wrapper.emitted('datazoom')[0]).toEqual([
|
2020-02-24 18:09:05 +00:00
|
|
|
{
|
|
|
|
start: new Date(startValue).toISOString(),
|
|
|
|
end: new Date(endValue).toISOString(),
|
|
|
|
},
|
2019-10-30 15:14:17 +00:00
|
|
|
]);
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
});
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('methods', () => {
|
|
|
|
describe('formatTooltipText', () => {
|
2020-04-10 09:09:39 +00:00
|
|
|
const mockCommitUrl = deploymentData[0].commitUrl;
|
|
|
|
const mockDate = deploymentData[0].created_at;
|
|
|
|
const mockSha = 'f5bcd1d9';
|
|
|
|
const mockLineSeriesData = () => ({
|
|
|
|
seriesData: [
|
|
|
|
{
|
2020-05-29 18:08:26 +00:00
|
|
|
seriesName: wrapper.vm.chartData[0].name,
|
2020-04-10 09:09:39 +00:00
|
|
|
componentSubType: 'line',
|
|
|
|
value: [mockDate, 5.55555],
|
|
|
|
dataIndex: 0,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
value: mockDate,
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
|
2020-04-10 09:09:39 +00:00
|
|
|
const annotationsMetadata = {
|
|
|
|
tooltipData: {
|
|
|
|
sha: mockSha,
|
|
|
|
commitUrl: mockCommitUrl,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const mockAnnotationsSeriesData = {
|
|
|
|
seriesData: [
|
|
|
|
{
|
|
|
|
componentSubType: 'scatter',
|
|
|
|
seriesName: 'series01',
|
|
|
|
dataIndex: 0,
|
|
|
|
value: [mockDate, 5.55555],
|
|
|
|
type: 'scatter',
|
|
|
|
name: 'deployments',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
value: mockDate,
|
|
|
|
};
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('does not throw error if data point is outside the zoom range', () => {
|
2020-04-10 09:09:39 +00:00
|
|
|
const seriesDataWithoutValue = {
|
|
|
|
...mockLineSeriesData(),
|
2020-12-23 21:10:24 +00:00
|
|
|
seriesData: mockLineSeriesData().seriesData.map((data) => ({
|
2020-04-10 09:09:39 +00:00
|
|
|
...data,
|
|
|
|
value: undefined,
|
|
|
|
})),
|
|
|
|
};
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.formatTooltipText(seriesDataWithoutValue)).toBeUndefined();
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('when series is of line type', () => {
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2021-06-25 00:08:34 +00:00
|
|
|
createWrapper({}, mount);
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.formatTooltipText(mockLineSeriesData());
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip title', () => {
|
2021-06-08 12:10:09 +00:00
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip content', () => {
|
2020-07-09 09:09:27 +00:00
|
|
|
const name = 'Metric 1';
|
2020-03-05 15:07:52 +00:00
|
|
|
const value = '5.556';
|
2020-02-24 18:09:05 +00:00
|
|
|
const dataIndex = 0;
|
2020-05-29 18:08:26 +00:00
|
|
|
const seriesLabel = wrapper.find(GlChartSeriesLabel);
|
2020-02-24 18:09:05 +00:00
|
|
|
|
|
|
|
expect(seriesLabel.vm.color).toBe('');
|
2020-07-09 09:09:27 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
expect(shallowWrapperContainsSlotText(seriesLabel, 'default', name)).toBe(true);
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.content).toEqual([
|
2020-02-24 18:09:05 +00:00
|
|
|
{ name, value, dataIndex, color: undefined },
|
|
|
|
]);
|
|
|
|
|
|
|
|
expect(
|
2020-11-16 21:09:02 +00:00
|
|
|
shallowWrapperContainsSlotText(wrapper.find(GlLineChart), 'tooltip-content', value),
|
2020-02-24 18:09:05 +00:00
|
|
|
).toBe(true);
|
|
|
|
});
|
2020-05-29 18:08:26 +00:00
|
|
|
|
|
|
|
describe('when in PT timezone', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
// Note: node.js env renders (GMT-0700), in the browser we see (PDT)
|
|
|
|
timezoneMock.register('US/Pacific');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
timezoneMock.unregister();
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('formats tooltip title in local timezone by default', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper();
|
|
|
|
wrapper.vm.formatTooltipText(mockLineSeriesData());
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 3:14AM (GMT-0700)');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('formats tooltip title in local timezone', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper({ timezone: 'LOCAL' });
|
|
|
|
wrapper.vm.formatTooltipText(mockLineSeriesData());
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 3:14AM (GMT-0700)');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('formats tooltip title in UTC format', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper({ timezone: 'UTC' });
|
|
|
|
wrapper.vm.formatTooltipText(mockLineSeriesData());
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('when series is of scatter type, for deployments', () => {
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.formatTooltipText({
|
2020-04-10 09:09:39 +00:00
|
|
|
...mockAnnotationsSeriesData,
|
2020-12-23 21:10:24 +00:00
|
|
|
seriesData: mockAnnotationsSeriesData.seriesData.map((data) => ({
|
2020-04-10 09:09:39 +00:00
|
|
|
...data,
|
|
|
|
data: annotationsMetadata,
|
|
|
|
})),
|
|
|
|
});
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
2020-04-09 09:10:17 +00:00
|
|
|
it('set tooltip type to deployments', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.type).toBe('deployments');
|
2020-04-09 09:10:17 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('formats tooltip title', () => {
|
2021-06-08 12:10:09 +00:00
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip sha', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.sha).toBe('f5bcd1d9');
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip commit url', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.commitUrl).toBe(mockCommitUrl);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
2020-04-10 09:09:39 +00:00
|
|
|
|
|
|
|
describe('when series is of scatter type and deployments data is missing', () => {
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.formatTooltipText(mockAnnotationsSeriesData);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-04-10 09:09:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip title', () => {
|
2021-06-08 12:10:09 +00:00
|
|
|
expect(wrapper.vm.tooltip.title).toBe('16 Jul 2019, 10:14AM (UTC)');
|
2020-04-10 09:09:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip sha', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.sha).toBeUndefined();
|
2020-04-10 09:09:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('formats tooltip commit url', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.tooltip.commitUrl).toBeUndefined();
|
2020-04-10 09:09:39 +00:00
|
|
|
});
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
describe('formatAnnotationsTooltipText', () => {
|
|
|
|
const annotationsMetadata = {
|
|
|
|
name: 'annotations',
|
|
|
|
xAxis: annotationsData[0].from,
|
|
|
|
yAxis: 0,
|
|
|
|
tooltipData: {
|
|
|
|
title: '2020/02/19 10:01:41',
|
|
|
|
content: annotationsData[0].description,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const mockMarkPoint = {
|
|
|
|
componentType: 'markPoint',
|
|
|
|
name: 'annotations',
|
|
|
|
value: undefined,
|
|
|
|
data: annotationsMetadata,
|
|
|
|
};
|
|
|
|
|
|
|
|
it('formats tooltip title and sets tooltip content', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const formattedTooltipData = wrapper.vm.formatAnnotationsTooltipText(mockMarkPoint);
|
2021-06-08 12:10:09 +00:00
|
|
|
expect(formattedTooltipData.title).toBe('19 Feb 2020, 10:01AM (UTC)');
|
2020-04-21 15:21:10 +00:00
|
|
|
expect(formattedTooltipData.content).toBe(annotationsMetadata.tooltipData.content);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('onResize', () => {
|
|
|
|
const mockWidth = 233;
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
jest.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(() => ({
|
|
|
|
width: mockWidth,
|
|
|
|
}));
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.onResize();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('sets area chart width', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(wrapper.vm.width).toBe(mockWidth);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('computed', () => {
|
|
|
|
const getChartOptions = () => findChart().props('option');
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('chartData', () => {
|
|
|
|
let chartData;
|
|
|
|
const seriesData = () => chartData[0];
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
beforeEach(() => {
|
2020-05-29 18:08:26 +00:00
|
|
|
({ chartData } = wrapper.vm);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('utilizes all data points', () => {
|
|
|
|
expect(chartData.length).toBe(1);
|
2020-07-09 09:09:27 +00:00
|
|
|
expect(seriesData().data.length).toBe(3);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('creates valid data', () => {
|
|
|
|
const { data } = seriesData();
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
expect(
|
|
|
|
data.filter(
|
|
|
|
([time, value]) => new Date(time).getTime() > 0 && typeof value === 'number',
|
|
|
|
).length,
|
|
|
|
).toBe(data.length);
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('formats line width correctly', () => {
|
|
|
|
expect(chartData[0].lineStyle.width).toBe(2);
|
|
|
|
});
|
2020-02-18 03:08:54 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('chartOptions', () => {
|
2020-08-10 06:09:53 +00:00
|
|
|
describe('x-Axis bounds', () => {
|
|
|
|
it('is set to the time range bounds', () => {
|
|
|
|
expect(getChartOptions().xAxis).toMatchObject({
|
|
|
|
min: mockFixedTimeRange.start,
|
|
|
|
max: mockFixedTimeRange.end,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('is not set if time range is not set or incorrectly set', async () => {
|
2020-08-10 06:09:53 +00:00
|
|
|
wrapper.setProps({
|
|
|
|
timeRange: {},
|
|
|
|
});
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(getChartOptions().xAxis).not.toHaveProperty('min');
|
|
|
|
expect(getChartOptions().xAxis).not.toHaveProperty('max');
|
2020-08-10 06:09:53 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-06-03 12:08:21 +00:00
|
|
|
describe('dataZoom', () => {
|
|
|
|
it('renders with scroll handle icons', () => {
|
|
|
|
expect(getChartOptions().dataZoom).toHaveLength(1);
|
|
|
|
expect(getChartOptions().dataZoom[0]).toMatchObject({
|
|
|
|
handleIcon: 'path://scroll-handle-content',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-06-16 15:08:32 +00:00
|
|
|
describe('xAxis pointer', () => {
|
|
|
|
it('snap is set to false by default', () => {
|
|
|
|
expect(getChartOptions().xAxis.axisPointer.snap).toBe(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('are extended by `option`', () => {
|
|
|
|
const mockSeriesName = 'Extra series 1';
|
|
|
|
const mockOption = {
|
|
|
|
option1: 'option1',
|
|
|
|
option2: 'option2',
|
|
|
|
};
|
2019-10-30 15:14:17 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('arbitrary options', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.setProps({
|
2020-02-24 18:09:05 +00:00
|
|
|
option: mockOption,
|
|
|
|
});
|
2019-10-30 15:14:17 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(getChartOptions()).toEqual(expect.objectContaining(mockOption));
|
2019-10-30 15:14:17 +00:00
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('additional series', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.setProps({
|
2020-02-24 18:09:05 +00:00
|
|
|
option: {
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
name: mockSeriesName,
|
2020-04-21 15:21:10 +00:00
|
|
|
type: 'line',
|
|
|
|
data: [],
|
2020-02-24 18:09:05 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
const optionSeries = getChartOptions().series;
|
2019-10-30 15:14:17 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
expect(optionSeries.length).toEqual(2);
|
|
|
|
expect(optionSeries[0].name).toEqual(mockSeriesName);
|
2019-12-31 12:08:51 +00:00
|
|
|
});
|
2020-02-18 09:09:24 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('additional y-axis data', async () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
const mockCustomYAxisOption = {
|
2020-03-03 09:07:54 +00:00
|
|
|
name: 'Custom y-axis label',
|
2020-02-24 18:09:05 +00:00
|
|
|
axisLabel: {
|
|
|
|
formatter: jest.fn(),
|
|
|
|
},
|
|
|
|
};
|
2020-02-18 09:09:24 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.setProps({
|
2020-02-24 18:09:05 +00:00
|
|
|
option: {
|
|
|
|
yAxis: mockCustomYAxisOption,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
const { yAxis } = getChartOptions();
|
2020-02-24 18:09:05 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
expect(yAxis[0]).toMatchObject(mockCustomYAxisOption);
|
2020-02-18 09:09:24 +00:00
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('additional x axis data', async () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
const mockCustomXAxisOption = {
|
|
|
|
name: 'Custom x axis label',
|
|
|
|
};
|
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.setProps({
|
2020-02-24 18:09:05 +00:00
|
|
|
option: {
|
|
|
|
xAxis: mockCustomXAxisOption,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
const { xAxis } = getChartOptions();
|
2020-02-18 09:09:24 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
expect(xAxis).toMatchObject(mockCustomXAxisOption);
|
2020-02-18 09:09:24 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('yAxis formatter', () => {
|
|
|
|
let dataFormatter;
|
|
|
|
let deploymentFormatter;
|
2020-02-18 09:09:24 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
dataFormatter = getChartOptions().yAxis[0].axisLabel.formatter;
|
|
|
|
deploymentFormatter = getChartOptions().yAxis[1].axisLabel.formatter;
|
2020-02-18 09:09:24 +00:00
|
|
|
});
|
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
it('formats by default to precision notation', () => {
|
|
|
|
expect(dataFormatter(0.88888)).toBe('889m');
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2020-02-18 09:09:24 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('deployment formatter is set as is required to display a tooltip', () => {
|
|
|
|
expect(deploymentFormatter).toEqual(expect.any(Function));
|
2020-02-18 09:09:24 +00:00
|
|
|
});
|
|
|
|
});
|
2019-10-30 15:14:17 +00:00
|
|
|
});
|
|
|
|
|
2020-04-05 00:09:22 +00:00
|
|
|
describe('annotationSeries', () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
it('utilizes deployment data', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const annotationSeries = wrapper.vm.chartOptionSeries[0];
|
2020-04-05 00:09:22 +00:00
|
|
|
expect(annotationSeries.yAxisIndex).toBe(1); // same as annotations y axis
|
|
|
|
expect(annotationSeries.data).toEqual([
|
|
|
|
expect.objectContaining({
|
|
|
|
symbolSize: 14,
|
2020-06-03 12:08:21 +00:00
|
|
|
symbol: 'path://rocket-content',
|
2020-04-05 00:09:22 +00:00
|
|
|
value: ['2019-07-16T10:14:25.589Z', expect.any(Number)],
|
|
|
|
}),
|
|
|
|
expect.objectContaining({
|
|
|
|
symbolSize: 14,
|
2020-06-03 12:08:21 +00:00
|
|
|
symbol: 'path://rocket-content',
|
2020-04-05 00:09:22 +00:00
|
|
|
value: ['2019-07-16T11:14:25.589Z', expect.any(Number)],
|
|
|
|
}),
|
|
|
|
expect.objectContaining({
|
|
|
|
symbolSize: 14,
|
2020-06-03 12:08:21 +00:00
|
|
|
symbol: 'path://rocket-content',
|
2020-04-05 00:09:22 +00:00
|
|
|
value: ['2019-07-16T12:14:25.589Z', expect.any(Number)],
|
|
|
|
}),
|
2020-02-24 18:09:05 +00:00
|
|
|
]);
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
describe('xAxisLabel', () => {
|
|
|
|
const mockDate = Date.UTC(2020, 4, 26, 20); // 8:00 PM in GMT
|
|
|
|
|
2020-12-23 21:10:24 +00:00
|
|
|
const useXAxisFormatter = (date) => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const { xAxis } = getChartOptions();
|
|
|
|
const { formatter } = xAxis.axisLabel;
|
|
|
|
return formatter(date);
|
|
|
|
};
|
|
|
|
|
2020-07-14 03:09:24 +00:00
|
|
|
it('x-axis is formatted correctly in m/d h:MM TT format', () => {
|
|
|
|
expect(useXAxisFormatter(mockDate)).toEqual('5/26 8:00 PM');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('when in PT timezone', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
timezoneMock.register('US/Pacific');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
timezoneMock.unregister();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('by default, values are formatted in PT', () => {
|
|
|
|
createWrapper();
|
2020-07-14 03:09:24 +00:00
|
|
|
expect(useXAxisFormatter(mockDate)).toEqual('5/26 1:00 PM');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('when the chart uses local timezone, y-axis is formatted in PT', () => {
|
|
|
|
createWrapper({ timezone: 'LOCAL' });
|
2020-07-14 03:09:24 +00:00
|
|
|
expect(useXAxisFormatter(mockDate)).toEqual('5/26 1:00 PM');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('when the chart uses UTC, y-axis is formatted in UTC', () => {
|
|
|
|
createWrapper({ timezone: 'UTC' });
|
2020-07-14 03:09:24 +00:00
|
|
|
expect(useXAxisFormatter(mockDate)).toEqual('5/26 8:00 PM');
|
2020-05-29 18:08:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('yAxisLabel', () => {
|
2020-03-03 09:07:54 +00:00
|
|
|
it('y-axis is configured correctly', () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
const { yAxis } = getChartOptions();
|
|
|
|
|
|
|
|
expect(yAxis).toHaveLength(2);
|
|
|
|
|
|
|
|
const [dataAxis, deploymentAxis] = yAxis;
|
|
|
|
|
|
|
|
expect(dataAxis.boundaryGap).toHaveLength(2);
|
|
|
|
expect(dataAxis.scale).toBe(true);
|
|
|
|
|
|
|
|
expect(deploymentAxis.show).toBe(false);
|
|
|
|
expect(deploymentAxis.min).toEqual(expect.any(Number));
|
|
|
|
expect(deploymentAxis.max).toEqual(expect.any(Number));
|
|
|
|
expect(deploymentAxis.min).toBeLessThan(deploymentAxis.max);
|
2020-02-13 15:08:52 +00:00
|
|
|
});
|
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('constructs a label for the chart y-axis', () => {
|
|
|
|
const { yAxis } = getChartOptions();
|
|
|
|
|
2020-07-09 09:09:27 +00:00
|
|
|
expect(yAxis[0].name).toBe('Y Axis');
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('wrapped components', () => {
|
|
|
|
const glChartComponents = [
|
|
|
|
{
|
2020-04-21 15:21:10 +00:00
|
|
|
chartType: panelTypes.AREA_CHART,
|
2020-02-24 18:09:05 +00:00
|
|
|
component: GlAreaChart,
|
|
|
|
},
|
|
|
|
{
|
2020-04-21 15:21:10 +00:00
|
|
|
chartType: panelTypes.LINE_CHART,
|
2020-02-24 18:09:05 +00:00
|
|
|
component: GlLineChart,
|
|
|
|
},
|
|
|
|
];
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2020-12-23 21:10:24 +00:00
|
|
|
glChartComponents.forEach((dynamicComponent) => {
|
2020-02-24 18:09:05 +00:00
|
|
|
describe(`GitLab UI: ${dynamicComponent.chartType}`, () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const findChartComponent = () => wrapper.find(dynamicComponent.component);
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
createWrapper(
|
2020-07-09 09:09:27 +00:00
|
|
|
{ graphData: timeSeriesGraphData({ type: dynamicComponent.chartType }) },
|
2020-04-23 21:09:31 +00:00
|
|
|
mount,
|
|
|
|
);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2020-08-26 09:10:16 +00:00
|
|
|
it('exists', () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
expect(findChartComponent().exists()).toBe(true);
|
|
|
|
});
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('receives data properties needed for proper chart render', () => {
|
|
|
|
const props = findChartComponent().props();
|
2020-02-13 15:08:52 +00:00
|
|
|
|
2020-05-29 18:08:26 +00:00
|
|
|
expect(props.data).toBe(wrapper.vm.chartData);
|
|
|
|
expect(props.option).toBe(wrapper.vm.chartOptions);
|
|
|
|
expect(props.formatTooltipText).toBe(wrapper.vm.formatTooltipText);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('receives a tooltip title', async () => {
|
2020-02-24 18:09:05 +00:00
|
|
|
const mockTitle = 'mockTitle';
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.tooltip.title = mockTitle;
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
expect(
|
|
|
|
shallowWrapperContainsSlotText(findChartComponent(), 'tooltip-title', mockTitle),
|
|
|
|
).toBe(true);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('when tooltip is showing deployment data', () => {
|
|
|
|
const mockSha = 'mockSha';
|
|
|
|
const commitUrl = `${mockProjectDir}/-/commit/${mockSha}`;
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2021-12-29 15:10:45 +00:00
|
|
|
// setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.setData({
|
2020-04-09 09:10:17 +00:00
|
|
|
tooltip: {
|
|
|
|
type: 'deployments',
|
|
|
|
},
|
|
|
|
});
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
it('uses deployment title', () => {
|
|
|
|
expect(
|
2020-11-16 21:09:02 +00:00
|
|
|
shallowWrapperContainsSlotText(findChartComponent(), 'tooltip-title', 'Deployed'),
|
2020-02-24 18:09:05 +00:00
|
|
|
).toBe(true);
|
|
|
|
});
|
2019-11-13 18:06:51 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
it('renders clickable commit sha in tooltip content', async () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
wrapper.vm.tooltip.sha = mockSha;
|
|
|
|
wrapper.vm.tooltip.commitUrl = commitUrl;
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
|
|
|
const commitLink = wrapper.find(GlLink);
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
expect(shallowWrapperContainsSlotText(commitLink, 'default', mockSha)).toBe(true);
|
|
|
|
expect(commitLink.attributes('href')).toEqual(commitUrl);
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
|
2020-02-24 18:09:05 +00:00
|
|
|
describe('with multiple time series', () => {
|
|
|
|
describe('General functions', () => {
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-07-09 09:09:27 +00:00
|
|
|
const graphData = timeSeriesGraphData({ type: panelTypes.AREA_CHART, multiMetric: true });
|
2020-02-27 00:09:19 +00:00
|
|
|
|
2020-07-09 09:09:27 +00:00
|
|
|
createWrapper({ graphData }, mount);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
2020-04-01 18:07:56 +00:00
|
|
|
describe('Color match', () => {
|
|
|
|
let lineColors;
|
2020-02-24 18:09:05 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2020-12-23 21:10:24 +00:00
|
|
|
lineColors = wrapper.find(GlAreaChart).vm.series.map((item) => item.lineStyle.color);
|
2020-04-01 18:07:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should contain different colors for contiguous time series', () => {
|
|
|
|
lineColors.forEach((color, index) => {
|
|
|
|
expect(color).not.toBe(lineColors[index + 1]);
|
|
|
|
});
|
2020-02-24 18:09:05 +00:00
|
|
|
});
|
|
|
|
|
2020-04-01 18:07:56 +00:00
|
|
|
it('should match series color with tooltip label color', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const labels = wrapper.findAll(GlChartSeriesLabel);
|
2020-04-01 18:07:56 +00:00
|
|
|
|
|
|
|
lineColors.forEach((color, index) => {
|
|
|
|
const labelColor = labels.at(index).props('color');
|
|
|
|
expect(color).toBe(labelColor);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should match series color with legend color', () => {
|
2020-05-29 18:08:26 +00:00
|
|
|
const legendColors = wrapper
|
2020-04-01 18:07:56 +00:00
|
|
|
.find(GlChartLegend)
|
|
|
|
.props('seriesInfo')
|
2020-12-23 21:10:24 +00:00
|
|
|
.map((item) => item.color);
|
2020-04-01 18:07:56 +00:00
|
|
|
|
|
|
|
lineColors.forEach((color, index) => {
|
|
|
|
expect(color).toBe(legendColors[index]);
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-06-16 18:09:01 +00:00
|
|
|
|
|
|
|
describe('legend layout', () => {
|
|
|
|
const findLegend = () => wrapper.find(GlChartLegend);
|
|
|
|
|
2022-01-25 12:14:14 +00:00
|
|
|
beforeEach(async () => {
|
2020-07-09 09:09:27 +00:00
|
|
|
createWrapper({}, mount);
|
2022-01-25 12:14:14 +00:00
|
|
|
await nextTick();
|
2020-06-16 18:09:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a tabular legend layout by default', () => {
|
|
|
|
expect(findLegend().props('layout')).toBe('table');
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when inline legend layout prop is set', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper.setProps({
|
|
|
|
legendLayout: 'inline',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render an inline legend layout', () => {
|
|
|
|
expect(findLegend().props('layout')).toBe('inline');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when table legend layout prop is set', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper.setProps({
|
|
|
|
legendLayout: 'table',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render a tabular legend layout', () => {
|
|
|
|
expect(findLegend().props('layout')).toBe('table');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2019-08-21 13:43:01 +00:00
|
|
|
});
|