Commit c5c02414 authored by Alexander Turinske's avatar Alexander Turinske

Set checkboxes to be on by defualt for list

- I did not remove the functionality to toggle them on/off
  as I think this feature could be useful in the future
parent 0e7e33e0
......@@ -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,
......
......@@ -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