Commit 6532a096 authored by Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski Committed by Kushal Pandya

Hide Request subtitle when Threat Monitoring has no data

parent eb021719
...@@ -101,12 +101,12 @@ export default { ...@@ -101,12 +101,12 @@ export default {
<template> <template>
<div class="my-3"> <div class="my-3">
<h4 class="h4">{{ title }}</h4> <h4 ref="chartTitle" class="h4">{{ title }}</h4>
<h5 class="h5">{{ subtitle }}</h5>
<loading-skeleton v-if="isLoading" class="mt-3" /> <loading-skeleton v-if="isLoading" class="mt-3" />
<template v-else-if="hasHistory"> <template v-else-if="hasHistory">
<h5 ref="chartSubtitle" class="h5">{{ subtitle }}</h5>
<statistics-summary class="mt-3" :data="summary" /> <statistics-summary class="mt-3" :data="summary" />
<statistics-history class="mt-3" :data="chart" :y-legend="yLegend" /> <statistics-history class="mt-3" :data="chart" :y-legend="yLegend" />
</template> </template>
......
---
title: Hide Request subtitle when Threat Monitoring has no data
merge_request: 28760
author:
type: fixed
...@@ -55,6 +55,8 @@ describe('ThreatMonitoringSection component', () => { ...@@ -55,6 +55,8 @@ describe('ThreatMonitoringSection component', () => {
const findStatisticsHistory = () => wrapper.find(StatisticsHistory); const findStatisticsHistory = () => wrapper.find(StatisticsHistory);
const findStatisticsSummary = () => wrapper.find(StatisticsSummary); const findStatisticsSummary = () => wrapper.find(StatisticsSummary);
const findChartEmptyState = () => wrapper.find({ ref: 'chartEmptyState' }); const findChartEmptyState = () => wrapper.find({ ref: 'chartEmptyState' });
const findChartTitle = () => wrapper.find({ ref: 'chartTitle' });
const findChartSubtitle = () => wrapper.find({ ref: 'chartSubtitle' });
beforeEach(() => { beforeEach(() => {
factory({}); factory({});
...@@ -96,6 +98,14 @@ describe('ThreatMonitoringSection component', () => { ...@@ -96,6 +98,14 @@ describe('ThreatMonitoringSection component', () => {
expect(chart.props('yLegend')).toEqual('Requests'); expect(chart.props('yLegend')).toEqual('Requests');
}); });
it('shows the chart title', () => {
expect(findChartTitle().exists()).toBe(true);
});
it('shows the chart subtitle', () => {
expect(findChartSubtitle().exists()).toBe(true);
});
it('does not show the chart empty state', () => { it('does not show the chart empty state', () => {
expect(findChartEmptyState().exists()).toBe(false); expect(findChartEmptyState().exists()).toBe(false);
}); });
...@@ -116,6 +126,14 @@ describe('ThreatMonitoringSection component', () => { ...@@ -116,6 +126,14 @@ describe('ThreatMonitoringSection component', () => {
expect(findStatisticsHistory().exists()).toBe(false); expect(findStatisticsHistory().exists()).toBe(false);
}); });
it('shows the chart title', () => {
expect(findChartTitle().exists()).toBe(true);
});
it('does not show the chart subtitle', () => {
expect(findChartSubtitle().exists()).toBe(false);
});
it('does not show the chart empty state', () => { it('does not show the chart empty state', () => {
expect(findChartEmptyState().exists()).toBe(false); expect(findChartEmptyState().exists()).toBe(false);
}); });
...@@ -143,6 +161,14 @@ describe('ThreatMonitoringSection component', () => { ...@@ -143,6 +161,14 @@ describe('ThreatMonitoringSection component', () => {
expect(findStatisticsHistory().exists()).toBe(false); expect(findStatisticsHistory().exists()).toBe(false);
}); });
it('shows the chart title', () => {
expect(findChartTitle().exists()).toBe(true);
});
it('does not show the chart subtitle', () => {
expect(findChartSubtitle().exists()).toBe(false);
});
it('shows the chart empty state', () => { it('shows the chart empty state', () => {
expect(findChartEmptyState().element).toMatchSnapshot(); expect(findChartEmptyState().element).toMatchSnapshot();
}); });
......
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