Commit e259b614 authored by Savas Vedova's avatar Savas Vedova

Do not display the export button while loading

parent 111b6286
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
<header class="page-title-holder flex-fill d-flex align-items-center"> <header class="page-title-holder flex-fill d-flex align-items-center">
<h2 class="page-title flex-grow">{{ s__('SecurityReports|Security Dashboard') }}</h2> <h2 class="page-title flex-grow">{{ s__('SecurityReports|Security Dashboard') }}</h2>
<csv-export-button <csv-export-button
v-if="!shouldShowEmptyState" v-if="shouldShowDashboard"
:vulnerabilities-export-endpoint="vulnerabilitiesExportEndpoint" :vulnerabilities-export-endpoint="vulnerabilitiesExportEndpoint"
/> />
<gl-button <gl-button
......
---
title: Do not display the export button while projects are loading
merge_request: 37573
author:
type: fixed
...@@ -13,7 +13,9 @@ import DashboardNotConfigured from 'ee/security_dashboard/components/empty_state ...@@ -13,7 +13,9 @@ import DashboardNotConfigured from 'ee/security_dashboard/components/empty_state
describe('First Class Instance Dashboard Component', () => { describe('First Class Instance Dashboard Component', () => {
let wrapper; let wrapper;
const defaultMocks = { $apollo: { queries: { projects: { loading: false } } } }; const defaultMocks = ({ loading = false } = {}) => ({
$apollo: { queries: { projects: { loading } } },
});
const vulnerableProjectsEndpoint = '/vulnerable/projects'; const vulnerableProjectsEndpoint = '/vulnerable/projects';
const vulnerabilitiesExportEndpoint = '/vulnerabilities/exports'; const vulnerabilitiesExportEndpoint = '/vulnerabilities/exports';
...@@ -26,12 +28,12 @@ describe('First Class Instance Dashboard Component', () => { ...@@ -26,12 +28,12 @@ describe('First Class Instance Dashboard Component', () => {
const findEmptyState = () => wrapper.find(DashboardNotConfigured); const findEmptyState = () => wrapper.find(DashboardNotConfigured);
const findFilters = () => wrapper.find(Filters); const findFilters = () => wrapper.find(Filters);
const createWrapper = ({ data = {}, stubs }) => { const createWrapper = ({ data = {}, stubs, mocks = defaultMocks() }) => {
return shallowMount(FirstClassInstanceDashboard, { return shallowMount(FirstClassInstanceDashboard, {
data() { data() {
return { ...data }; return { ...data };
}, },
mocks: { ...defaultMocks }, mocks,
propsData: { propsData: {
vulnerableProjectsEndpoint, vulnerableProjectsEndpoint,
vulnerabilitiesExportEndpoint, vulnerabilitiesExportEndpoint,
...@@ -91,15 +93,26 @@ describe('First Class Instance Dashboard Component', () => { ...@@ -91,15 +93,26 @@ describe('First Class Instance Dashboard Component', () => {
}); });
}); });
describe('when loading projects', () => {
beforeEach(() => {
wrapper = createWrapper({
mocks: defaultMocks({ loading: true }),
data: {
projects: [{ id: 1 }],
},
});
});
it('does not render the export button', () => {
expect(findCsvExportButton().exists()).toBe(false);
});
});
describe('when uninitialized', () => { describe('when uninitialized', () => {
beforeEach(() => { beforeEach(() => {
wrapper = createWrapper({ wrapper = createWrapper({
data: { data: {
isManipulatingProjects: false, isManipulatingProjects: false,
stubs: {
DashboardNotConfigured,
GlButton,
},
}, },
}); });
}); });
......
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