fix: PR requests
This commit is contained in:
committed by
Jason Wesson
parent
57d09af61d
commit
76783133da
@@ -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`] = `
|
||||
<div
|
||||
className="d-flex flex-column p-2 pt-0"
|
||||
id="dashboard-container"
|
||||
@@ -11,6 +11,7 @@ exports[`Dashboard snapshots courses loaded, show select session modal, no avail
|
||||
test-page-title
|
||||
</h1>
|
||||
<Fragment>
|
||||
<DashboardModalSlot />
|
||||
<SelectSessionModal />
|
||||
</Fragment>
|
||||
<div
|
||||
@@ -43,7 +44,7 @@ exports[`Dashboard snapshots courses still loading snapshot 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Dashboard snapshots there are no courses, there ARE available dashboards snapshot 1`] = `
|
||||
exports[`Dashboard snapshots there are no courses snapshot 1`] = `
|
||||
<div
|
||||
className="d-flex flex-column p-2 pt-0"
|
||||
id="dashboard-container"
|
||||
@@ -54,7 +55,7 @@ exports[`Dashboard snapshots there are no courses, there ARE available dashboard
|
||||
test-page-title
|
||||
</h1>
|
||||
<Fragment>
|
||||
<DashboardModal />
|
||||
<DashboardModalSlot />
|
||||
</Fragment>
|
||||
<div
|
||||
data-testid="dashboard-content"
|
||||
|
||||
@@ -4,7 +4,6 @@ import { reduxHooks } from 'hooks';
|
||||
|
||||
import SelectSessionModal from 'containers/SelectSessionModal';
|
||||
import CoursesPanel from 'containers/CoursesPanel';
|
||||
import DashboardModalSlot from 'plugin-slots/DashboardModalSlot';
|
||||
|
||||
import DashboardLayout from './DashboardLayout';
|
||||
import LoadingView from './LoadingView';
|
||||
@@ -68,7 +67,6 @@ describe('Dashboard', () => {
|
||||
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', <LoadingView />],
|
||||
showEnterpriseModal: false,
|
||||
showSelectSessionModal: false,
|
||||
});
|
||||
});
|
||||
@@ -108,7 +101,6 @@ describe('Dashboard', () => {
|
||||
content: ['LoadedView', (
|
||||
<DashboardLayout><CoursesPanel /></DashboardLayout>
|
||||
)],
|
||||
showEnterpriseModal: false,
|
||||
showSelectSessionModal: true,
|
||||
});
|
||||
});
|
||||
@@ -123,7 +115,6 @@ describe('Dashboard', () => {
|
||||
content: ['Dashboard layout with no courses sidebar and content', (
|
||||
<DashboardLayout><CoursesPanel /></DashboardLayout>
|
||||
)],
|
||||
showEnterpriseModal: true,
|
||||
showSelectSessionModal: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -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
|
||||

|
||||
Learner dashboard will show modal
|
||||

|
||||
|
||||
```js
|
||||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
@@ -27,7 +27,7 @@ const config = {
|
||||
type: DIRECT_PLUGIN,
|
||||
priority: 60,
|
||||
RenderWidget:
|
||||
<ModalDialog title="Modal that appears on initial render of learner dashboard" />,
|
||||
<ModalDialog title="Modal that appears on learner dashboard" />,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 187 KiB |
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const DashboardModal = () => (
|
||||
const DashboardModalSlot = () => (
|
||||
<PluginSlot id="dashboard_modal_slot" />
|
||||
);
|
||||
|
||||
export default DashboardModal;
|
||||
export default DashboardModalSlot;
|
||||
|
||||
Reference in New Issue
Block a user