feat: remove the ability to use image tools for content libraries
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user