Commit 648dc48a authored by Dave Pisek's avatar Dave Pisek

Display correct label for named-list report types

This change fixes an issue with the `named-list` generic-security-report
type:  Instead of displaying the item's key it uses the `name` property
to follow the requirements.

Changelog: fixed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65507
EE: true
parent 0538f6e2
......@@ -23,12 +23,12 @@ export default {
<div class="gl-display-table">
<ul v-if="hasItems" class="generic-report-named-list">
<li
v-for="{ label, ...values } in items"
v-for="{ label, name, ...values } in items"
:key="label"
class="generic-report-named-list-item"
data-testid="listItem"
>
<strong class="generic-report-named-list-label">{{ label }}</strong>
<strong class="generic-report-named-list-label">{{ name }}</strong>
<span class="generic-report-named-list-value">
<report-item :item="values" :data-testid="`listValue${label}`" />
</span>
......
......@@ -5,8 +5,8 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper';
const TEST_DATA = {
items: [
{ label: 'url1', type: REPORT_TYPES.url, href: 'http://foo.bar' },
{ label: 'url2', type: REPORT_TYPES.url, href: 'http://bar.baz' },
{ label: 'comment_1', name: 'url1', type: REPORT_TYPES.url, href: 'http://foo.bar' },
{ label: 'comment_2', name: 'url2', type: REPORT_TYPES.url, href: 'http://bar.baz' },
],
};
......@@ -47,8 +47,8 @@ describe('ee/vulnerabilities/components/generic_report/types/named_list.vue', ()
});
describe.each(TEST_DATA.items)('list item: %s', (item) => {
it(`renders the item's label`, () => {
expect(wrapper.findByText(item.label).exists()).toBe(true);
it(`renders the item's name`, () => {
expect(wrapper.findByText(item.name).exists()).toBe(true);
});
it('renders a report-item', () => {
......
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