fix: PR requests
This commit is contained in:
committed by
Jason Wesson
parent
86fd29309a
commit
57d09af61d
@@ -15,7 +15,6 @@ export const Dashboard = () => {
|
||||
hooks.useInitializeDashboard();
|
||||
const { pageTitle } = hooks.useDashboardMessages();
|
||||
const hasCourses = reduxHooks.useHasCourses();
|
||||
const hasAvailableDashboards = reduxHooks.useHasAvailableDashboards();
|
||||
const initIsPending = reduxHooks.useRequestIsPending(RequestKeys.initialize);
|
||||
const showSelectSessionModal = reduxHooks.useShowSelectSessionModal();
|
||||
|
||||
@@ -24,7 +23,7 @@ export const Dashboard = () => {
|
||||
<h1 className="sr-only">{pageTitle}</h1>
|
||||
{!initIsPending && (
|
||||
<>
|
||||
{hasAvailableDashboards && <DashboardModalSlot />}
|
||||
<DashboardModalSlot />
|
||||
{(hasCourses && showSelectSessionModal) && <SelectSessionModal />}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -14,7 +14,6 @@ import Dashboard from '.';
|
||||
jest.mock('hooks', () => ({
|
||||
reduxHooks: {
|
||||
useHasCourses: jest.fn(),
|
||||
useHasAvailableDashboards: jest.fn(),
|
||||
useShowSelectSessionModal: jest.fn(),
|
||||
useRequestIsPending: jest.fn(),
|
||||
},
|
||||
@@ -38,12 +37,10 @@ describe('Dashboard', () => {
|
||||
});
|
||||
const createWrapper = ({
|
||||
hasCourses,
|
||||
hasAvailableDashboards,
|
||||
initIsPending,
|
||||
showSelectSessionModal,
|
||||
}) => {
|
||||
reduxHooks.useHasCourses.mockReturnValueOnce(hasCourses);
|
||||
reduxHooks.useHasAvailableDashboards.mockReturnValueOnce(hasAvailableDashboards);
|
||||
reduxHooks.useRequestIsPending.mockReturnValueOnce(initIsPending);
|
||||
reduxHooks.useShowSelectSessionModal.mockReturnValueOnce(showSelectSessionModal);
|
||||
return shallow(<Dashboard />);
|
||||
@@ -80,7 +77,7 @@ describe('Dashboard', () => {
|
||||
it(`renders ${contentName}`, () => {
|
||||
testContent(contentEl);
|
||||
});
|
||||
it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => {
|
||||
it(`${renderString(showEnterpriseModal)} dashboard modal`, () => {
|
||||
expect(wrapper.instance.findByType(DashboardModalSlot).length)
|
||||
.toEqual(showEnterpriseModal ? 1 : 0);
|
||||
});
|
||||
@@ -92,7 +89,6 @@ describe('Dashboard', () => {
|
||||
testView({
|
||||
props: {
|
||||
hasCourses: false,
|
||||
hasAvailableDashboards: false,
|
||||
initIsPending: true,
|
||||
showSelectSessionModal: false,
|
||||
},
|
||||
@@ -102,11 +98,10 @@ describe('Dashboard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('courses loaded, show select session modal, no available dashboards', () => {
|
||||
describe('courses loaded, show select session modal', () => {
|
||||
testView({
|
||||
props: {
|
||||
hasCourses: true,
|
||||
hasAvailableDashboards: false,
|
||||
initIsPending: false,
|
||||
showSelectSessionModal: true,
|
||||
},
|
||||
@@ -118,11 +113,10 @@ describe('Dashboard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('there are no courses, there ARE available dashboards', () => {
|
||||
describe('there are no courses', () => {
|
||||
testView({
|
||||
props: {
|
||||
hasCourses: false,
|
||||
hasAvailableDashboards: true,
|
||||
initIsPending: false,
|
||||
showSelectSessionModal: false,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,6 @@ export const useSocialShareSettings = () => useSelector(selectors.socialShareSet
|
||||
|
||||
/** global-level meta-selectors **/
|
||||
export const useHasCourses = () => useSelector(selectors.hasCourses);
|
||||
export const useHasAvailableDashboards = () => useSelector(selectors.hasAvailableDashboards);
|
||||
export const useCurrentCourseList = (opts) => useSelector(
|
||||
state => selectors.currentList(state, opts),
|
||||
);
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
|
||||
## Description
|
||||
|
||||
This slot is used for the modal on a dashboard that directs you to the enterprise dashboard if applicable.
|
||||
This slot is used for the modal on a dashboard that appears on initial load.
|
||||
The following `env.config.jsx` will render the modal.
|
||||
|
||||
## Example
|
||||
|
||||
Learner dashboard will show modal on initial load
|
||||

|
||||
|
||||
```js
|
||||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard';
|
||||
import { ModalDialog } from '@openedx/paragon';
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
@@ -21,10 +26,8 @@ const config = {
|
||||
id: 'dashboard_modal',
|
||||
type: DIRECT_PLUGIN,
|
||||
priority: 60,
|
||||
RenderWidget: DashboardModal,
|
||||
content: {
|
||||
store,
|
||||
},
|
||||
RenderWidget:
|
||||
<ModalDialog title="Modal that appears on initial render of learner dashboard" />,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 187 KiB |
Reference in New Issue
Block a user