Commit e7103152 authored by Phil Hughes's avatar Phil Hughes

Merge branch '349670-loading-training-item' into 'master'

Add training item loading in vulnerability details page

See merge request gitlab-org/gitlab!78709
parents 265b5914 2fdd9906
<script> <script>
import { GlLink, GlIcon } from '@gitlab/ui'; import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql'; import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -27,6 +27,7 @@ export default { ...@@ -27,6 +27,7 @@ export default {
components: { components: {
GlLink, GlLink,
GlIcon, GlIcon,
GlSkeletonLoader,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
props: { props: {
...@@ -112,9 +113,7 @@ export default { ...@@ -112,9 +113,7 @@ export default {
{{ $options.i18n.trainingUnavailable }} {{ $options.i18n.trainingUnavailable }}
</p> </p>
<div v-else-if="isLoading"> <div v-else-if="isLoading">
<!-- Loading skeleton will be added in a follow up issue <gl-skeleton-loader :width="200" :lines="3" />
https://gitlab.com/gitlab-org/gitlab/-/issues/349670 -->
{{ $options.i18n.loading }}
</div> </div>
<div v-else> <div v-else>
<div class="gl-font-weight-bold gl-font-base">{{ training.name }}</div> <div class="gl-font-weight-bold gl-font-base">{{ training.name }}</div>
......
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { GlLink, GlIcon } from '@gitlab/ui'; import { GlLink, GlIcon, GlSkeletonLoader } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
...@@ -58,6 +58,8 @@ describe('VulnerabilityTraining component', () => { ...@@ -58,6 +58,8 @@ describe('VulnerabilityTraining component', () => {
mock.restore(); mock.restore();
}); });
const delayTrainingResponse = async () =>
mock.onGet(mockProvider.path).reply(() => new Promise(() => {}));
const mockTrainingSuccess = async () => const mockTrainingSuccess = async () =>
mock.onGet(mockProvider.path).reply(httpStatus.OK, { url: mockSuccessTrainingUrl }); mock.onGet(mockProvider.path).reply(httpStatus.OK, { url: mockSuccessTrainingUrl });
const waitForQueryToBeLoaded = () => waitForPromises(); const waitForQueryToBeLoaded = () => waitForPromises();
...@@ -115,6 +117,14 @@ describe('VulnerabilityTraining component', () => { ...@@ -115,6 +117,14 @@ describe('VulnerabilityTraining component', () => {
}); });
describe('training item', () => { describe('training item', () => {
it('displays GlSkeletonLoader when loading', async () => {
await delayTrainingResponse();
createComponent();
await waitForQueryToBeLoaded();
expect(wrapper.findComponent(GlSkeletonLoader).exists()).toBe(true);
});
it('displays training item information', async () => { it('displays training item information', async () => {
await mockTrainingSuccess(); await mockTrainingSuccess();
createComponent(); createComponent();
......
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