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 {
} 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"
......
......@@ -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);
});
});
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