Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
All other traffic will be redirected to the React application.

### Bugfix
* *Describe bugfix here.*
* [OSDEV-1695](https://opensupplyhub.atlassian.net/browse/OSDEV-1695) - SLC: Refactored the "Submit Another Location" button link to direct users to the search-by-name-and-address form at /contribute/single-location?tab=name-address.

### What's new
* [OSDEV-1662](https://opensupplyhub.atlassian.net/browse/OSDEV-1662) - Added a new field, `action_perform_by`, to the moderation event. This data appears on the Contribution Record page when a moderator perform any actions like `APPROVED` or `REJECTED`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,44 @@ describe('ProductionLocationDialog', () => {
expect(window.getComputedStyle(claimButton).pointerEvents).toBe(shouldBeDisabled ? 'none' : '');
});

test('check link of Search OS Hub button', () => {
const { getByRole } = render(
<Router>
<ProductionLocationDialog
classes={{}}
data={defaultProps.data}
osID={defaultProps.osID}
moderationStatus='APPROVED'
claimStatus='unclaimed'
/>
</Router>
);

const searchOSHubButton = getByRole('button', { name: /Search OS Hub/i });
fireEvent.click(searchOSHubButton);

expect(mockHistoryPush).toHaveBeenCalledWith('/');
});

test('check link of Submit another Location button', () => {
const { getByRole } = render(
<Router>
<ProductionLocationDialog
classes={{}}
data={defaultProps.data}
osID={defaultProps.osID}
moderationStatus='APPROVED'
claimStatus='unclaimed'
/>
</Router>
);

const submitAnotherLocationButton = getByRole('button', { name: /Submit another Location/i });
fireEvent.click(submitAnotherLocationButton);

expect(mockHistoryPush).toHaveBeenCalledWith('/contribute/single-location?tab=name-address');
});

test('check link to the claim flow for specific production location', () => {
const { getByRole } = render(
<Router>
Expand All @@ -144,7 +182,7 @@ describe('ProductionLocationDialog', () => {

const claimButton = getByRole('button', { name: /Continue to Claim/i });
expect(claimButton).toHaveAttribute('href', `/facilities/${defaultProps.osID}/claim`);
})
});

test('closes ProductionLocationDialog when close button is clicked', () => {
const handleShowMock = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import DialogTooltip from './DialogTooltip';
import ProductionLocationDialogFields from './ProductionLocationDialogFields';
import {
mainRoute,
searchByNameAndAddressResultRoute,
contributeProductionLocationRoute,
MODERATION_STATUSES_ENUM,
PRODUCTION_LOCATION_CLAIM_STATUSES_ENUM,
EMPTY_PLACEHOLDER,
Expand Down Expand Up @@ -132,8 +132,8 @@ const ProductionLocationDialog = ({
const statusLabel = startCase(toLower(moderationStatus));

const handleGoToMainPage = () => history.push(mainRoute);
const handleGoToSearchByNameAndAddressResult = () =>
history.push(searchByNameAndAddressResultRoute);
const handleGoToSearchByNameAndAddress = () =>
history.push(`${contributeProductionLocationRoute}?tab=name-address`);

const deleteIcon =
moderationStatus === MODERATION_STATUSES_ENUM.PENDING ? (
Expand Down Expand Up @@ -274,7 +274,7 @@ const ProductionLocationDialog = ({
<Button
variant="contained"
color="secondary"
onClick={handleGoToSearchByNameAndAddressResult}
onClick={handleGoToSearchByNameAndAddress}
className={classes.button}
>
Submit another Location
Expand Down