Commit 1b91dd8e authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '218038-multi-dismissal-on-by-default' into 'master'

Set checkboxes to be on by default for list

See merge request gitlab-org/gitlab!34893
parents 2c36b51e a74be838
......@@ -108,7 +108,6 @@ export default {
:dashboard-documentation="dashboardDocumentation"
:empty-state-svg-path="emptyStateSvgPath"
:filters="filters"
should-show-selection
:vulnerabilities="vulnerabilities"
@refetch-vulnerabilities="refetchVulnerabilities"
>
......
......@@ -37,7 +37,7 @@ export default {
shouldShowSelection: {
type: Boolean,
required: false,
default: false,
default: true,
},
vulnerabilities: {
type: Array,
......
---
title: Set checkboxes to be on by defualt for list
merge_request: 34893
author:
type: added
......@@ -52,7 +52,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath,
filters: null,
isLoading: true,
shouldShowSelection: false,
shouldShowSelection: true,
shouldShowProjectNamespace: true,
vulnerabilities: [],
});
......@@ -143,7 +143,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath,
filters: null,
isLoading: false,
shouldShowSelection: false,
shouldShowSelection: true,
shouldShowProjectNamespace: true,
vulnerabilities,
});
......
......@@ -77,7 +77,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath,
filters: null,
isLoading: true,
shouldShowSelection: false,
shouldShowSelection: true,
shouldShowProjectNamespace: true,
vulnerabilities: [],
});
......@@ -159,7 +159,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath,
filters: null,
isLoading: false,
shouldShowSelection: false,
shouldShowSelection: true,
shouldShowProjectNamespace: true,
vulnerabilities,
});
......
......@@ -73,35 +73,21 @@ describe('Vulnerability list component', () => {
expect(findSelectionSummary().exists()).toBe(false);
});
it('should not show the checkboxes if shouldShowSelection is passed in', () => {
expect(findCheckAllCheckboxCell().classes()).toContain('gl-display-none');
expect(findFirstCheckboxCell().classes()).toContain('gl-display-none');
});
});
describe('when vulnerability selection is enabled', () => {
beforeEach(() => {
wrapper = createWrapper({
props: { vulnerabilities, shouldShowSelection: true },
});
it('should show the selection summary when a checkbox is selected', () => {
findFirstCheckboxCell()
.find('input')
.setChecked(true);
});
it('should show the selection summary when a checkbox is selected', () => {
return wrapper.vm.$nextTick().then(() => {
expect(findSelectionSummary().exists()).toBe(true);
});
});
it('should show the checkboxes if shouldShowSelection is passed in', () => {
expect(findCheckAllCheckboxCell().classes()).not.toContain('d-none');
expect(findFirstCheckboxCell().classes()).not.toContain('d-none');
});
it('should sync selected vulnerabilities when the vulnerability list is updated', () => {
findFirstCheckboxCell()
.find('input')
.setChecked(true);
expect(findSelectionSummary().props('selectedVulnerabilities')).toHaveLength(1);
wrapper.setProps({ vulnerabilities: [] });
return wrapper.vm.$nextTick().then(() => {
......@@ -110,6 +96,23 @@ describe('Vulnerability list component', () => {
});
});
describe('when vulnerability selection is disabled', () => {
beforeEach(() => {
wrapper = createWrapper({
props: { vulnerabilities, shouldShowSelection: false },
});
findFirstCheckboxCell()
.find('input')
.setChecked(true);
});
it('should not show the checkboxes if shouldShowSelection is passed in', () => {
expect(findCheckAllCheckboxCell().classes()).toContain('gl-display-none');
expect(findFirstCheckboxCell().classes()).toContain('gl-display-none');
});
});
describe('when displayed on instance or group level dashboard', () => {
it('should display the vulnerability locations', () => {
const newVulnerabilities = generateVulnerabilities();
......
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