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
8b35134e
Commit
8b35134e
authored
Apr 15, 2022
by
Miguel Rincon
Committed by
Vitaly Slobodin
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename HelpPopover when imported by summary_row
parent
fc416b60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
app/assets/javascripts/reports/components/summary_row.vue
app/assets/javascripts/reports/components/summary_row.vue
+3
-3
spec/frontend/reports/components/summary_row_spec.js
spec/frontend/reports/components/summary_row_spec.js
+23
-11
No files found.
app/assets/javascripts/reports/components/summary_row.vue
View file @
8b35134e
<
script
>
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
CiIcon
from
'
~/vue_shared/components/ci_icon.vue
'
;
import
Popover
from
'
~/vue_shared/components/help_popover.vue
'
;
import
Help
Popover
from
'
~/vue_shared/components/help_popover.vue
'
;
import
{
ICON_WARNING
}
from
'
../constants
'
;
/**
...
...
@@ -16,7 +16,7 @@ export default {
name
:
'
ReportSummaryRow
'
,
components
:
{
CiIcon
,
Popover
,
Help
Popover
,
GlLoadingIcon
,
},
props
:
{
...
...
@@ -79,7 +79,7 @@ export default {
<div
class=
"report-block-list-issue-description-text"
data-testid=
"summary-row-description"
>
<slot
name=
"summary"
>
{{
summary
}}
</slot
><span
v-if=
"popoverOptions"
class=
"text-nowrap"
>
<popover
v-if=
"popoverOptions"
:options=
"popoverOptions"
class=
"align-top"
/>
>
<
help-
popover
v-if=
"popoverOptions"
:options=
"popoverOptions"
class=
"align-top"
/>
</span>
</div>
</div>
...
...
spec/frontend/reports/components/summary_row_spec.js
View file @
8b35134e
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
HelpPopover
from
'
~/vue_shared/components/help_popover.vue
'
;
import
SummaryRow
from
'
~/reports/components/summary_row.vue
'
;
describe
(
'
Summary row
'
,
()
=>
{
let
wrapper
;
const
props
=
{
summary
:
'
SAST detected 1 new vulnerability and 1 fixed vulnerability
'
,
popoverOptions
:
{
title
:
'
Static Application Security Testing (SAST)
'
,
content
:
'
<a>Learn more about SAST</a>
'
,
},
statusIcon
:
'
warning
'
,
const
summary
=
'
SAST detected 1 new vulnerability and 1 fixed vulnerability
'
;
const
popoverOptions
=
{
title
:
'
Static Application Security Testing (SAST)
'
,
content
:
'
<a>Learn more about SAST</a>
'
,
};
const
statusIcon
=
'
warning
'
;
const
createComponent
=
({
props
Data
=
{},
slots
=
{}
}
=
{})
=>
{
const
createComponent
=
({
props
=
{},
slots
=
{}
}
=
{})
=>
{
wrapper
=
extendedWrapper
(
mount
(
SummaryRow
,
{
propsData
:
{
summary
,
popoverOptions
,
statusIcon
,
...
props
,
...
propsData
,
},
slots
,
}),
...
...
@@ -28,6 +29,7 @@ describe('Summary row', () => {
const
findSummary
=
()
=>
wrapper
.
findByTestId
(
'
summary-row-description
'
);
const
findStatusIcon
=
()
=>
wrapper
.
findByTestId
(
'
summary-row-icon
'
);
const
findHelpPopover
=
()
=>
wrapper
.
findComponent
(
HelpPopover
);
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
@@ -36,7 +38,7 @@ describe('Summary row', () => {
it
(
'
renders provided summary
'
,
()
=>
{
createComponent
();
expect
(
findSummary
().
text
()).
toContain
(
props
.
summary
);
expect
(
findSummary
().
text
()).
toContain
(
summary
);
});
it
(
'
renders provided icon
'
,
()
=>
{
...
...
@@ -44,12 +46,22 @@ describe('Summary row', () => {
expect
(
findStatusIcon
().
classes
()).
toContain
(
'
js-ci-status-icon-warning
'
);
});
it
(
'
renders help popover if popoverOptions are provided
'
,
()
=>
{
createComponent
();
expect
(
findHelpPopover
().
props
(
'
options
'
)).
toEqual
(
popoverOptions
);
});
it
(
'
does not render help popover if popoverOptions are not provided
'
,
()
=>
{
createComponent
({
props
:
{
popoverOptions
:
null
}
});
expect
(
findHelpPopover
().
exists
()).
toBe
(
false
);
});
describe
(
'
summary slot
'
,
()
=>
{
it
(
'
replaces the summary prop
'
,
()
=>
{
const
summarySlotContent
=
'
Summary slot content
'
;
createComponent
({
slots
:
{
summary
:
summarySlotContent
}
});
expect
(
wrapper
.
text
()).
not
.
toContain
(
props
.
summary
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
summary
);
expect
(
findSummary
().
text
()).
toContain
(
summarySlotContent
);
});
});
...
...
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