Skip to content

Commit

Permalink
fix: enable download for TE when type is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Dec 27, 2023
1 parent f184dff commit c1d76aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 13 additions & 0 deletions cypress/integration/download.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { E2E_PROGRAM } from '../data/index.js'
import {
selectEnrollmentWithProgram,
selectEventWithProgram,
selectTrackedEntityWithType,
} from '../helpers/dimensions.js'
import { clickMenubarUpdateButton } from '../helpers/menubar.js'
import { goToStartPage } from '../helpers/startScreen.js'
Expand Down Expand Up @@ -48,4 +49,16 @@ describe('download', () => {

downloadIsEnabled()
})

it('download button disables when required dimensions are selected (tracked entity)', () => {
goToStartPage()

downloadIsDisabled()

selectTrackedEntityWithType('Person')

clickMenubarUpdateButton()

downloadIsEnabled()
})
})
9 changes: 5 additions & 4 deletions src/modules/layoutValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ export const validateLineListLayout = (layout, { dryRun } = {}) => {
}

// program
if (!layoutHasProgramId(layout)) {
if (
layout.outputType !== OUTPUT_TYPE_TRACKED_ENTITY &&
!layoutHasProgramId(layout)
) {
if (dryRun) {
return false
}
if (layout.outputType !== OUTPUT_TYPE_TRACKED_ENTITY) {
throw noProgramError()
}
throw noProgramError()
}

// columns
Expand Down

0 comments on commit c1d76aa

Please sign in to comment.