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
f4ffeb31
Commit
f4ffeb31
authored
Feb 01, 2021
by
Dave Pisek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specs refactor: use testids, export i18n
* switches from `js-*` hooks to testids * exports i18n translations
parent
9631797d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
22 deletions
+35
-22
ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue
...ity_dashboard/components/vulnerability_action_buttons.vue
+12
-7
ee/spec/frontend/security_dashboard/components/vulnerability_action_buttons_spec.js
...dashboard/components/vulnerability_action_buttons_spec.js
+23
-15
No files found.
ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue
View file @
f4ffeb31
...
@@ -6,7 +6,16 @@ import { BV_SHOW_MODAL } from '~/lib/utils/constants';
...
@@ -6,7 +6,16 @@ import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
export
const
i18n
=
{
moreInfo
:
s__
(
'
SecurityReports|More info
'
),
createIssue
:
s__
(
'
SecurityReports|Create issue
'
),
createJiraIssue
:
s__
(
'
SecurityReports|Create Jira issue
'
),
revertDismissVulnerability
:
s__
(
'
SecurityReports|Undo dismiss
'
),
dismissVulnerability
:
s__
(
'
SecurityReports|Dismiss vulnerability
'
),
};
export
default
{
export
default
{
i18n
,
name
:
'
SecurityDashboardActionButtons
'
,
name
:
'
SecurityDashboardActionButtons
'
,
components
:
{
components
:
{
GlButton
,
GlButton
,
...
@@ -82,13 +91,6 @@ export default {
...
@@ -82,13 +91,6 @@ export default {
this
.
$root
.
$emit
(
BV_SHOW_MODAL
,
VULNERABILITY_MODAL_ID
);
this
.
$root
.
$emit
(
BV_SHOW_MODAL
,
VULNERABILITY_MODAL_ID
);
},
},
},
},
i18n
:
{
moreInfo
:
s__
(
'
SecurityReports|More info
'
),
createIssue
:
s__
(
'
SecurityReports|Create issue
'
),
createJiraIssue
:
s__
(
'
SecurityReports|Create Jira issue
'
),
revertDismissVulnerability
:
s__
(
'
SecurityReports|Undo dismiss
'
),
dismissVulnerability
:
s__
(
'
SecurityReports|Dismiss vulnerability
'
),
},
};
};
</
script
>
</
script
>
...
@@ -103,6 +105,7 @@ export default {
...
@@ -103,6 +105,7 @@ export default {
variant=
"info"
variant=
"info"
category=
"secondary"
category=
"secondary"
icon=
"information-o"
icon=
"information-o"
data-testid=
"more-info"
@
click=
"openModal(
{ vulnerability })"
@
click=
"openModal(
{ vulnerability })"
/>
/>
<gl-button
<gl-button
...
@@ -131,6 +134,7 @@ export default {
...
@@ -131,6 +134,7 @@ export default {
variant=
"warning"
variant=
"warning"
category=
"secondary"
category=
"secondary"
icon=
"redo"
icon=
"redo"
data-testid=
"undo-dismiss"
@
click=
"handleUndoDismiss"
@
click=
"handleUndoDismiss"
/>
/>
<gl-button
<gl-button
...
@@ -144,6 +148,7 @@ export default {
...
@@ -144,6 +148,7 @@ export default {
variant=
"warning"
variant=
"warning"
category=
"secondary"
category=
"secondary"
icon=
"cancel"
icon=
"cancel"
data-testid=
"dismiss-vulnerability"
@
click=
"handleDismissVulnerability"
@
click=
"handleDismissVulnerability"
/>
/>
</
template
>
</
template
>
...
...
ee/spec/frontend/security_dashboard/components/vulnerability_action_buttons_spec.js
View file @
f4ffeb31
import
{
createWrapper
,
mount
}
from
'
@vue/test-utils
'
;
import
{
createWrapper
,
mount
}
from
'
@vue/test-utils
'
;
import
VulnerabilityActionButtons
from
'
ee/security_dashboard/components/vulnerability_action_buttons.vue
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
VulnerabilityActionButtons
,
{
i18n
,
}
from
'
ee/security_dashboard/components/vulnerability_action_buttons.vue
'
;
import
createStore
from
'
ee/security_dashboard/store
'
;
import
createStore
from
'
ee/security_dashboard/store
'
;
import
{
VULNERABILITY_MODAL_ID
}
from
'
ee/vue_shared/security_reports/components/constants
'
;
import
{
VULNERABILITY_MODAL_ID
}
from
'
ee/vue_shared/security_reports/components/constants
'
;
import
{
BV_SHOW_MODAL
}
from
'
~/lib/utils/constants
'
;
import
{
BV_SHOW_MODAL
}
from
'
~/lib/utils/constants
'
;
...
@@ -10,18 +14,18 @@ describe('Security Dashboard Action Buttons', () => {
...
@@ -10,18 +14,18 @@ describe('Security Dashboard Action Buttons', () => {
let
store
;
let
store
;
let
wrapper
;
let
wrapper
;
const
createComponent
=
({
...
options
})
=>
{
const
createComponent
=
({
...
options
})
=>
return
mount
(
VulnerabilityActionButtons
,
{
extendedWrapper
(
...
options
,
mount
(
VulnerabilityActionButtons
,
{
store
,
...
options
,
});
store
,
};
}),
);
const
findAllButtons
=
()
=>
wrapper
.
findAll
(
'
.btn-group .btn
'
);
const
findAllButtons
=
()
=>
wrapper
.
findAll
Components
(
GlButton
);
const
findMoreInfoButton
=
()
=>
wrapper
.
find
(
'
.js-
more-info
'
);
const
findMoreInfoButton
=
()
=>
wrapper
.
find
ByTestId
(
'
more-info
'
);
const
findCreateIssueButton
=
()
=>
wrapper
.
find
(
'
.js-
create-issue
'
);
const
findCreateIssueButton
=
()
=>
wrapper
.
find
ByTestId
(
'
create-issue
'
);
const
findDismissVulnerabilityButton
=
()
=>
wrapper
.
find
(
'
.js-
dismiss-vulnerability
'
);
const
findDismissVulnerabilityButton
=
()
=>
wrapper
.
find
ByTestId
(
'
dismiss-vulnerability
'
);
const
findUndoDismissButton
=
()
=>
wrapper
.
find
(
'
.js-
undo-dismiss
'
);
const
findUndoDismissButton
=
()
=>
wrapper
.
find
ByTestId
(
'
undo-dismiss
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
=
createStore
();
store
=
createStore
();
...
@@ -71,6 +75,10 @@ describe('Security Dashboard Action Buttons', () => {
...
@@ -71,6 +75,10 @@ describe('Security Dashboard Action Buttons', () => {
expect
(
findCreateIssueButton
().
exists
()).
toBe
(
true
);
expect
(
findCreateIssueButton
().
exists
()).
toBe
(
true
);
});
});
it
(
'
should render the correct tooltip
'
,
()
=>
{
expect
(
findCreateIssueButton
().
attributes
(
'
title
'
)).
toBe
(
i18n
.
createIssue
);
});
it
(
'
should emit an `createIssue` event when clicked
'
,
()
=>
{
it
(
'
should emit an `createIssue` event when clicked
'
,
()
=>
{
findCreateIssueButton
().
trigger
(
'
click
'
);
findCreateIssueButton
().
trigger
(
'
click
'
);
...
@@ -94,7 +102,7 @@ describe('Security Dashboard Action Buttons', () => {
...
@@ -94,7 +102,7 @@ describe('Security Dashboard Action Buttons', () => {
});
});
it
(
'
should render the correct tooltip
'
,
()
=>
{
it
(
'
should render the correct tooltip
'
,
()
=>
{
expect
(
findCreateIssueButton
().
attributes
(
'
title
'
)).
toBe
(
'
Create Jira issue
'
);
expect
(
findCreateIssueButton
().
attributes
(
'
title
'
)).
toBe
(
i18n
.
createJiraIssue
);
});
});
it
(
'
should open a new window when the create-issue button is clicked
'
,
()
=>
{
it
(
'
should open a new window when the create-issue button is clicked
'
,
()
=>
{
...
@@ -130,7 +138,7 @@ describe('Security Dashboard Action Buttons', () => {
...
@@ -130,7 +138,7 @@ describe('Security Dashboard Action Buttons', () => {
});
});
});
});
describe
(
'
with a vulnerbility that has an issue
'
,
()
=>
{
describe
(
'
with a vulner
a
bility that has an issue
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
createComponent
({
wrapper
=
createComponent
({
propsData
:
{
propsData
:
{
...
...
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