diff --git a/web/client/selectors/__tests__/mediaEditor-test.js b/web/client/selectors/__tests__/mediaEditor-test.js index 4fce11b3c9..7d30815f96 100644 --- a/web/client/selectors/__tests__/mediaEditor-test.js +++ b/web/client/selectors/__tests__/mediaEditor-test.js @@ -27,7 +27,8 @@ import { getCurrentMediaResourcesParams, getCurrentMediaResourcesTotalCount, getLoadingSelectedMedia, - getLoadingMediaList + getLoadingMediaList, + disableApplyMapMedia } from "../mediaEditor"; describe('mediaEditor selectors', () => { @@ -278,4 +279,16 @@ describe('mediaEditor selectors', () => { } })).toBe(true); }); + it('disableApplyMapMedia', () => { + expect(disableApplyMapMedia({ + mediaEditor: { + loadingSelected: true + } + })).toBe(true); + expect(disableApplyMapMedia({ + mediaEditor: { + loadingSelected: false + } + })).toBe(false); + }); }); diff --git a/web/client/selectors/mediaEditor.js b/web/client/selectors/mediaEditor.js index b1b2ca59f8..d6eacaf072 100644 --- a/web/client/selectors/mediaEditor.js +++ b/web/client/selectors/mediaEditor.js @@ -62,6 +62,8 @@ export const disabledMediaTypeSelector = state => get(state, "mediaEditor.disabl /** * Disable `apply` on empty selection for map media editor when geostory section is GeoCarousel, * here disable media type value is available only in GeoCarousel section + * The apply button should be disabled also when a selected item is loading */ export const disableApplyMapMedia = (state) => - disabledMediaTypeSelector(state).length && !selectedItemSelector(state) && currentMediaTypeSelector(state) === 'map'; + (disabledMediaTypeSelector(state).length && !selectedItemSelector(state) && currentMediaTypeSelector(state) === 'map') + || getLoadingSelectedMedia(state);