Commit d344d378 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'jnnkl-vulnerability-survey-flag-reintroduce' into 'master'

Reintroduced  vulnerability_management_survey for survey Banner

See merge request gitlab-org/gitlab!77745
parents 72e4dc4a e44769da
...@@ -11,14 +11,20 @@ import { ...@@ -11,14 +11,20 @@ import {
} from 'ee/security_dashboard/constants'; } from 'ee/security_dashboard/constants';
import SurveyBanner from 'ee/vue_shared/survey_banner/survey_banner.vue'; import SurveyBanner from 'ee/vue_shared/survey_banner/survey_banner.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
name: 'VulnManagementFeatureSurvey', name: 'VulnManagementFeatureSurvey',
components: { components: {
SurveyBanner, SurveyBanner,
}, },
mixins: [glFeatureFlagsMixin()],
inject: ['surveyRequestSvgPath'], inject: ['surveyRequestSvgPath'],
computed: {
shouldShowSurveyBanner() {
return this.glFeatures.vulnerabilityManagementSurvey;
},
},
storageKey: SURVEY_BANNER_LOCAL_STORAGE_KEY, storageKey: SURVEY_BANNER_LOCAL_STORAGE_KEY,
surveyLink: SURVEY_LINK, surveyLink: SURVEY_LINK,
daysToAskLater: SURVEY_DAYS_TO_ASK_LATER, daysToAskLater: SURVEY_DAYS_TO_ASK_LATER,
...@@ -32,6 +38,7 @@ export default { ...@@ -32,6 +38,7 @@ export default {
<template> <template>
<survey-banner <survey-banner
v-if="shouldShowSurveyBanner"
:svg-path="surveyRequestSvgPath" :svg-path="surveyRequestSvgPath"
:survey-link="$options.surveyLink" :survey-link="$options.surveyLink"
:days-to-ask-later="$options.daysToAskLater" :days-to-ask-later="$options.daysToAskLater"
......
...@@ -20,10 +20,15 @@ describe('SurveyRequestBanner Component', () => { ...@@ -20,10 +20,15 @@ describe('SurveyRequestBanner Component', () => {
const SURVEY_REQUEST_SVG_PATH = 'foo.svg'; const SURVEY_REQUEST_SVG_PATH = 'foo.svg';
const createComponent = (sbomSurvey = { sbomSurvey: true }) => { const createComponent = (
vulnerabilityManagementSurvey = { vulnerabilityManagementSurvey: true },
) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
mount(SurveyRequestBanner, { mount(SurveyRequestBanner, {
provide: { glFeatures: { ...sbomSurvey }, surveyRequestSvgPath: SURVEY_REQUEST_SVG_PATH }, provide: {
glFeatures: { ...vulnerabilityManagementSurvey },
surveyRequestSvgPath: SURVEY_REQUEST_SVG_PATH,
},
}), }),
); );
}; };
...@@ -36,6 +41,7 @@ describe('SurveyRequestBanner Component', () => { ...@@ -36,6 +41,7 @@ describe('SurveyRequestBanner Component', () => {
createComponent(); createComponent();
}); });
describe('given a true vulnerability_management_survey flag', () => {
it('renders the SurveyRequestBanner component with the right props', () => { it('renders the SurveyRequestBanner component with the right props', () => {
const surveyBanner = findSharedSurveyBanner(); const surveyBanner = findSharedSurveyBanner();
expect(surveyBanner.exists()).toBe(true); expect(surveyBanner.exists()).toBe(true);
...@@ -52,4 +58,16 @@ describe('SurveyRequestBanner Component', () => { ...@@ -52,4 +58,16 @@ describe('SurveyRequestBanner Component', () => {
expect(surveyBanner.props('buttonText')).toContain(SURVEY_BUTTON_TEXT); expect(surveyBanner.props('buttonText')).toContain(SURVEY_BUTTON_TEXT);
expect(surveyBanner.props('description')).toContain(SURVEY_DESCRIPTION); 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);
});
});
}); });
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