Commit c57fa065 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '230381-fix-empty-badge' into 'master'

Hide issues badge when there are no issues

See merge request gitlab-org/gitlab!44663
parents 4502666a 151f4fa4
......@@ -436,7 +436,7 @@ export default {
<template #cell(activity)="{ item }">
<div class="gl-display-flex gl-justify-content-end">
<issues-badge :issues="issues(item)" />
<issues-badge v-if="issues(item).length > 0" :issues="issues(item)" />
<remediated-badge v-if="item.resolvedOnDefaultBranch" class="gl-ml-3" />
</div>
</template>
......
---
title: Hide issues badge when there are no issues
merge_request: 44663
author:
type: fixed
......@@ -27,6 +27,9 @@ export const generateVulnerabilities = () => [
scanner: {
vendor: 'GitLab',
},
issueLinks: {
nodes: [{ issue: { iid: 15 } }],
},
},
{
id: 'id_1',
......
......@@ -46,7 +46,7 @@ describe('Vulnerability list component', () => {
const findRows = () => wrapper.findAll('tbody tr');
const findRow = (index = 0) => findRows().at(index);
const findRowById = id => wrapper.find(`tbody tr[data-pk="${id}"`);
const findIssuesBadge = () => wrapper.find(IssuesBadge);
const findIssuesBadge = (index = 0) => wrapper.findAll(IssuesBadge).at(index);
const findRemediatedBadge = () => wrapper.find(RemediatedBadge);
const findSecurityScannerAlert = () => wrapper.find(SecurityScannerAlert);
const findDismissalButton = () => findSecurityScannerAlert().find('button[aria-label="Dismiss"]');
......@@ -92,8 +92,12 @@ describe('Vulnerability list component', () => {
expect(cell.text()).toBe(newVulnerabilities[0].title);
});
it('should display the issues badge', () => {
expect(findIssuesBadge().exists()).toBe(true);
it('should display the issues badge for the first item', () => {
expect(findIssuesBadge(0).exists()).toBe(true);
});
it('should not display the issues badge for the second item', () => {
expect(() => findIssuesBadge(1)).toThrow();
});
it('should display the remediated badge', () => {
......
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