Commit 6f66241e authored by Dheeraj Joshi's avatar Dheeraj Joshi Committed by Kushal Pandya

Fix an issue with sorting Vulnerability Report

parent 1d68034f
......@@ -212,6 +212,9 @@ export default {
const fieldName = convertToSnakeCase(context.sortBy);
const direction = context.sortDesc ? 'desc' : 'asc';
if (!fieldName) {
return;
}
this.$emit('sort-changed', `${fieldName}_${direction}`);
},
getVulnerabilityState(state = '') {
......
......@@ -534,6 +534,13 @@ describe('Vulnerability list component', () => {
});
describe('sort-changed listener', () => {
it('does not emit when sort by data is empty', () => {
createWrapper();
findTable().vm.$emit('sort-changed', { sortBy: '', sortDesc: true });
expect(wrapper.emitted('sort-changed')).toBe(undefined);
});
it('emits sort by data in expected format', () => {
createWrapper();
......
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