Commit c6118524 authored by mfluharty's avatar mfluharty

Only render "No artifacts found" when not loading

In artifacts dropdown on pipelines list page

Changelog: fixed
parent 751d82f7
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
<gl-loading-icon v-if="isLoading" size="sm" /> <gl-loading-icon v-if="isLoading" size="sm" />
<gl-dropdown-item v-if="!artifacts.length" data-testid="artifacts-empty-message"> <gl-dropdown-item v-if="!artifacts.length && !isLoading" data-testid="artifacts-empty-message">
{{ $options.i18n.emptyArtifactsMessage }} {{ $options.i18n.emptyArtifactsMessage }}
</gl-dropdown-item> </gl-dropdown-item>
......
import { GlAlert, GlDropdown, GlSprintf } from '@gitlab/ui'; import { GlAlert, GlDropdown, GlSprintf, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
...@@ -51,6 +51,7 @@ describe('Pipeline Multi Actions Dropdown', () => { ...@@ -51,6 +51,7 @@ describe('Pipeline Multi Actions Dropdown', () => {
const findAlert = () => wrapper.findComponent(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
const findDropdown = () => wrapper.findComponent(GlDropdown); const findDropdown = () => wrapper.findComponent(GlDropdown);
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findAllArtifactItems = () => wrapper.findAllByTestId(artifactItemTestId); const findAllArtifactItems = () => wrapper.findAllByTestId(artifactItemTestId);
const findFirstArtifactItem = () => wrapper.findByTestId(artifactItemTestId); const findFirstArtifactItem = () => wrapper.findByTestId(artifactItemTestId);
const findEmptyMessage = () => wrapper.findByTestId('artifacts-empty-message'); const findEmptyMessage = () => wrapper.findByTestId('artifacts-empty-message');
...@@ -103,6 +104,15 @@ describe('Pipeline Multi Actions Dropdown', () => { ...@@ -103,6 +104,15 @@ describe('Pipeline Multi Actions Dropdown', () => {
expect(findEmptyMessage().exists()).toBe(true); expect(findEmptyMessage().exists()).toBe(true);
}); });
describe('while loading artifacts', () => {
it('should render a loading spinner and no empty message', () => {
createComponent({ mockData: { isLoading: true, artifacts: [] } });
expect(findLoadingIcon().exists()).toBe(true);
expect(findEmptyMessage().exists()).toBe(false);
});
});
describe('with a failing request', () => { describe('with a failing request', () => {
it('should render an error message', async () => { it('should render an error message', async () => {
const endpoint = artifactsEndpoint.replace(artifactsEndpointPlaceholder, pipelineId); const endpoint = artifactsEndpoint.replace(artifactsEndpointPlaceholder, pipelineId);
......
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