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 { ...@@ -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,
......
...@@ -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