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 { ...@@ -108,7 +108,6 @@ export default {
:dashboard-documentation="dashboardDocumentation" :dashboard-documentation="dashboardDocumentation"
:empty-state-svg-path="emptyStateSvgPath" :empty-state-svg-path="emptyStateSvgPath"
:filters="filters" :filters="filters"
should-show-selection
:vulnerabilities="vulnerabilities" :vulnerabilities="vulnerabilities"
@refetch-vulnerabilities="refetchVulnerabilities" @refetch-vulnerabilities="refetchVulnerabilities"
> >
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
shouldShowSelection: { shouldShowSelection: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false, default: true,
}, },
vulnerabilities: { vulnerabilities: {
type: Array, 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', () => { ...@@ -52,7 +52,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath, emptyStateSvgPath,
filters: null, filters: null,
isLoading: true, isLoading: true,
shouldShowSelection: false, shouldShowSelection: true,
shouldShowProjectNamespace: true, shouldShowProjectNamespace: true,
vulnerabilities: [], vulnerabilities: [],
}); });
...@@ -143,7 +143,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => { ...@@ -143,7 +143,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath, emptyStateSvgPath,
filters: null, filters: null,
isLoading: false, isLoading: false,
shouldShowSelection: false, shouldShowSelection: true,
shouldShowProjectNamespace: true, shouldShowProjectNamespace: true,
vulnerabilities, vulnerabilities,
}); });
......
...@@ -77,7 +77,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => { ...@@ -77,7 +77,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath, emptyStateSvgPath,
filters: null, filters: null,
isLoading: true, isLoading: true,
shouldShowSelection: false, shouldShowSelection: true,
shouldShowProjectNamespace: true, shouldShowProjectNamespace: true,
vulnerabilities: [], vulnerabilities: [],
}); });
...@@ -159,7 +159,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => { ...@@ -159,7 +159,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => {
emptyStateSvgPath, emptyStateSvgPath,
filters: null, filters: null,
isLoading: false, isLoading: false,
shouldShowSelection: false, shouldShowSelection: true,
shouldShowProjectNamespace: true, shouldShowProjectNamespace: true,
vulnerabilities, vulnerabilities,
}); });
......
...@@ -73,35 +73,21 @@ describe('Vulnerability list component', () => { ...@@ -73,35 +73,21 @@ describe('Vulnerability list component', () => {
expect(findSelectionSummary().exists()).toBe(false); expect(findSelectionSummary().exists()).toBe(false);
}); });
it('should not show the checkboxes if shouldShowSelection is passed in', () => { it('should show the selection summary when a checkbox is selected', () => {
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 },
});
findFirstCheckboxCell() findFirstCheckboxCell()
.find('input') .find('input')
.setChecked(true); .setChecked(true);
});
it('should show the selection summary when a checkbox is selected', () => {
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findSelectionSummary().exists()).toBe(true); 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', () => { it('should sync selected vulnerabilities when the vulnerability list is updated', () => {
findFirstCheckboxCell()
.find('input')
.setChecked(true);
expect(findSelectionSummary().props('selectedVulnerabilities')).toHaveLength(1); expect(findSelectionSummary().props('selectedVulnerabilities')).toHaveLength(1);
wrapper.setProps({ vulnerabilities: [] }); wrapper.setProps({ vulnerabilities: [] });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
...@@ -110,6 +96,23 @@ describe('Vulnerability list component', () => { ...@@ -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', () => { describe('when displayed on instance or group level dashboard', () => {
it('should display the vulnerability locations', () => { it('should display the vulnerability locations', () => {
const newVulnerabilities = generateVulnerabilities(); 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