feat: remove the ability to use image tools for content libraries

This commit is contained in:
Kristin Aoki
2022-08-30 16:40:17 -04:00
committed by GitHub
parent 36380edce4
commit 4e69fffbef
8 changed files with 196 additions and 66 deletions

View File

@@ -82,6 +82,19 @@ export const isRaw = createSelector(
},
);
export const isLibrary = createSelector(
[module.simpleSelectors.learningContextId],
(learningContextId) => {
if (!learningContextId) {
return null;
}
if (learningContextId && learningContextId.startsWith('library-v1')) {
return true;
}
return false;
},
);
export default {
...simpleSelectors,
isInitialized,
@@ -89,4 +102,5 @@ export default {
displayTitle,
analytics,
isRaw,
isLibrary,
};

View File

@@ -140,4 +140,23 @@ describe('app selectors unit tests', () => {
expect(selectors.isRaw.cb(studioViewVisual)).toEqual(false);
});
});
describe('isLibrary', () => {
const learningContextIdLibrary = 'library-v1:name';
const learningContextIdCourse = 'course-v1:name';
it('is memoized based on studioView', () => {
expect(selectors.isLibrary.preSelectors).toEqual([
simpleSelectors.learningContextId,
]);
});
it('returns null if blockId is null', () => {
expect(selectors.isLibrary.cb(null)).toEqual(null);
});
it('returns true if blockId starts with lib', () => {
expect(selectors.isLibrary.cb(learningContextIdLibrary)).toEqual(true);
});
it('returns false if the blockId does not start with lib', () => {
expect(selectors.isLibrary.cb(learningContextIdCourse)).toEqual(false);
});
});
});