Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
76dcf498
Commit
76dcf498
authored
Jul 01, 2020
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate unit test feedback
* Use feature flag mixin
parent
4a7242fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
ee/app/assets/javascripts/vue_shared/license_compliance/components/add_license_form.vue
...shared/license_compliance/components/add_license_form.vue
+4
-1
ee/spec/frontend/vue_shared/license_compliance/components/__snapshots__/add_license_form_spec.js.snap
...ce/components/__snapshots__/add_license_form_spec.js.snap
+3
-0
ee/spec/frontend/vue_shared/license_compliance/components/add_license_form_spec.js
...ed/license_compliance/components/add_license_form_spec.js
+16
-14
No files found.
ee/app/assets/javascripts/vue_shared/license_compliance/components/add_license_form.vue
View file @
76dcf498
<
script
>
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
GlDeprecatedButton
}
from
'
@gitlab/ui
'
;
import
LoadingButton
from
'
~/vue_shared/components/loading_button.vue
'
;
import
{
LICENSE_APPROVAL_STATUS
}
from
'
../constants
'
;
...
...
@@ -12,6 +13,7 @@ export default {
GlDeprecatedButton
,
LoadingButton
,
},
mixins
:
[
glFeatureFlagsMixin
()],
LICENSE_APPROVAL_STATUS
,
approvalStatusOptions
:
[
{
...
...
@@ -53,7 +55,7 @@ export default {
return
this
.
isInvalidLicense
||
this
.
licenseName
.
trim
()
===
''
||
this
.
approvalStatus
===
''
;
},
isDescriptionEnabled
()
{
return
gon
.
features
.
licenseComplianceDeniesMr
;
return
Boolean
(
this
.
glFeatures
.
licenseComplianceDeniesMr
)
;
},
},
methods
:
{
...
...
@@ -98,6 +100,7 @@ export default {
type="radio"
:data-qa-selector="`${option.value}_license_radio`"
:value="option.value"
:aria-describedby="`js-${option.value}-license-radio`"
/>
<label
:for=
"`js-$
{option.value}-license-radio`" class="form-check-label pt-1">
{{
option
.
label
}}
...
...
ee/spec/frontend/vue_shared/license_compliance/components/__snapshots__/add_license_form_spec.js.snap
0 → 100644
View file @
76dcf498
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddLicenseForm template does not show dropdown descriptions, if licenseComplianceDeniesMr feature flag is disabled 1`] = `undefined`;
ee/spec/frontend/vue_shared/license_compliance/components/add_license_form_spec.js
View file @
76dcf498
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
LicenseIssueBody
from
'
ee/vue_shared/license_compliance/components/add_license_form.vue
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
LICENSE_APPROVAL_STATUS
}
from
'
ee/vue_shared/license_compliance/constants
'
;
...
...
@@ -11,7 +12,6 @@ describe('AddLicenseForm', () => {
const
findCancelButton
=
()
=>
vm
.
$el
.
querySelector
(
'
.js-cancel
'
);
beforeEach
(()
=>
{
window
.
gon
=
{
features
:
{
licenseComplianceDeniesMr
:
false
}
};
vm
=
mountComponent
(
Component
);
});
...
...
@@ -123,18 +123,22 @@ 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
'
;
const
wrapper
=
shallowMount
(
LicenseIssueBody
,
{
propsData
:
{
managedLicenses
:
[{
name
:
'
FOO
'
}],
},
provide
:
{
glFeatures
:
{
licenseComplianceDeniesMr
:
true
},
},
});
Vue
.
nextTick
(()
=>
{
const
feedbackElement
=
vm
.
$el
.
querySelector
All
(
'
.text-secondary
'
);
const
formCheckElementMargin
=
vm
.
$el
.
querySelector
(
'
.form-check.mb-3
'
);
const
descriptionElement
=
wrapper
.
find
All
(
'
.text-secondary
'
);
const
formCheckElementMargin
=
wrapper
.
find
(
'
.form-check
'
);
expect
(
feedbackElement
[
0
].
innerText
.
trim
()).
toBe
(
'
Acceptable license to be used in the project
'
,
);
expect
(
descriptionElement
.
at
(
0
).
text
()).
toBe
(
'
Acceptable license to be used in the project
'
);
expect
(
feedbackElement
[
1
].
innerText
.
trim
()).
toBe
(
expect
(
descriptionElement
.
at
(
1
).
text
()).
toBe
(
'
Disallow merge request if detected and will instruct developer to remove
'
,
);
...
...
@@ -148,11 +152,9 @@ describe('AddLicenseForm', () => {
vm
=
mountComponent
(
Component
,
{
managedLicenses
:
[{
name
:
'
FOO
'
}]
});
vm
.
licenseName
=
'
FOO
'
;
Vue
.
nextTick
(()
=>
{
const
feedbackElement
=
vm
.
$el
.
querySelectorAll
(
'
.text-secondary
'
);
const
formCheckElementMargin
=
vm
.
$el
.
querySelector
(
'
.form-check.mb-3
'
);
const
formCheckElement
=
vm
.
$el
.
querySelector
(
'
.form-check
'
);
expect
(
feedbackElement
.
length
).
toBe
(
0
);
expect
(
formCheckElementMargin
).
toBeNull
();
expect
(
formCheckElement
.
element
).
toMatchSnapshot
();
done
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment