Skip to content

Commit

Permalink
Hide thor button when main and subslug are overig (#2721)
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarBakker authored Oct 4, 2023
1 parent 05f6cda commit 11d8f47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,13 @@ const DetailHeader = () => {

return true
}, [incident])

const forwardToExternalIsAllowed = !isStatusClosed(incident.status?.state)
const thorIsAllowed = [
'm',
'i',
'b',
'h',
'send failed',
'reopened',
].includes(incident.status?.state)
const thorIsAllowed =
['m', 'i', 'b', 'h', 'send failed', 'reopened'].includes(
incident.status?.state
) &&
incident.category?.main_slug !== 'overig' &&
incident.category?.sub_slug !== 'overig'
const downloadLink = incident?._links?.['sia:pdf']?.href

const referrer = location.referrer?.startsWith(MAP_URL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ describe('signals/incident-management/containers/IncidentDetail/components/Detai
expect(screen.queryByTestId('detail-header-button-thor')).toBeNull()
})

it('should render no thor button category main and subslug are overig', () => {
render(
renderWithContext({
...incidentFixture,
category: {
...incidentFixture.category,
main_slug: 'overig',
sub_slug: 'overig',
},
})
)

expect(screen.queryByTestId('detail-header-button-thor')).toBeNull()
})

it('test clicking the thor button', () => {
render(renderWithContext())

Expand Down

0 comments on commit 11d8f47

Please sign in to comment.