-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSP-5715 : Sec3/Sec6 add forms to acquisition file #3292
Changes from 10 commits
7a0cf97
a25d58b
dcf0594
353ff1b
3846899
f3f42f7
e2620d7
c923a80
c5bbb94
2cae0c2
7e57089
7e96745
34445a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,4 +78,51 @@ describe('AcquisitionFileTabs component', () => { | |
expect(getByText('Documents')).toHaveClass('active'); | ||
}); | ||
}); | ||
|
||
it('hides the expropiation tab when the Acquisition file type is "Consensual Agreement"', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please replace all instances of "expropiation" with "expropriation". I see it in comments like this and also on file names, section names, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated |
||
const { queryByText } = setup({ | ||
acquisitionFile: mockAcquisitionFileResponse(), | ||
defaultTab: FileTabType.FILE_DETAILS, | ||
setContainerState, | ||
}); | ||
|
||
const expropiationButton = queryByText('Expropiation'); | ||
expect(expropiationButton).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('shows the expropiation tab when the Acquisition file type is "Section 3"', () => { | ||
const mockAcquisitionFile = mockAcquisitionFileResponse(); | ||
mockAcquisitionFile.acquisitionTypeCode = { | ||
id: 'SECTN3', | ||
description: 'Section 3 Agreement', | ||
isDisabled: false, | ||
}; | ||
|
||
const { queryByText } = setup({ | ||
acquisitionFile: mockAcquisitionFile, | ||
defaultTab: FileTabType.FILE_DETAILS, | ||
setContainerState, | ||
}); | ||
|
||
const editButton = queryByText('Expropiation'); | ||
expect(editButton).toBeInTheDocument(); | ||
}); | ||
|
||
it('shows the expropiation tab when the Acquisition file type is "Section 6"', () => { | ||
const mockAcquisitionFile = mockAcquisitionFileResponse(); | ||
mockAcquisitionFile.acquisitionTypeCode = { | ||
id: 'SECTN6', | ||
description: 'Section 6 Expropriation', | ||
isDisabled: false, | ||
}; | ||
|
||
const { queryByText } = setup({ | ||
acquisitionFile: mockAcquisitionFile, | ||
defaultTab: FileTabType.FILE_DETAILS, | ||
setContainerState, | ||
}); | ||
|
||
const editButton = queryByText('Expropiation'); | ||
expect(editButton).toBeInTheDocument(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useContext } from 'react'; | ||
|
||
import { SideBarContext } from '@/features/mapSideBar/context/sidebarContext'; | ||
|
||
import { IExpropiationTabcontainerViewProps } from './ExpropiationTabContainerView'; | ||
|
||
export interface IExpropiationTabContainer { | ||
acquisitionFileId: number; | ||
acquisitionFileTypeCode: string; | ||
View: React.FunctionComponent<React.PropsWithChildren<IExpropiationTabcontainerViewProps>>; | ||
} | ||
|
||
export const ExpropiationTabContainer: React.FunctionComponent< | ||
React.PropsWithChildren<IExpropiationTabContainer> | ||
> = ({ View, acquisitionFileTypeCode }) => { | ||
const { file, fileLoading } = useContext(SideBarContext); | ||
if (!!file && file?.id === undefined && fileLoading === false) { | ||
throw new Error('Unable to determine id of current file.'); | ||
} | ||
|
||
return !!file?.id ? ( | ||
<> | ||
<View loading={fileLoading} acquisitionFileTypeCode={acquisitionFileTypeCode}></View> | ||
</> | ||
) : null; | ||
}; | ||
|
||
export default ExpropiationTabContainer; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { EnumAcquisitionFileType } from '@/models/api/AcquisitionFile'; | ||
import { render, RenderOptions } from '@/utils/test-utils'; | ||
|
||
import ExpropiationTabcontainerView, { | ||
IExpropiationTabcontainerViewProps, | ||
} from './ExpropiationTabContainerView'; | ||
|
||
describe('Expropiatin Tab Container View', () => { | ||
const setup = async ( | ||
renderOptions: RenderOptions & { props?: Partial<IExpropiationTabcontainerViewProps> }, | ||
) => { | ||
const utils = render( | ||
<ExpropiationTabcontainerView | ||
{...renderOptions.props} | ||
loading={renderOptions.props?.loading ?? false} | ||
acquisitionFileTypeCode={ | ||
renderOptions.props?.acquisitionFileTypeCode ?? EnumAcquisitionFileType.SECTN6 | ||
} | ||
/>, | ||
{ | ||
...renderOptions, | ||
}, | ||
); | ||
|
||
return { | ||
...utils, | ||
}; | ||
}; | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('displays a loading spinner when loading', async () => { | ||
const { getByTestId } = await setup({ props: { loading: true } }); | ||
const spinner = getByTestId('filter-backdrop-loading'); | ||
expect(spinner).toBeVisible(); | ||
}); | ||
|
||
it('shows the sections for Acquisition file type "Section 6"', async () => { | ||
const { queryByTestId } = await setup({}); | ||
expect(queryByTestId('form-1-section')).toBeInTheDocument(); | ||
expect(queryByTestId('form-5-section')).toBeInTheDocument(); | ||
expect(queryByTestId('form-8-section')).toBeInTheDocument(); | ||
expect(queryByTestId('form-9-section')).toBeInTheDocument(); | ||
}); | ||
|
||
it('shows the sections for Acquisition file type "Section 3"', async () => { | ||
const { queryByTestId } = await setup({ | ||
props: { acquisitionFileTypeCode: EnumAcquisitionFileType.SECTN3 }, | ||
}); | ||
|
||
expect(queryByTestId('form-1-section')).not.toBeInTheDocument(); | ||
expect(queryByTestId('form-5-section')).not.toBeInTheDocument(); | ||
expect(queryByTestId('form-8-section')).toBeInTheDocument(); | ||
expect(queryByTestId('form-9-section')).not.toBeInTheDocument(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import LoadingBackdrop from '@/components/common/LoadingBackdrop'; | ||
import { Section } from '@/components/common/Section/Section'; | ||
import { EnumAcquisitionFileType } from '@/models/api/AcquisitionFile'; | ||
|
||
export interface IExpropiationTabcontainerViewProps { | ||
loading: boolean; | ||
acquisitionFileTypeCode: string; | ||
} | ||
|
||
export const ExpropiationTabcontainerView: React.FunctionComponent< | ||
IExpropiationTabcontainerViewProps | ||
> = ({ loading, acquisitionFileTypeCode }) => { | ||
// TODO : Load created Forms | ||
|
||
return ( | ||
<> | ||
<LoadingBackdrop show={loading} /> | ||
{acquisitionFileTypeCode === EnumAcquisitionFileType.SECTN6 && ( | ||
<Section header="Form 1 - Notice of Expropiation" data-testid="form-1-section"></Section> | ||
)} | ||
|
||
{acquisitionFileTypeCode === EnumAcquisitionFileType.SECTN6 && ( | ||
<Section header="Form 5 - Certificate of Approval" data-testid="form-5-section"></Section> | ||
)} | ||
|
||
<Section header="Form 8 - Notice of Advance Payment" data-testid="form-8-section"></Section> | ||
|
||
{acquisitionFileTypeCode === EnumAcquisitionFileType.SECTN6 && ( | ||
<Section header="Form 9 - Vesting Notice" data-testid="form-9-section"></Section> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default ExpropiationTabcontainerView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be removed (seems like you are sharing the same branch from your last pr?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed