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
ede39d83
Commit
ede39d83
authored
Jun 21, 2020
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests with feature flag for license compliance vue
* Add unit tests related to license-check approval group
parent
cfdd662c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
20 deletions
+82
-20
ee/app/assets/javascripts/license_compliance/components/app.vue
.../assets/javascripts/license_compliance/components/app.vue
+0
-1
ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue
...ipts/vue_shared/license_compliance/license_management.vue
+21
-17
ee/spec/frontend/license_compliance/components/app_spec.js
ee/spec/frontend/license_compliance/components/app_spec.js
+0
-1
ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js
.../vue_shared/license_compliance/license_management_spec.js
+61
-1
No files found.
ee/app/assets/javascripts/license_compliance/components/app.vue
View file @
ede39d83
...
...
@@ -152,6 +152,5 @@ export default {
</gl-tab>
</gl-tabs>
</template>
</div>
</template>
ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue
View file @
ede39d83
...
...
@@ -49,8 +49,8 @@ export default {
return
this
.
isLoadingManagedLicenses
&&
!
this
.
hasPendingLicenses
;
},
isTooltipEnabled
()
{
return
gon
.
features
.
licenseComplianceDeniesMr
;
}
return
Boolean
(
gon
?.
features
?.
licenseComplianceDeniesMr
)
;
}
,
},
watch
:
{
isAddingNewLicense
(
isAddingNewLicense
)
{
...
...
@@ -116,34 +116,38 @@ export default {
{{
tableHeaders
[
0
].
label
}}
<gl-icon
v-if=
"isTooltipEnabled"
ref=
"reportInfo"
name=
"question"
class=
"text-info ml-1"
:aria-label=
"__('help')"
:size=
"14"
:v-if=
"isTooltipEnabled"
/>
<gl-popover
v-if=
"isTooltipEnabled"
:target=
"() => $refs.reportInfo.$el"
placement=
"bottom"
triggers=
"click blur"
:
title=
"title
"
:
css-classes=
"['mt-3']
"
>
<h5>
Allowed
</h5>
<span
class=
"text-secondary"
>
{{
s__
(
'
Licenses|Acceptable license to be used in the project
'
)
}}
</span>
<h5>
Denied
</h5>
<span
class=
"text-secondary"
>
{{
s__
(
'
Licenses|Dissallow Merge request if detected and will instruct the developer to remove
'
)
}}
</span>
</gl-popover>
</div>
<h5>
{{
__
(
'
Allowed
'
)
}}
</h5>
<span
class=
"text-secondary"
>
{{
s__
(
'
Licenses|Acceptable license to be used in the project
'
)
}}
</span
>
<h5>
{{
__
(
'
Denied
'
)
}}
</h5>
<span
class=
"text-secondary"
>
{{
s__
(
'
Licenses|Dissallow Merge request if detected and will instruct the developer to remove
'
,
)
}}
</span
>
</gl-popover>
</div>
<div
class=
"table-section"
:class=
"tableHeaders[1].className"
role=
"rowheader"
>
{{
tableHeaders
[
1
].
label
}}
<div
class=
"table-section"
:class=
"tableHeaders[1].className"
role=
"rowheader"
>
{{
tableHeaders
[
1
].
label
}}
</div>
</
template
>
</template>
...
...
ee/spec/frontend/license_compliance/components/app_spec.js
View file @
ede39d83
...
...
@@ -323,5 +323,4 @@ describe('Project Licenses', () => {
});
});
});
});
ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js
View file @
ede39d83
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlButton
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlLoadingIcon
,
GlIcon
,
GlPopover
}
from
'
@gitlab/ui
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
LicenseManagement
from
'
ee/vue_shared/license_compliance/license_management.vue
'
;
...
...
@@ -69,6 +69,10 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin, options
};
describe
(
'
License Management
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
features
:
{
licenseComplianceDeniesMr
:
false
}
};
});
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
...
...
@@ -190,6 +194,34 @@ describe('License Management', () => {
expect
(
wrapper
.
find
(
AdminLicenseManagementRow
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
when licenseComplianceDeniesMr feature flag enabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
true
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
true
,
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
GlPopover
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
when licenseComplianceDeniesMr feature flag disabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
false
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
true
,
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
GlPopover
).
exists
()).
toBe
(
false
);
});
});
});
describe
(
'
when developer
'
,
()
=>
{
...
...
@@ -228,6 +260,34 @@ describe('License Management', () => {
expect
(
wrapper
.
find
(
AdminLicenseManagementRow
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
when licenseComplianceDeniesMr feature flag enabled
'
,
()
=>
{
it
(
'
should show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
true
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
false
,
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlPopover
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
when licenseComplianceDeniesMr feature flag disabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
false
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
false
,
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
GlPopover
).
exists
()).
toBe
(
false
);
});
});
});
});
});
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