fix(export vuln): change sheet name and download options name (#417)
Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
parent
df19fa811c
commit
12f9229320
@ -574,13 +574,13 @@ describe('Vulnerabilties page', () => {
|
|||||||
fireEvent.click(downloadBtn[0]);
|
fireEvent.click(downloadBtn[0]);
|
||||||
expect(await screen.findByTestId('export-csv-menuItem')).toBeInTheDocument();
|
expect(await screen.findByTestId('export-csv-menuItem')).toBeInTheDocument();
|
||||||
expect(await screen.findByTestId('export-excel-menuItem')).toBeInTheDocument();
|
expect(await screen.findByTestId('export-excel-menuItem')).toBeInTheDocument();
|
||||||
const exportAsCSVBtn = screen.getByText(/CSV/i);
|
const exportAsCSVBtn = screen.getByText(/csv/i);
|
||||||
expect(exportAsCSVBtn).toBeInTheDocument();
|
expect(exportAsCSVBtn).toBeInTheDocument();
|
||||||
global.URL.createObjectURL = jest.fn();
|
global.URL.createObjectURL = jest.fn();
|
||||||
await fireEvent.click(exportAsCSVBtn);
|
await fireEvent.click(exportAsCSVBtn);
|
||||||
expect(await screen.findByTestId('export-csv-menuItem')).not.toBeInTheDocument();
|
expect(await screen.findByTestId('export-csv-menuItem')).not.toBeInTheDocument();
|
||||||
fireEvent.click(downloadBtn[0]);
|
fireEvent.click(downloadBtn[0]);
|
||||||
const exportAsExcelBtn = screen.getByText(/MS Excel/i);
|
const exportAsExcelBtn = screen.getByText(/xlsx/i);
|
||||||
expect(exportAsExcelBtn).toBeInTheDocument();
|
expect(exportAsExcelBtn).toBeInTheDocument();
|
||||||
await fireEvent.click(exportAsExcelBtn);
|
await fireEvent.click(exportAsExcelBtn);
|
||||||
expect(await screen.findByTestId('export-excel-menuItem')).not.toBeInTheDocument();
|
expect(await screen.findByTestId('export-excel-menuItem')).not.toBeInTheDocument();
|
||||||
|
@ -106,7 +106,7 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
padding: '0.3rem',
|
padding: '0.3rem',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center'
|
justifyContent: 'left'
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ function VulnerabilitiesDetails(props) {
|
|||||||
const wb = XLSX.utils.book_new(),
|
const wb = XLSX.utils.book_new(),
|
||||||
ws = XLSX.utils.json_to_sheet(allCveData);
|
ws = XLSX.utils.json_to_sheet(allCveData);
|
||||||
|
|
||||||
XLSX.utils.book_append_sheet(wb, ws, name + '_' + tag);
|
XLSX.utils.book_append_sheet(wb, ws, name.replaceAll('/', '_') + '_' + tag);
|
||||||
|
|
||||||
XLSX.writeFile(wb, `${name}:${tag}-vulnerabilities.xlsx`);
|
XLSX.writeFile(wb, `${name}:${tag}-vulnerabilities.xlsx`);
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ function VulnerabilitiesDetails(props) {
|
|||||||
className={classes.popper}
|
className={classes.popper}
|
||||||
data-testid="export-csv-menuItem"
|
data-testid="export-csv-menuItem"
|
||||||
>
|
>
|
||||||
CSV
|
csv
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Divider sx={{ my: 0.5 }} />
|
<Divider sx={{ my: 0.5 }} />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@ -360,7 +360,7 @@ function VulnerabilitiesDetails(props) {
|
|||||||
className={classes.popper}
|
className={classes.popper}
|
||||||
data-testid="export-excel-menuItem"
|
data-testid="export-excel-menuItem"
|
||||||
>
|
>
|
||||||
MS Excel
|
xlsx
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
Loading…
Reference in New Issue
Block a user