Skip to content

Commit

Permalink
UITEN-285: Disable edit of Routing service point field (ECS only)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy-Litvinenko committed May 29, 2024
1 parent 9daf3c3 commit 73da56c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [UITEN-282] (https://issues.folio.org/browse/UITEN-282) Reading Room Access (settings): Update reading room.
* [UITEN-283] (https://issues.folio.org/browse/UITEN-283) Reading Room Access (settings): Delete reading room.
* [UITEN-281](https://folio-org.atlassian.net/browse/UITEN-281) Add Routing service point option to Service point page(ECS only).
* [UITEN-285](https://folio-org.atlassian.net/browse/UITEN-285) Disable edit of Routing service point field (ECS only).

## [8.1.0](https://github.com/folio-org/ui-tenant-settings/tree/v8.1.0)(2024-03-19)
[Full Changelog](https://github.com/folio-org/ui-tenant-settings/compare/v8.0.0...v8.1.0)
Expand Down
7 changes: 5 additions & 2 deletions src/settings/ServicePoints/ServicePointForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ export const SELECTED_ROUTING_SERVICE_POINT_VALUE = 'true';
export const SELECTED_PICKUP_LOCATION_VALUE = 'true';
export const UNSELECTED_PICKUP_LOCATION_VALUE = 'false';
export const LAYER_EDIT = 'layer=edit';
export const isLayerEdit = (search) => (
search.includes(LAYER_EDIT)
);
export const isConfirmPickupLocationChangeModalShouldBeVisible = (search, value) => (
search.includes(LAYER_EDIT) && value === UNSELECTED_PICKUP_LOCATION_VALUE
isLayerEdit(search) && value === UNSELECTED_PICKUP_LOCATION_VALUE
);

const ServicePointForm = ({
Expand Down Expand Up @@ -309,7 +312,7 @@ const ServicePointForm = ({
component={Select}
dataOptions={selectOptions}
onChange={handleEcsRequestRoutingChange}
disabled={disabled}
disabled={disabled || isLayerEdit(search)}
/>
</Col>
</Row>
Expand Down
15 changes: 13 additions & 2 deletions src/settings/ServicePoints/ServicePointForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ import {
SELECTED_PICKUP_LOCATION_VALUE,
UNSELECTED_PICKUP_LOCATION_VALUE,
LAYER_EDIT,
isLayerEdit,
isConfirmPickupLocationChangeModalShouldBeVisible,
} from './ServicePointForm';

describe('ServicePointForm', () => {
describe('isConfirmPickupLocationChangeModalShouldBeVisible', () => {
const OTHER_LAYER = 'other';
const OTHER_LAYER = 'other';

describe('isLayerEdit', () => {
it(`should return true for layer equal "${LAYER_EDIT}"`, () => {
expect(isLayerEdit(LAYER_EDIT)).toBe(true);
});

it(`should return false for layer not equal "${LAYER_EDIT}"(${OTHER_LAYER})`, () => {
expect(isLayerEdit(OTHER_LAYER)).toBe(false);
});
});

describe('isConfirmPickupLocationChangeModalShouldBeVisible', () => {
it(`should return true for layer equal "${LAYER_EDIT}" and value "${UNSELECTED_PICKUP_LOCATION_VALUE}"`, () => {
expect(isConfirmPickupLocationChangeModalShouldBeVisible(LAYER_EDIT, UNSELECTED_PICKUP_LOCATION_VALUE)).toBe(true);
});
Expand Down

0 comments on commit 73da56c

Please sign in to comment.