Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,20 @@ describe('Reports Section component', () => {
expect(queryByText('Published Date:')).not.toBeInTheDocument();
});

// uncomment this test when this feature is released to upper envs
// it('renders download all button when ZIP file is present', () => {
// const datasetConfig = { publishedReports: mockReportsWithZip };
// const { getByRole, getByText } = render(
// <ErrorBoundary>
// <ReportsSection dataset={datasetConfig} />
// </ErrorBoundary>
// );
//
// const downloadButton = getByRole('link', { name: /Download archive\.zip/i });
// expect(downloadButton).toBeInTheDocument();
// expect(downloadButton).toHaveAttribute('href', '/test/file/path/archive.zip');
// expect(downloadButton).toHaveAttribute('download', 'archive.zip');
// expect(getByText('Download all (2 files)')).toBeInTheDocument();
// });
it('renders download all button when ZIP file is present', () => {
const datasetConfig = { publishedReports: mockReportsWithZip };
const { getByRole, getByText } = render(
<ErrorBoundary>
<ReportsSection dataset={datasetConfig} />
</ErrorBoundary>
);

const downloadButton = getByRole('link', { name: /Download archive\.zip/i });
expect(downloadButton).toBeInTheDocument();
expect(downloadButton).toHaveAttribute('href', '/test/file/path/archive.zip');
expect(downloadButton).toHaveAttribute('download', 'archive.zip');
expect(getByText('Download all (2 files)')).toBeInTheDocument();
});

describe('Reports section with report filter', () => {
const datasetConfig = { reportSelection: 'byReport', publishedReports: mockReports };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,20 @@ const ReportsSection: FunctionComponent<{ dataset: IDatasetConfig }> = ({ datase
ariaLabel="Enter report date"
/>
)}
<LowerEnvironmentFeature featureId="combinedStatement">
{/*only display 'download all' option if a zip file is present (combinedStatements)*/}
{zipFile && (
<a
href={zipFile.path}
className={button}
download={zipFileName}
target="_blank"
rel="noreferrer noopener"
aria-label={`Download ${zipFileName}`}
onClick={handleApplyGa4Click}
>
Download all ({currentReports.length - 1} {currentReports.length - 1 === 1 ? 'file' : 'files'})
</a>
)}
</LowerEnvironmentFeature>
{/*only display 'download all' option if a zip file is present (combinedStatements)*/}
{zipFile && (
<a
href={zipFile.path}
className={button}
download={zipFileName}
target="_blank"
rel="noreferrer noopener"
aria-label={`Download ${zipFileName}`}
onClick={handleApplyGa4Click}
>
Download all ({currentReports.length - 1} {currentReports.length - 1 === 1 ? 'file' : 'files'})
</a>
)}
</div>
)}
<DownloadReportTable reports={currentReports} isDailyReport={isDailyReport} />
Expand Down
Loading