Skip to content
Snippets Groups Projects
Commit 650e8107 authored by Miranda Fluharty's avatar Miranda Fluharty
Browse files

Hide exposed artifacts when there are none

Changelog: fixed
parent 2f41c4c9
1 merge request!143698Hide exposed artifacts when there are none
......@@ -20,6 +20,9 @@ export default {
computed: {
...mapState(['artifacts', 'isLoading', 'hasError']),
...mapGetters(['title']),
hasArtifacts() {
return this.artifacts.length > 0;
},
},
created() {
this.setEndpoint(this.endpoint);
......@@ -31,7 +34,12 @@ export default {
};
</script>
<template>
<mr-collapsible-extension :title="title" :is-loading="isLoading" :has-error="hasError">
<mr-collapsible-extension
v-if="isLoading || hasArtifacts || hasError"
:title="title"
:is-loading="isLoading"
:has-error="hasError"
>
<artifacts-list :artifacts="artifacts" />
</mr-collapsible-extension>
</template>
......@@ -107,6 +107,23 @@ describe('Merge Requests Artifacts list app', () => {
});
});
describe('with 0 artifacts', () => {
beforeEach(() => {
createComponent();
mock.onGet(FAKE_ENDPOINT).reply(HTTP_STATUS_OK, [], {});
store.dispatch('receiveArtifactsSuccess', {
data: [],
status: HTTP_STATUS_OK,
});
return nextTick();
});
it('does not render', () => {
expect(findTitle().exists()).toBe(false);
expect(findButtons().exists()).toBe(false);
});
});
describe('with error', () => {
beforeEach(() => {
createComponent();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment