Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2fdd9906
Commit
2fdd9906
authored
Jan 20, 2022
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add training item loading
Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/349670
parent
ec3e3942
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
...pts/vulnerabilities/components/vulnerability_training.vue
+3
-4
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
...c/frontend/vulnerabilities/vulnerability_training_spec.js
+11
-1
No files found.
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
View file @
2fdd9906
<
script
>
import
{
GlLink
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlLink
,
GlIcon
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
securityTrainingProvidersQuery
from
'
~/security_configuration/graphql/security_training_providers.query.graphql
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
...
...
@@ -27,6 +27,7 @@ export default {
components
:
{
GlLink
,
GlIcon
,
GlSkeletonLoader
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
...
...
@@ -112,9 +113,7 @@ export default {
{{
$options
.
i18n
.
trainingUnavailable
}}
</p>
<div
v-else-if=
"isLoading"
>
<!-- Loading skeleton will be added in a follow up issue
https://gitlab.com/gitlab-org/gitlab/-/issues/349670 -->
{{
$options
.
i18n
.
loading
}}
<gl-skeleton-loader
:width=
"200"
:lines=
"3"
/>
</div>
<div
v-else
>
<div
class=
"gl-font-weight-bold gl-font-base"
>
{{
training
.
name
}}
</div>
...
...
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
View file @
2fdd9906
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
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
httpStatus
from
'
~/lib/utils/http_status
'
;
...
...
@@ -58,6 +58,8 @@ describe('VulnerabilityTraining component', () => {
mock
.
restore
();
});
const
delayTrainingResponse
=
async
()
=>
mock
.
onGet
(
mockProvider
.
path
).
reply
(()
=>
new
Promise
(()
=>
{}));
const
mockTrainingSuccess
=
async
()
=>
mock
.
onGet
(
mockProvider
.
path
).
reply
(
httpStatus
.
OK
,
{
url
:
mockSuccessTrainingUrl
});
const
waitForQueryToBeLoaded
=
()
=>
waitForPromises
();
...
...
@@ -115,6 +117,14 @@ describe('VulnerabilityTraining component', () => {
});
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
()
=>
{
await
mockTrainingSuccess
();
createComponent
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment