Commit 929cd8a4 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'djadmin-fix-vulnerability-report-sorting-behavior' into 'master'

Fix an issue with sorting Vulnerability Report

See merge request gitlab-org/gitlab!76737
parents 07b33090 6f66241e
......@@ -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