Commit 9b14e2d7 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '346060-create-configuration-security-training-add-info-popover' into 'master'

Add info tooltip to sec primary config

See merge request gitlab-org/gitlab!82457
parents d4762348 c35d807b
<script> <script>
import { GlAlert, GlCard, GlToggle, GlLink, GlSkeletonLoader } from '@gitlab/ui'; import {
GlAlert,
GlTooltipDirective,
GlCard,
GlToggle,
GlLink,
GlSkeletonLoader,
GlIcon,
} from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
...@@ -25,6 +33,9 @@ const i18n = { ...@@ -25,6 +33,9 @@ const i18n = {
'Could not save configuration. Please refresh the page, or try again later.', 'Could not save configuration. Please refresh the page, or try again later.',
), ),
primaryTraining: s__('SecurityTraining|Primary Training'), primaryTraining: s__('SecurityTraining|Primary Training'),
primaryTrainingDescription: s__(
'SecurityTraining|Training from this partner takes precedence when more than one training partner is enabled.',
),
}; };
// Fetch the svg path from the GraphQL query once this issue is resolved // Fetch the svg path from the GraphQL query once this issue is resolved
...@@ -45,6 +56,10 @@ export default { ...@@ -45,6 +56,10 @@ export default {
GlToggle, GlToggle,
GlLink, GlLink,
GlSkeletonLoader, GlSkeletonLoader,
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
}, },
mixins: [Tracking.mixin()], mixins: [Tracking.mixin()],
inject: ['projectFullPath'], inject: ['projectFullPath'],
...@@ -251,7 +266,6 @@ export default { ...@@ -251,7 +266,6 @@ export default {
:id="`security-training-provider-${provider.id}`" :id="`security-training-provider-${provider.id}`"
type="radio" type="radio"
:checked="provider.isPrimary" :checked="provider.isPrimary"
name="radio-group-name"
class="custom-control-input" class="custom-control-input"
:disabled="!provider.isEnabled" :disabled="!provider.isEnabled"
@change="setPrimaryProvider(provider)" @change="setPrimaryProvider(provider)"
...@@ -262,6 +276,11 @@ export default { ...@@ -262,6 +276,11 @@ export default {
> >
{{ $options.i18n.primaryTraining }} {{ $options.i18n.primaryTraining }}
</label> </label>
<gl-icon
v-gl-tooltip="$options.i18n.primaryTrainingDescription"
name="information-o"
class="gl-ml-2 gl-cursor-help"
/>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -33121,6 +33121,9 @@ msgstr "" ...@@ -33121,6 +33121,9 @@ msgstr ""
msgid "SecurityTraining|Primary Training" msgid "SecurityTraining|Primary Training"
msgstr "" msgstr ""
msgid "SecurityTraining|Training from this partner takes precedence when more than one training partner is enabled."
msgstr ""
msgid "See example DevOps Score page in our documentation." msgid "See example DevOps Score page in our documentation."
msgstr "" msgstr ""
......
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { GlAlert, GlLink, GlToggle, GlCard, GlSkeletonLoader } from '@gitlab/ui'; import { GlAlert, GlLink, GlToggle, GlCard, GlSkeletonLoader, GlIcon } from '@gitlab/ui';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { import {
TRACK_TOGGLE_TRAINING_PROVIDER_ACTION, TRACK_TOGGLE_TRAINING_PROVIDER_ACTION,
TRACK_TOGGLE_TRAINING_PROVIDER_LABEL, TRACK_TOGGLE_TRAINING_PROVIDER_LABEL,
...@@ -70,6 +71,9 @@ describe('TrainingProviderList component', () => { ...@@ -70,6 +71,9 @@ describe('TrainingProviderList component', () => {
provide: { provide: {
projectFullPath: testProjectPath, projectFullPath: testProjectPath,
}, },
directives: {
GlTooltip: createMockDirective(),
},
apolloProvider, apolloProvider,
}); });
}; };
...@@ -174,6 +178,16 @@ describe('TrainingProviderList component', () => { ...@@ -174,6 +178,16 @@ describe('TrainingProviderList component', () => {
); );
}); });
it('shows a info-tooltip that describes the purpose of a primary provider', () => {
const infoIcon = findPrimaryProviderRadios().at(index).find(GlIcon);
const tooltip = getBinding(infoIcon.element, 'gl-tooltip');
expect(infoIcon.props()).toMatchObject({
name: 'information-o',
});
expect(tooltip.value).toBe(TrainingProviderList.i18n.primaryTrainingDescription);
});
it('does not show loader when query is populated', () => { it('does not show loader when query is populated', () => {
expect(findLoader().exists()).toBe(false); expect(findLoader().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