Commit a2486975 authored by Fernando's avatar Fernando

Add unit tests for descriptions

* Add specs
parent deb63d42
......@@ -89,7 +89,7 @@ export default {
v-for="option in $options.approvalStatusOptions"
:key="option.value"
class="form-check"
v-bind:class="{ 'mb-3': isDescriptionEnabled }"
:class="{ 'mb-3': isDescriptionEnabled }"
>
<input
:id="`js-${option.value}-license-radio`"
......
......@@ -11,6 +11,7 @@ describe('AddLicenseForm', () => {
const findCancelButton = () => vm.$el.querySelector('.js-cancel');
beforeEach(() => {
window.gon = { features: { licenseComplianceDeniesMr: false } };
vm = mountComponent(Component);
});
......@@ -121,6 +122,35 @@ describe('AddLicenseForm', () => {
});
});
it('shows dropdown descriptions, if licenseComplianceDeniesMr feature flag is enabled', done => {
window.gon = { features: { licenseComplianceDeniesMr: true } };
vm = mountComponent(Component, { managedLicenses: [{ name: 'FOO' }] });
vm.licenseName = 'FOO';
Vue.nextTick(() => {
const feedbackElement = vm.$el.querySelectorAll('.text-secondary');
expect(feedbackElement[0].innerText.trim()).toBe(
'Acceptable license to be used in the project',
);
expect(feedbackElement[1].innerText.trim()).toBe(
'Disallow merge request if detected and will instruct developer to remove',
);
done();
});
});
it('does not show dropdown descriptions, if licenseComplianceDeniesMr feature flag is disabled', done => {
vm = mountComponent(Component, { managedLicenses: [{ name: 'FOO' }] });
vm.licenseName = 'FOO';
Vue.nextTick(() => {
const feedbackElement = vm.$el.querySelectorAll('.text-secondary');
expect(feedbackElement.length).toBe(0);
done();
});
});
it('disables submit, if the form is invalid', done => {
vm.licenseName = '';
Vue.nextTick(() => {
......
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