-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PSP-5715 : Sec3/Sec6 add forms to acquisition file (#3292)
Co-authored-by: Eduardo Herrera <Eduardo.Herrera@quartech.com>
- Loading branch information
1 parent
f87373e
commit 971bf64
Showing
24 changed files
with
213 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...tend/src/features/mapSideBar/acquisition/tabs/expropriation/ExpropriationTabContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { IExpropriationTabcontainerViewProps } from './ExpropriationTabContainerView'; | ||
|
||
export interface IExpropriationTabContainer { | ||
acquisitionFileId: number; | ||
acquisitionFileTypeCode: string; | ||
View: React.FunctionComponent<React.PropsWithChildren<IExpropriationTabcontainerViewProps>>; | ||
} | ||
|
||
export const ExpropriationTabContainer: React.FunctionComponent< | ||
React.PropsWithChildren<IExpropriationTabContainer> | ||
> = ({ 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 ExpropriationTabContainer; |
58 changes: 58 additions & 0 deletions
58
...features/mapSideBar/acquisition/tabs/expropriation/ExpropriationTabContainerView.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, { | ||
IExpropriationTabcontainerViewProps, | ||
} from './ExpropriationTabContainerView'; | ||
|
||
describe('Expropiatin Tab Container View', () => { | ||
const setup = async ( | ||
renderOptions: RenderOptions & { props?: Partial<IExpropriationTabcontainerViewProps> }, | ||
) => { | ||
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(); | ||
}); | ||
}); |
Oops, something went wrong.