From 09676fe7c44913b69ab0210bd14cee52e47212c9 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Tue, 4 Feb 2025 15:18:49 +0100 Subject: [PATCH] remove DUT controls from download --- .../DownloadDialog/DownloadDialog.spec.tsx | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx index e94b28eea..1e9b0a952 100644 --- a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx +++ b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx @@ -24,16 +24,19 @@ const defaultOrganism = 'ebola'; async function renderDialog({ downloadParams = new SelectFilter(new Set()), allowSubmissionOfConsensusSequences = true, + dataUseTermsEnabled = true, }: { downloadParams?: SequenceFilter; allowSubmissionOfConsensusSequences?: boolean; + dataUseTermsEnabled?: boolean; } = {}) { render( , ); @@ -139,6 +142,27 @@ describe('DownloadDialog', () => { expect(screen.getByLabelText(olderVersionsLabel)).toBeInTheDocument(); expect(screen.getByLabelText(gzipCompressionLabel)).toBeInTheDocument(); }); + + describe('DataUseTerms disabled', () => { + test('download button activated by default', async () => { + await renderDialog({ dataUseTermsEnabled: false }); + + const downloadButton = screen.getByRole('link', { name: 'Download' }); + expect(downloadButton).not.toHaveClass('btn-disabled'); + }); + + test('checkbox not in the document', async () => { + await renderDialog({ dataUseTermsEnabled: false }); + + expect(screen.queryByLabelText('I agree to the data use terms.')).not.toBeInTheDocument(); + }); + + test('restricted data switch is not in the document', async () => { + await renderDialog({ dataUseTermsEnabled: false }); + + expect(screen.queryByLabelText(/restricted data/)).not.toBeInTheDocument(); + }); + }); }); async function checkAgreement() {