Skip to content

Commit 7678313

Browse files
kiram15jsnwesson
authored andcommitted
fix: PR requests
1 parent 57d09af commit 7678313

File tree

8 files changed

+12
-39
lines changed

8 files changed

+12
-39
lines changed

src/containers/Dashboard/__snapshots__/index.test.jsx.snap

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Dashboard snapshots courses loaded, show select session modal, no available dashboards snapshot 1`] = `
3+
exports[`Dashboard snapshots courses loaded, show select session modal snapshot 1`] = `
44
<div
55
className="d-flex flex-column p-2 pt-0"
66
id="dashboard-container"
@@ -11,6 +11,7 @@ exports[`Dashboard snapshots courses loaded, show select session modal, no avail
1111
test-page-title
1212
</h1>
1313
<Fragment>
14+
<DashboardModalSlot />
1415
<SelectSessionModal />
1516
</Fragment>
1617
<div
@@ -43,7 +44,7 @@ exports[`Dashboard snapshots courses still loading snapshot 1`] = `
4344
</div>
4445
`;
4546

46-
exports[`Dashboard snapshots there are no courses, there ARE available dashboards snapshot 1`] = `
47+
exports[`Dashboard snapshots there are no courses snapshot 1`] = `
4748
<div
4849
className="d-flex flex-column p-2 pt-0"
4950
id="dashboard-container"
@@ -54,7 +55,7 @@ exports[`Dashboard snapshots there are no courses, there ARE available dashboard
5455
test-page-title
5556
</h1>
5657
<Fragment>
57-
<DashboardModal />
58+
<DashboardModalSlot />
5859
</Fragment>
5960
<div
6061
data-testid="dashboard-content"

src/containers/Dashboard/index.test.jsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { reduxHooks } from 'hooks';
44

55
import SelectSessionModal from 'containers/SelectSessionModal';
66
import CoursesPanel from 'containers/CoursesPanel';
7-
import DashboardModalSlot from 'plugin-slots/DashboardModalSlot';
87

98
import DashboardLayout from './DashboardLayout';
109
import LoadingView from './LoadingView';
@@ -68,7 +67,6 @@ describe('Dashboard', () => {
6867
const testView = ({
6968
props,
7069
content: [contentName, contentEl],
71-
showEnterpriseModal,
7270
showSelectSessionModal,
7371
}) => {
7472
beforeEach(() => { wrapper = createWrapper(props); });
@@ -77,10 +75,6 @@ describe('Dashboard', () => {
7775
it(`renders ${contentName}`, () => {
7876
testContent(contentEl);
7977
});
80-
it(`${renderString(showEnterpriseModal)} dashboard modal`, () => {
81-
expect(wrapper.instance.findByType(DashboardModalSlot).length)
82-
.toEqual(showEnterpriseModal ? 1 : 0);
83-
});
8478
it(`${renderString(showSelectSessionModal)} select session modal`, () => {
8579
expect(wrapper.instance.findByType(SelectSessionModal).length).toEqual(showSelectSessionModal ? 1 : 0);
8680
});
@@ -93,7 +87,6 @@ describe('Dashboard', () => {
9387
showSelectSessionModal: false,
9488
},
9589
content: ['LoadingView', <LoadingView />],
96-
showEnterpriseModal: false,
9790
showSelectSessionModal: false,
9891
});
9992
});
@@ -108,7 +101,6 @@ describe('Dashboard', () => {
108101
content: ['LoadedView', (
109102
<DashboardLayout><CoursesPanel /></DashboardLayout>
110103
)],
111-
showEnterpriseModal: false,
112104
showSelectSessionModal: true,
113105
});
114106
});
@@ -123,7 +115,6 @@ describe('Dashboard', () => {
123115
content: ['Dashboard layout with no courses sidebar and content', (
124116
<DashboardLayout><CoursesPanel /></DashboardLayout>
125117
)],
126-
showEnterpriseModal: true,
127118
showSelectSessionModal: false,
128119
});
129120
});

src/data/redux/app/selectors/appSelectors.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ export const numCourses = createSelector(
1010
(courseData) => Object.keys(courseData).length,
1111
);
1212
export const hasCourses = createSelector([module.numCourses], (num) => num > 0);
13-
export const hasAvailableDashboards = createSelector(
14-
[simpleSelectors.enterpriseDashboard],
15-
(data) => data !== null && data.isLearnerPortalEnabled === true,
16-
);
13+
1714
export const showSelectSessionModal = createSelector(
1815
[simpleSelectors.selectSessionModal],
1916
(data) => data.cardId != null,
@@ -22,6 +19,5 @@ export const showSelectSessionModal = createSelector(
2219
export default StrictDict({
2320
numCourses,
2421
hasCourses,
25-
hasAvailableDashboards,
2622
showSelectSessionModal,
2723
});

src/data/redux/app/selectors/appSelectors.test.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ describe('basic app selectors', () => {
1717
expect(cb(0)).toEqual(false);
1818
});
1919
});
20-
describe('hasAvailableDashboards', () => {
21-
it('returns true iff the enterpriseDashboard field is populated and learner portal is enabled', () => {
22-
const { preSelectors, cb } = appSelectors.hasAvailableDashboards;
23-
expect(preSelectors).toEqual([simpleSelectors.enterpriseDashboard]);
24-
expect(cb({ isLearnerPortalEnabled: true })).toEqual(true);
25-
expect(cb({ isLearnerPortalEnabled: false })).toEqual(false);
26-
expect(cb(null)).toEqual(false);
27-
});
28-
});
2920
describe('showSelectSessionModal', () => {
3021
it('returns true if the selectSessionModal cardId is not null', () => {
3122
const { preSelectors, cb } = appSelectors.showSelectSessionModal;

src/data/redux/app/selectors/simpleSelectors.test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ describe('app simple selectors', () => {
3636
expect(preSelectors).toEqual([appSelector]);
3737
expect(cb(testState.app)).toEqual(testString);
3838
});
39-
test('enterpriseDashboard returns empty object if data returns null', () => {
40-
testState = { app: { enterpriseDashboard: null } };
41-
const { preSelectors, cb } = simpleSelectors.enterpriseDashboard;
42-
expect(preSelectors).toEqual([appSelector]);
43-
expect(cb(testState.app)).toEqual({});
44-
});
4539
describe('cardSimpleSelectors', () => {
4640
keys = keyStore(cardSimpleSelectors);
4741
test.each([

src/plugin-slots/DashboardModalSlot/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Course Card Action Slot
1+
# Dashboard Modal Slot
22

33
### Slot ID: `dashboard_modal_slot`
44

55
## Description
66

7-
This slot is used for the modal on a dashboard that appears on initial load.
7+
This slot is used for the modal on a dashboard.
88
The following `env.config.jsx` will render the modal.
99

1010
## Example
1111

12-
Learner dashboard will show modal on initial load
13-
![Screenshot of the dashboard modal](./images/widget_sidebar_slot.png)
12+
Learner dashboard will show modal
13+
![Screenshot of the dashboard modal](./images/dashboard_modal_slot.png)
1414

1515
```js
1616
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
@@ -27,7 +27,7 @@ const config = {
2727
type: DIRECT_PLUGIN,
2828
priority: 60,
2929
RenderWidget:
30-
<ModalDialog title="Modal that appears on initial render of learner dashboard" />,
30+
<ModalDialog title="Modal that appears on learner dashboard" />,
3131
},
3232
},
3333
],
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import { PluginSlot } from '@openedx/frontend-plugin-framework';
33

4-
const DashboardModal = () => (
4+
const DashboardModalSlot = () => (
55
<PluginSlot id="dashboard_modal_slot" />
66
);
77

8-
export default DashboardModal;
8+
export default DashboardModalSlot;

0 commit comments

Comments
 (0)