Commit 908b60b5 authored by Savas Vedova's avatar Savas Vedova

Merge branch 'Remove-license-compliance-feature-flag-reference' into 'master'

Remove license compliance feature flag reference

See merge request gitlab-org/gitlab!74143
parents 036a22f3 efc06841
......@@ -58,9 +58,6 @@ export default {
submitDisabled() {
return this.isInvalidLicense || this.licenseName.trim() === '' || this.approvalStatus === '';
},
isDescriptionEnabled() {
return Boolean(this.glFeatures.licenseComplianceDeniesMr);
},
},
methods: {
addLicense() {
......@@ -99,10 +96,10 @@ export default {
:value="option.value"
:data-qa-selector="`${option.value}_license_radio`"
:aria-describedby="`js-${option.value}-license-radio`"
:class="{ 'mb-3': isDescriptionEnabled }"
class="gl-mb-3"
>
{{ option.label }}
<div v-if="isDescriptionEnabled" class="text-secondary">
<div class="text-secondary">
{{ option.description }}
</div>
</gl-form-radio>
......
......@@ -46,9 +46,6 @@ export default {
showLoadingSpinner() {
return this.isLoadingManagedLicenses && !this.hasPendingLicenses;
},
isTooltipEnabled() {
return Boolean(this.glFeatures.licenseComplianceDeniesMr);
},
},
watch: {
isAddingNewLicense(isAddingNewLicense) {
......@@ -104,13 +101,12 @@ export default {
</div>
<template v-else>
<div class="table-section gl-d-flex gl-pl-2 section-70" role="rowheader">
<div class="table-section gl-display-flex gl-pl-2 section-70" role="rowheader">
{{ s__('Licenses|Policy') }}
<template v-if="isTooltipEnabled">
<gl-icon
ref="reportInfo"
name="question"
class="text-info gl-ml-1 gl-cursor-pointer"
class="text-info gl-ml-2 gl-cursor-pointer"
:aria-label="__('help')"
:size="14"
/>
......@@ -128,12 +124,11 @@ export default {
<span class="text-secondary">
{{
s__(
'Licenses|Disallow Merge request if detected and will instruct the developer to remove',
"Licenses|Unacceptable license, if detected it will disallow a merge request until it's removed",
)
}}</span
>
</gl-popover>
</template>
</div>
<div class="table-section section-30" role="rowheader">
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddLicenseForm template does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled 1`] = `
<gl-form-radio-stub
aria-describedby="js-approved-license-radio"
class=""
data-qa-selector="approved_license_radio"
value="approved"
>
Allow
<!---->
</gl-form-radio-stub>
`;
exports[`AddLicenseForm template does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled 2`] = `
<gl-form-radio-stub
aria-describedby="js-blacklisted-license-radio"
class=""
data-qa-selector="blacklisted_license_radio"
value="blacklisted"
>
Deny
<!---->
</gl-form-radio-stub>
`;
......@@ -103,12 +103,25 @@ describe('AddLicenseForm', () => {
expect(dropdownElement.exists()).toBe(true);
});
it('renders the license approval radio buttons dropdown', () => {
describe('license approval radio list', () => {
it('renders the correct approval options', () => {
const approvalOptions = findRadioInputs();
expect(approvalOptions).toHaveLength(2);
expect(approvalOptions.at(0).text()).toBe('Allow');
expect(approvalOptions.at(1).text()).toBe('Deny');
expect(approvalOptions.at(0).text()).toContain('Allow');
expect(approvalOptions.at(1).text()).toContain('Deny');
});
it('renders the approval option descriptions', () => {
const approvalOptions = findRadioInputs();
expect(approvalOptions.at(0).text()).toContain(
'Acceptable license to be used in the project',
);
expect(approvalOptions.at(1).text()).toContain(
'Disallow merge request if detected and will instruct developer to remove',
);
});
});
it('renders error text, if there is a duplicate license', async () => {
......@@ -123,15 +136,12 @@ describe('AddLicenseForm', () => {
expect(feedbackElement.text()).toBe('This license already exists in this project.');
});
it('shows radio button descriptions, if licenseComplianceDeniesMr feature flag is enabled', async () => {
it('shows radio button descriptions', async () => {
wrapper = shallowMount(LicenseIssueBody, {
propsData: {
managedLicenses: [{ name: 'FOO' }],
knownLicenses: KNOWN_LICENSES,
},
provide: {
glFeatures: { licenseComplianceDeniesMr: true },
},
});
await Vue.nextTick();
......@@ -145,15 +155,6 @@ describe('AddLicenseForm', () => {
);
});
it('does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled', () => {
createComponent({ managedLicenses: [{ name: 'FOO' }] });
wrapper.setData({ licenseName: 'FOO' });
return Vue.nextTick().then(() => {
expect(findRadioInputs().at(0).element).toMatchSnapshot();
expect(findRadioInputs().at(1).element).toMatchSnapshot();
});
});
it('disables submit, if the form is invalid', async () => {
wrapper.setData({ licenseName: '' });
await Vue.nextTick();
......
......@@ -66,7 +66,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin, options,
PaginatedList,
},
provide: {
glFeatures: { licenseComplianceDeniesMr: false },
...provide,
},
store: fakeStore,
......@@ -176,23 +175,15 @@ describe('License Management', () => {
});
});
describe.each([true, false])(
'when licenseComplianceDeniesMr feature flag is %p',
(licenseComplianceDeniesMr) => {
it('should not show the developer only tooltip', () => {
createComponent({
state: { isLoadingManagedLicenses: false },
isAdmin: true,
provide: {
glFeatures: { licenseComplianceDeniesMr },
},
});
expect(findIcon().exists()).toBe(false);
expect(findPopover().exists()).toBe(false);
});
},
);
});
describe('when developer', () => {
......@@ -232,27 +223,15 @@ describe('License Management', () => {
});
});
describe.each`
licenseComplianceDeniesMr | should
${true} | ${'should'}
${false} | ${'should not'}
`(
'when licenseComplianceDeniesMr feature flag is $licenseComplianceDeniesMr',
({ licenseComplianceDeniesMr, should }) => {
it(`${should} show the developer only tooltip`, () => {
it('should show the developer only tooltip', () => {
createComponent({
state: { isLoadingManagedLicenses: false },
isAdmin: false,
provide: {
glFeatures: { licenseComplianceDeniesMr },
},
});
expect(findIcon().exists()).toBe(licenseComplianceDeniesMr);
expect(findPopover().exists()).toBe(licenseComplianceDeniesMr);
expect(findIcon().exists()).toBe(true);
expect(findPopover().exists()).toBe(true);
});
},
);
});
});
});
......@@ -20748,9 +20748,6 @@ msgstr ""
msgid "Licenses|Detected licenses that are out-of-compliance with the project's assigned policies"
msgstr ""
msgid "Licenses|Disallow Merge request if detected and will instruct the developer to remove"
msgstr ""
msgid "Licenses|Displays licenses detected in the project, based on the %{linkStart}latest successful%{linkEnd} scan"
msgstr ""
......@@ -20778,6 +20775,9 @@ msgstr ""
msgid "Licenses|The license list details information about the licenses used within your project."
msgstr ""
msgid "Licenses|Unacceptable license, if detected it will disallow a merge request until it's removed"
msgstr ""
msgid "Licenses|View license details for your project"
msgstr ""
......
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