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
e44769da
Commit
e44769da
authored
Jan 10, 2022
by
Jannik Lehmann
Committed by
Natalia Tepluhina
Jan 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reintroduced vulnerability_management_survey for survey Banner
parent
e360c3ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
17 deletions
+42
-17
ee/app/assets/javascripts/security_dashboard/components/shared/survey_request_banner.vue
...ity_dashboard/components/shared/survey_request_banner.vue
+8
-1
ee/spec/frontend/security_dashboard/components/shared/survey_request_banner_spec.js
...dashboard/components/shared/survey_request_banner_spec.js
+34
-16
No files found.
ee/app/assets/javascripts/security_dashboard/components/shared/survey_request_banner.vue
View file @
e44769da
...
...
@@ -11,14 +11,20 @@ import {
}
from
'
ee/security_dashboard/constants
'
;
import
SurveyBanner
from
'
ee/vue_shared/survey_banner/survey_banner.vue
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
export
default
{
name
:
'
VulnManagementFeatureSurvey
'
,
components
:
{
SurveyBanner
,
},
mixins
:
[
glFeatureFlagsMixin
()],
inject
:
[
'
surveyRequestSvgPath
'
],
computed
:
{
shouldShowSurveyBanner
()
{
return
this
.
glFeatures
.
vulnerabilityManagementSurvey
;
},
},
storageKey
:
SURVEY_BANNER_LOCAL_STORAGE_KEY
,
surveyLink
:
SURVEY_LINK
,
daysToAskLater
:
SURVEY_DAYS_TO_ASK_LATER
,
...
...
@@ -32,6 +38,7 @@ export default {
<
template
>
<survey-banner
v-if=
"shouldShowSurveyBanner"
:svg-path=
"surveyRequestSvgPath"
:survey-link=
"$options.surveyLink"
:days-to-ask-later=
"$options.daysToAskLater"
...
...
ee/spec/frontend/security_dashboard/components/shared/survey_request_banner_spec.js
View file @
e44769da
...
...
@@ -20,10 +20,15 @@ describe('SurveyRequestBanner Component', () => {
const
SURVEY_REQUEST_SVG_PATH
=
'
foo.svg
'
;
const
createComponent
=
(
sbomSurvey
=
{
sbomSurvey
:
true
})
=>
{
const
createComponent
=
(
vulnerabilityManagementSurvey
=
{
vulnerabilityManagementSurvey
:
true
},
)
=>
{
wrapper
=
extendedWrapper
(
mount
(
SurveyRequestBanner
,
{
provide
:
{
glFeatures
:
{
...
sbomSurvey
},
surveyRequestSvgPath
:
SURVEY_REQUEST_SVG_PATH
},
provide
:
{
glFeatures
:
{
...
vulnerabilityManagementSurvey
},
surveyRequestSvgPath
:
SURVEY_REQUEST_SVG_PATH
,
},
}),
);
};
...
...
@@ -36,20 +41,33 @@ describe('SurveyRequestBanner Component', () => {
createComponent
();
});
it
(
'
renders the SurveyRequestBanner component with the right props
'
,
()
=>
{
const
surveyBanner
=
findSharedSurveyBanner
();
expect
(
surveyBanner
.
exists
()).
toBe
(
true
);
expect
(
surveyBanner
.
props
()).
toMatchObject
({
bannerId
:
SURVEY_BANNER_CURRENT_ID
,
storageKey
:
SURVEY_BANNER_LOCAL_STORAGE_KEY
,
daysToAskLater
:
SURVEY_DAYS_TO_ASK_LATER
,
surveyLink
:
SURVEY_LINK
,
svgPath
:
SURVEY_REQUEST_SVG_PATH
,
title
:
SURVEY_TITLE
,
toastMessage
:
SURVEY_TOAST_MESSAGE
,
describe
(
'
given a true vulnerability_management_survey flag
'
,
()
=>
{
it
(
'
renders the SurveyRequestBanner component with the right props
'
,
()
=>
{
const
surveyBanner
=
findSharedSurveyBanner
();
expect
(
surveyBanner
.
exists
()).
toBe
(
true
);
expect
(
surveyBanner
.
props
()).
toMatchObject
({
bannerId
:
SURVEY_BANNER_CURRENT_ID
,
storageKey
:
SURVEY_BANNER_LOCAL_STORAGE_KEY
,
daysToAskLater
:
SURVEY_DAYS_TO_ASK_LATER
,
surveyLink
:
SURVEY_LINK
,
svgPath
:
SURVEY_REQUEST_SVG_PATH
,
title
:
SURVEY_TITLE
,
toastMessage
:
SURVEY_TOAST_MESSAGE
,
});
expect
(
surveyBanner
.
props
(
'
buttonText
'
)).
toContain
(
SURVEY_BUTTON_TEXT
);
expect
(
surveyBanner
.
props
(
'
description
'
)).
toContain
(
SURVEY_DESCRIPTION
);
});
});
describe
(
'
given a false vulnerability_management_survey flag
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
vulnerabilityManagementSurvey
:
false
});
});
it
(
'
does not renders the SurveyRequestBanner
'
,
()
=>
{
const
surveyBanner
=
findSharedSurveyBanner
();
expect
(
surveyBanner
.
exists
()).
toBe
(
false
);
});
expect
(
surveyBanner
.
props
(
'
buttonText
'
)).
toContain
(
SURVEY_BUTTON_TEXT
);
expect
(
surveyBanner
.
props
(
'
description
'
)).
toContain
(
SURVEY_DESCRIPTION
);
});
});
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