Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
fix: remove flag check
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Feb 16, 2024
1 parent 2d2fe7e commit b7af486
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 43 deletions.
46 changes: 9 additions & 37 deletions src/library-authoring/studio-header-wrapper/specs/utils.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getConfig, setConfig } from '@edx/frontend-platform';
import { LOADING_STATUS } from '../../common';
import { getMainMenuDropdown, getOutlineLink } from '../utils';

Expand All @@ -24,11 +23,18 @@ describe('studio header wrapper utils', () => {
});
});
describe('getMainMenuDropdown', () => {
it('should return an array of length 1', () => {
it('should return an array of length 1 and correct items', () => {
const libraryId = 'testId';
const loadingStatus = LOADING_STATUS.LOADED;
const dropdownArray = getMainMenuDropdown(loadingStatus, libraryId, { formatMessage: jest.fn() });
const dropdownArray = getMainMenuDropdown(loadingStatus, libraryId, intl);
expect(dropdownArray).toHaveLength(1);
const subItemTitles = dropdownArray[0].items.map(item => item.title);
expect(subItemTitles).toEqual([
'Details',
'User access',
'Export Tags',
'Import',
]);
});
it('should return an empty array', () => {
const libraryId = 'testId';
Expand All @@ -37,38 +43,4 @@ describe('studio header wrapper utils', () => {
expect(dropdownArray).toHaveLength(0);
});
});

it('should show the export tags sub item when the flag is true', () => {
const libraryId = 'testId';
const loadingStatus = LOADING_STATUS.LOADED;
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
});
const dropdownArray = getMainMenuDropdown(loadingStatus, libraryId, intl);
expect(dropdownArray).toHaveLength(1);
const subItemTitles = dropdownArray[0].items.map(item => item.title);
expect(subItemTitles).toEqual([
'Details',
'User access',
'Export Tags',
'Import',
]);
});
it('should not show the export tags sub item when the flag is false', () => {
const libraryId = 'testId';
const loadingStatus = LOADING_STATUS.LOADED;
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
});
const dropdownArray = getMainMenuDropdown(loadingStatus, libraryId, intl);
expect(dropdownArray).toHaveLength(1);
const subItemTitles = dropdownArray[0].items.map(item => item.title);
expect(subItemTitles).toEqual([
'Details',
'User access',
'Import',
]);
});
});
10 changes: 4 additions & 6 deletions src/library-authoring/studio-header-wrapper/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ export const getMainMenuDropdown = (loadingStatus, libraryId, intl) => {
href: ROUTES.Detail.ACCESS_SLUG(libraryId),
title: intl.formatMessage(messages['library.header.settings.access']),
},
...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' ? [
{
href: `${getConfig().STUDIO_BASE_URL}/api/content_tagging/v1/object_tags/${libraryId}/export/`,
title: intl.formatMessage(messages['library.header.settings.exportTags']),
},
] : []),
{
href: `${getConfig().STUDIO_BASE_URL}/api/content_tagging/v1/object_tags/${libraryId}/export/`,
title: intl.formatMessage(messages['library.header.settings.exportTags']),
},
{
href: ROUTES.Detail.IMPORT_SLUG(libraryId),
title: intl.formatMessage(messages['library.header.settings.import']),
Expand Down

0 comments on commit b7af486

Please sign in to comment.