diff --git a/src/containers/Dashboard/__snapshots__/index.test.jsx.snap b/src/containers/Dashboard/__snapshots__/index.test.jsx.snap index 1f6b098..9fdbbbd 100644 --- a/src/containers/Dashboard/__snapshots__/index.test.jsx.snap +++ b/src/containers/Dashboard/__snapshots__/index.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Dashboard snapshots courses loaded, show select session modal, no available dashboards snapshot 1`] = ` +exports[`Dashboard snapshots courses loaded, show select session modal snapshot 1`] = `
+
`; -exports[`Dashboard snapshots there are no courses, there ARE available dashboards snapshot 1`] = ` +exports[`Dashboard snapshots there are no courses snapshot 1`] = `
- +
{ const testView = ({ props, content: [contentName, contentEl], - showEnterpriseModal, showSelectSessionModal, }) => { beforeEach(() => { wrapper = createWrapper(props); }); @@ -77,10 +75,6 @@ describe('Dashboard', () => { it(`renders ${contentName}`, () => { testContent(contentEl); }); - it(`${renderString(showEnterpriseModal)} dashboard modal`, () => { - expect(wrapper.instance.findByType(DashboardModalSlot).length) - .toEqual(showEnterpriseModal ? 1 : 0); - }); it(`${renderString(showSelectSessionModal)} select session modal`, () => { expect(wrapper.instance.findByType(SelectSessionModal).length).toEqual(showSelectSessionModal ? 1 : 0); }); @@ -93,7 +87,6 @@ describe('Dashboard', () => { showSelectSessionModal: false, }, content: ['LoadingView', ], - showEnterpriseModal: false, showSelectSessionModal: false, }); }); @@ -108,7 +101,6 @@ describe('Dashboard', () => { content: ['LoadedView', ( )], - showEnterpriseModal: false, showSelectSessionModal: true, }); }); @@ -123,7 +115,6 @@ describe('Dashboard', () => { content: ['Dashboard layout with no courses sidebar and content', ( )], - showEnterpriseModal: true, showSelectSessionModal: false, }); }); diff --git a/src/data/redux/app/selectors/appSelectors.js b/src/data/redux/app/selectors/appSelectors.js index 04932e1..255c797 100644 --- a/src/data/redux/app/selectors/appSelectors.js +++ b/src/data/redux/app/selectors/appSelectors.js @@ -10,10 +10,7 @@ export const numCourses = createSelector( (courseData) => Object.keys(courseData).length, ); export const hasCourses = createSelector([module.numCourses], (num) => num > 0); -export const hasAvailableDashboards = createSelector( - [simpleSelectors.enterpriseDashboard], - (data) => data !== null && data.isLearnerPortalEnabled === true, -); + export const showSelectSessionModal = createSelector( [simpleSelectors.selectSessionModal], (data) => data.cardId != null, @@ -22,6 +19,5 @@ export const showSelectSessionModal = createSelector( export default StrictDict({ numCourses, hasCourses, - hasAvailableDashboards, showSelectSessionModal, }); diff --git a/src/data/redux/app/selectors/appSelectors.test.js b/src/data/redux/app/selectors/appSelectors.test.js index ee4f3c7..09b528c 100644 --- a/src/data/redux/app/selectors/appSelectors.test.js +++ b/src/data/redux/app/selectors/appSelectors.test.js @@ -17,15 +17,6 @@ describe('basic app selectors', () => { expect(cb(0)).toEqual(false); }); }); - describe('hasAvailableDashboards', () => { - it('returns true iff the enterpriseDashboard field is populated and learner portal is enabled', () => { - const { preSelectors, cb } = appSelectors.hasAvailableDashboards; - expect(preSelectors).toEqual([simpleSelectors.enterpriseDashboard]); - expect(cb({ isLearnerPortalEnabled: true })).toEqual(true); - expect(cb({ isLearnerPortalEnabled: false })).toEqual(false); - expect(cb(null)).toEqual(false); - }); - }); describe('showSelectSessionModal', () => { it('returns true if the selectSessionModal cardId is not null', () => { const { preSelectors, cb } = appSelectors.showSelectSessionModal; diff --git a/src/data/redux/app/selectors/simpleSelectors.test.js b/src/data/redux/app/selectors/simpleSelectors.test.js index 02dad82..7d9a8db 100644 --- a/src/data/redux/app/selectors/simpleSelectors.test.js +++ b/src/data/redux/app/selectors/simpleSelectors.test.js @@ -36,12 +36,6 @@ describe('app simple selectors', () => { expect(preSelectors).toEqual([appSelector]); expect(cb(testState.app)).toEqual(testString); }); - test('enterpriseDashboard returns empty object if data returns null', () => { - testState = { app: { enterpriseDashboard: null } }; - const { preSelectors, cb } = simpleSelectors.enterpriseDashboard; - expect(preSelectors).toEqual([appSelector]); - expect(cb(testState.app)).toEqual({}); - }); describe('cardSimpleSelectors', () => { keys = keyStore(cardSimpleSelectors); test.each([ diff --git a/src/plugin-slots/DashboardModalSlot/README.md b/src/plugin-slots/DashboardModalSlot/README.md index d94312a..f5fe532 100644 --- a/src/plugin-slots/DashboardModalSlot/README.md +++ b/src/plugin-slots/DashboardModalSlot/README.md @@ -1,16 +1,16 @@ -# Course Card Action Slot +# Dashboard Modal Slot ### Slot ID: `dashboard_modal_slot` ## Description -This slot is used for the modal on a dashboard that appears on initial load. +This slot is used for the modal on a dashboard. The following `env.config.jsx` will render the modal. ## Example -Learner dashboard will show modal on initial load -![Screenshot of the dashboard modal](./images/widget_sidebar_slot.png) +Learner dashboard will show modal +![Screenshot of the dashboard modal](./images/dashboard_modal_slot.png) ```js import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; @@ -27,7 +27,7 @@ const config = { type: DIRECT_PLUGIN, priority: 60, RenderWidget: - , + , }, }, ], diff --git a/src/plugin-slots/DashboardModalSlot/images/widget_sidebar_slot.png b/src/plugin-slots/DashboardModalSlot/images/dashboard_modal_slot.png similarity index 100% rename from src/plugin-slots/DashboardModalSlot/images/widget_sidebar_slot.png rename to src/plugin-slots/DashboardModalSlot/images/dashboard_modal_slot.png diff --git a/src/plugin-slots/DashboardModalSlot/index.jsx b/src/plugin-slots/DashboardModalSlot/index.jsx index 8926eeb..54a4288 100644 --- a/src/plugin-slots/DashboardModalSlot/index.jsx +++ b/src/plugin-slots/DashboardModalSlot/index.jsx @@ -1,8 +1,8 @@ import React from 'react'; import { PluginSlot } from '@openedx/frontend-plugin-framework'; -const DashboardModal = () => ( +const DashboardModalSlot = () => ( ); -export default DashboardModal; +export default DashboardModalSlot;