Skip to content

Commit b3f9b5b

Browse files
Fix "Subscription Management" bulk action button counts and refactoring (#746)
* fix: updates * fix: remove hardcoded qa path * fix: use ENROLLABLE_STATUSES constant * fix: update EnrollBulkAction * fix: upgrade paragon to latest * fix: add tests for each bulk action and remove unused component * fix: pr feedback
1 parent 21d1b22 commit b3f9b5b

File tree

27 files changed

+1405
-1967
lines changed

27 files changed

+1405
-1967
lines changed

package-lock.json

Lines changed: 46 additions & 1088 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@edx/frontend-enterprise-logistration": "1.1.2",
2727
"@edx/frontend-enterprise-utils": "1.3.0",
2828
"@edx/frontend-platform": "1.11.0",
29-
"@edx/paragon": "19.10.1",
29+
"@edx/paragon": "19.13.6",
3030
"@fortawesome/fontawesome-svg-core": "1.2.35",
3131
"@fortawesome/free-brands-svg-icons": "5.15.3",
3232
"@fortawesome/free-regular-svg-icons": "5.15.3",
@@ -92,7 +92,6 @@
9292
"enzyme-adapter-react-16": "1.15.6",
9393
"husky": "0.14.3",
9494
"identity-obj-proxy": "3.0.0",
95-
"node-sass": "4.14.1",
9695
"postcss": "8.1.0",
9796
"react-dev-utils": "11.0.4",
9897
"react-test-renderer": "16.13.1"

src/components/Admin/__snapshots__/Admin.test.jsx.snap

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,23 +2496,25 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders colla
24962496
disabled={false}
24972497
type="submit"
24982498
>
2499-
<svg
2500-
aria-hidden="true"
2501-
className="svg-inline--fa fa-search fa-w-16 "
2502-
data-icon="search"
2503-
data-prefix="fas"
2504-
focusable="false"
2505-
role="img"
2506-
style={Object {}}
2507-
viewBox="0 0 512 512"
2508-
xmlns="http://www.w3.org/2000/svg"
2499+
<span
2500+
className="pgn__icon"
25092501
>
2510-
<path
2511-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
2512-
fill="currentColor"
2513-
style={Object {}}
2514-
/>
2515-
</svg>
2502+
<svg
2503+
aria-hidden={true}
2504+
fill="none"
2505+
focusable={false}
2506+
height={24}
2507+
role="img"
2508+
viewBox="0 0 24 24"
2509+
width={24}
2510+
xmlns="http://www.w3.org/2000/svg"
2511+
>
2512+
<path
2513+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
2514+
fill="currentColor"
2515+
/>
2516+
</svg>
2517+
</span>
25162518
<span
25172519
className="sr-only"
25182520
>
@@ -3214,23 +3216,25 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders full
32143216
disabled={false}
32153217
type="submit"
32163218
>
3217-
<svg
3218-
aria-hidden="true"
3219-
className="svg-inline--fa fa-search fa-w-16 "
3220-
data-icon="search"
3221-
data-prefix="fas"
3222-
focusable="false"
3223-
role="img"
3224-
style={Object {}}
3225-
viewBox="0 0 512 512"
3226-
xmlns="http://www.w3.org/2000/svg"
3219+
<span
3220+
className="pgn__icon"
32273221
>
3228-
<path
3229-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
3230-
fill="currentColor"
3231-
style={Object {}}
3232-
/>
3233-
</svg>
3222+
<svg
3223+
aria-hidden={true}
3224+
fill="none"
3225+
focusable={false}
3226+
height={24}
3227+
role="img"
3228+
viewBox="0 0 24 24"
3229+
width={24}
3230+
xmlns="http://www.w3.org/2000/svg"
3231+
>
3232+
<path
3233+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
3234+
fill="currentColor"
3235+
/>
3236+
</svg>
3237+
</span>
32343238
<span
32353239
className="sr-only"
32363240
>

src/components/BulkEnrollmentPage/BulkEnrollmentWarningModal.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ const BulkEnrollWarningModal = ({
1313
}) => (
1414
<AlertModal
1515
title={(
16-
<>
16+
<div className="d-flex align-items-center">
1717
<Icon className="enroll-header mr-1" src={Error} />
1818
Revoked Learners Selected
19-
</>
20-
)}
19+
</div>
20+
)}
2121
isOpen={isDialogOpen}
2222
footerNode={(
2323
<ActionRow>
24-
<Button variant="link" onClick={onClose}>Close</Button>
24+
<Button variant="link" onClick={onClose} data-testid="CLOSE_BTN_IN_WARNING_MODAL">Close</Button>
2525
<BulkEnrollButton
2626
learners={learners}
2727
handleEnrollment={onEnroll}
@@ -31,7 +31,7 @@ const BulkEnrollWarningModal = ({
3131
)}
3232
>
3333
Any learners with revoked licenses are not included. Click &quot;Enroll&quot; to enroll
34-
active and pending learners only
34+
active and pending learners only.
3535
</AlertModal>
3636
);
3737

src/components/BulkEnrollmentPage/stepper/BulkEnrollmentStepper.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const BulkEnrollStepper = ({
6161
Subscription Enrollment
6262
</ModalDialog.Title>
6363
</ModalDialog.Header>
64-
6564
<ModalDialog.Body>
6665
<Stepper.Step eventKey={ADD_COURSES_STEP} title={ADD_COURSES_TITLE}>
6766
<AddCoursesStep
@@ -78,7 +77,6 @@ const BulkEnrollStepper = ({
7877
/>
7978
</Stepper.Step>
8079
</ModalDialog.Body>
81-
8280
<ModalDialog.Footer>
8381
<Stepper.ActionRow eventKey={ADD_COURSES_STEP}>
8482
<Button

src/components/CodeManagement/CouponCodeTabs.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import { SUPPORTED_SUBSIDY_TYPES } from '../../data/constants/subsidyRequests';
2323

2424
const CouponCodeTabs = ({ enterpriseSlug }) => {
2525
const { subsidyRequestConfiguration } = useContext(SubsidyRequestConfigurationContext);
26-
const { subsidyType } = subsidyRequestConfiguration;
27-
const isRequestsTabShown = subsidyType === SUPPORTED_SUBSIDY_TYPES.coupon;
26+
const isSubsidyRequestsEnabled = subsidyRequestConfiguration?.subsidyRequestsEnabled;
27+
const subsidyType = subsidyRequestConfiguration?.subsidyType;
28+
const isRequestsTabShown = isSubsidyRequestsEnabled && subsidyType === SUPPORTED_SUBSIDY_TYPES.coupon;
2829

2930
const history = useHistory();
3031
const params = useParams();

src/components/CodeManagement/tests/CouponCodeTabs.test.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const CouponCodeTabsWrapper = ({ subsidyRequestConfiguration }) => (
5959

6060
CouponCodeTabsWrapper.defaultProps = {
6161
subsidyRequestConfiguration: {
62+
subsidyRequestsEnabled: true,
6263
subsidyType: 'coupon',
6364
},
6465
};
@@ -106,4 +107,18 @@ describe('<CouponCodeTabs />', () => {
106107
screen.getByText(COUPON_CODE_TABS_LABELS[MANAGE_CODES_TAB]);
107108
expect(screen.queryByText(COUPON_CODE_TABS_LABELS[MANAGE_REQUESTS_TAB])).toBeFalsy();
108109
});
110+
111+
it('When subsidy requests are not enabled, hide "Manage Requests" tab', async () => {
112+
renderWithRouter(
113+
<CouponCodeTabsWrapper
114+
subsidyRequestConfiguration={{
115+
subsidyRequestsEnabled: false,
116+
subsidyType: 'coupon',
117+
}}
118+
/>,
119+
{ route: INITIAL_ROUTER_ENTRY },
120+
);
121+
screen.getByText(COUPON_CODE_TABS_LABELS[MANAGE_CODES_TAB]);
122+
expect(screen.queryByText(COUPON_CODE_TABS_LABELS[MANAGE_REQUESTS_TAB])).toBeFalsy();
123+
});
109124
});

src/components/CodeManagement/tests/__snapshots__/ManageCodesTab.test.jsx.snap

Lines changed: 72 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,25 @@ Array [
5353
disabled={false}
5454
type="submit"
5555
>
56-
<svg
57-
aria-hidden="true"
58-
className="svg-inline--fa fa-search fa-w-16 "
59-
data-icon="search"
60-
data-prefix="fas"
61-
focusable="false"
62-
role="img"
63-
style={Object {}}
64-
viewBox="0 0 512 512"
65-
xmlns="http://www.w3.org/2000/svg"
56+
<span
57+
className="pgn__icon"
6658
>
67-
<path
68-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
69-
fill="currentColor"
70-
style={Object {}}
71-
/>
72-
</svg>
59+
<svg
60+
aria-hidden={true}
61+
fill="none"
62+
focusable={false}
63+
height={24}
64+
role="img"
65+
viewBox="0 0 24 24"
66+
width={24}
67+
xmlns="http://www.w3.org/2000/svg"
68+
>
69+
<path
70+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
71+
fill="currentColor"
72+
/>
73+
</svg>
74+
</span>
7375
<span
7476
className="sr-only"
7577
>
@@ -226,23 +228,25 @@ Array [
226228
disabled={false}
227229
type="submit"
228230
>
229-
<svg
230-
aria-hidden="true"
231-
className="svg-inline--fa fa-search fa-w-16 "
232-
data-icon="search"
233-
data-prefix="fas"
234-
focusable="false"
235-
role="img"
236-
style={Object {}}
237-
viewBox="0 0 512 512"
238-
xmlns="http://www.w3.org/2000/svg"
231+
<span
232+
className="pgn__icon"
239233
>
240-
<path
241-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
242-
fill="currentColor"
243-
style={Object {}}
244-
/>
245-
</svg>
234+
<svg
235+
aria-hidden={true}
236+
fill="none"
237+
focusable={false}
238+
height={24}
239+
role="img"
240+
viewBox="0 0 24 24"
241+
width={24}
242+
xmlns="http://www.w3.org/2000/svg"
243+
>
244+
<path
245+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
246+
fill="currentColor"
247+
/>
248+
</svg>
249+
</span>
246250
<span
247251
className="sr-only"
248252
>
@@ -404,23 +408,25 @@ Array [
404408
disabled={false}
405409
type="submit"
406410
>
407-
<svg
408-
aria-hidden="true"
409-
className="svg-inline--fa fa-search fa-w-16 "
410-
data-icon="search"
411-
data-prefix="fas"
412-
focusable="false"
413-
role="img"
414-
style={Object {}}
415-
viewBox="0 0 512 512"
416-
xmlns="http://www.w3.org/2000/svg"
411+
<span
412+
className="pgn__icon"
417413
>
418-
<path
419-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
420-
fill="currentColor"
421-
style={Object {}}
422-
/>
423-
</svg>
414+
<svg
415+
aria-hidden={true}
416+
fill="none"
417+
focusable={false}
418+
height={24}
419+
role="img"
420+
viewBox="0 0 24 24"
421+
width={24}
422+
xmlns="http://www.w3.org/2000/svg"
423+
>
424+
<path
425+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
426+
fill="currentColor"
427+
/>
428+
</svg>
429+
</span>
424430
<span
425431
className="sr-only"
426432
>
@@ -550,23 +556,25 @@ Array [
550556
disabled={false}
551557
type="submit"
552558
>
553-
<svg
554-
aria-hidden="true"
555-
className="svg-inline--fa fa-search fa-w-16 "
556-
data-icon="search"
557-
data-prefix="fas"
558-
focusable="false"
559-
role="img"
560-
style={Object {}}
561-
viewBox="0 0 512 512"
562-
xmlns="http://www.w3.org/2000/svg"
559+
<span
560+
className="pgn__icon"
563561
>
564-
<path
565-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
566-
fill="currentColor"
567-
style={Object {}}
568-
/>
569-
</svg>
562+
<svg
563+
aria-hidden={true}
564+
fill="none"
565+
focusable={false}
566+
height={24}
567+
role="img"
568+
viewBox="0 0 24 24"
569+
width={24}
570+
xmlns="http://www.w3.org/2000/svg"
571+
>
572+
<path
573+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
574+
fill="currentColor"
575+
/>
576+
</svg>
577+
</span>
570578
<span
571579
className="sr-only"
572580
>

src/components/SearchBar/__snapshots__/SearchBar.test.jsx.snap

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,25 @@ exports[`<SearchBar /> renders correctly 1`] = `
3737
disabled={false}
3838
type="submit"
3939
>
40-
<svg
41-
aria-hidden="true"
42-
className="svg-inline--fa fa-search fa-w-16 "
43-
data-icon="search"
44-
data-prefix="fas"
45-
focusable="false"
46-
role="img"
47-
style={Object {}}
48-
viewBox="0 0 512 512"
49-
xmlns="http://www.w3.org/2000/svg"
40+
<span
41+
className="pgn__icon"
5042
>
51-
<path
52-
d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
53-
fill="currentColor"
54-
style={Object {}}
55-
/>
56-
</svg>
43+
<svg
44+
aria-hidden={true}
45+
fill="none"
46+
focusable={false}
47+
height={24}
48+
role="img"
49+
viewBox="0 0 24 24"
50+
width={24}
51+
xmlns="http://www.w3.org/2000/svg"
52+
>
53+
<path
54+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
55+
fill="currentColor"
56+
/>
57+
</svg>
58+
</span>
5759
<span
5860
className="sr-only"
5961
>

0 commit comments

Comments
 (0)