diff --git a/src/react/src/__tests__/components/ProductionLocationDialog.test.js b/src/react/src/__tests__/components/ProductionLocationDialog.test.js
index 156a62836..621e58873 100644
--- a/src/react/src/__tests__/components/ProductionLocationDialog.test.js
+++ b/src/react/src/__tests__/components/ProductionLocationDialog.test.js
@@ -104,63 +104,47 @@ describe('ProductionLocationDialog', () => {
expect(screen.getByText(/Shirts, Pants/i)).toBeInTheDocument();
});
- test('Continue to Claim button should be active if production location is unclaimed and approved', () => {
+ test.each([
+ ['PENDING', 'unclaimed', true],
+ ['PENDING', 'claimed', true],
+ ['REJECTED', 'claimed', true],
+ ['REJECTED', 'unclaimed', false],
+ ['REJECTED', undefined, true],
+ ['APPROVED', 'unclaimed', false],
+ ['APPROVED', 'claimed', true]
+ ])('handles moderation status %s and claim status %s correctly', (moderationStatus, claimStatus, shouldBeDisabled) => {
const { getByRole } = render(
);
const claimButton = getByRole('button', { name: /Continue to Claim/i });
-
- expect(window.getComputedStyle(claimButton).pointerEvents).not.toBe('none');
-
- expect(claimButton).toHaveAttribute('href', `/facilities/${defaultProps.osID}/claim`);
+ expect(window.getComputedStyle(claimButton).pointerEvents).toBe(shouldBeDisabled ? 'none' : '');
});
- test('Continue to Claim button should be active if production location is unclaimed and rejected', () => {
+ test('check link to the claim flow for specific production location', () => {
const { getByRole } = render(
);
const claimButton = getByRole('button', { name: /Continue to Claim/i });
-
- expect(window.getComputedStyle(claimButton).pointerEvents).not.toBe('none');
-
expect(claimButton).toHaveAttribute('href', `/facilities/${defaultProps.osID}/claim`);
- });
-
- test('Continue to Claim button should be disabled if production location has been claimed', () => {
- const { getByRole } = render(
-
-
-
- );
-
- const claimButton = getByRole('button', { name: /Continue to Claim/i });
-
- expect(window.getComputedStyle(claimButton).pointerEvents).toBe('none');
- });
+ })
test('closes ProductionLocationDialog when close button is clicked', () => {
const handleShowMock = jest.fn();
diff --git a/src/react/src/components/Contribute/ProductionLocationDialog.jsx b/src/react/src/components/Contribute/ProductionLocationDialog.jsx
index 4115e8e0f..ba891b179 100644
--- a/src/react/src/components/Contribute/ProductionLocationDialog.jsx
+++ b/src/react/src/components/Contribute/ProductionLocationDialog.jsx
@@ -80,7 +80,7 @@ const getTooltipText = (claimStatus, moderationStatus) => {
return 'Production location has been claimed already.';
}
- return '';
+ return 'Claim is not available.';
};
const ProductionLocationDialog = ({
@@ -310,7 +310,7 @@ const ProductionLocationDialog = ({
ProductionLocationDialog.defaultProps = {
osID: null,
- claimStatus: PRODUCTION_LOCATION_CLAIM_STATUSES_ENUM.UNCLAIMED,
+ claimStatus: null,
};
ProductionLocationDialog.propTypes = {
diff --git a/src/react/src/components/Contribute/ProductionLocationInfo.jsx b/src/react/src/components/Contribute/ProductionLocationInfo.jsx
index f9bac8e4b..c4d865041 100644
--- a/src/react/src/components/Contribute/ProductionLocationInfo.jsx
+++ b/src/react/src/components/Contribute/ProductionLocationInfo.jsx
@@ -54,7 +54,6 @@ import {
productionLocationInfoRouteCommon,
searchByNameAndAddressResultRoute,
MODERATION_STATUSES_ENUM,
- PRODUCTION_LOCATION_CLAIM_STATUSES_ENUM,
} from '../../util/constants';
import COLOURS from '../../util/COLOURS';
import ProductionLocationDialog from './ProductionLocationDialog';
@@ -794,8 +793,7 @@ const ProductionLocationInfo = ({
MODERATION_STATUSES_ENUM.PENDING
}
claimStatus={
- singleProductionLocationData?.claim_status ||
- PRODUCTION_LOCATION_CLAIM_STATUSES_ENUM.UNCLAIMED
+ singleProductionLocationData?.claim_status || null
}
/>
) : null}