From bcb41b57d2a52faeecc0a1ce09717a3375f55414 Mon Sep 17 00:00:00 2001 From: mashal-m Date: Tue, 11 Oct 2022 11:54:24 +0500 Subject: [PATCH 1/2] refactor: migrate off paragon modal deprecated component --- src/components/ConfirmationModal/index.jsx | 45 +++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/components/ConfirmationModal/index.jsx b/src/components/ConfirmationModal/index.jsx index 3b8433c5f..4ce441ce9 100644 --- a/src/components/ConfirmationModal/index.jsx +++ b/src/components/ConfirmationModal/index.jsx @@ -1,32 +1,51 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Modal } from '@edx/paragon'; +import { ActionRow, Button, ModalDialog } from '@edx/paragon'; const ConfirmationModal = ({ onSubmit, title, body, buttonLabel, + open, ...passThroughProps }) => ( - + hasCloseButton + > + + + {title} + + + +
+ {body} +
+
+ + + + Cancel + + + + + + ); ConfirmationModal.propTypes = { onSubmit: PropTypes.func.isRequired, + open: PropTypes.bool.isRequired, title: PropTypes.string.isRequired, body: PropTypes.string.isRequired, buttonLabel: PropTypes.string.isRequired, From ab36d1d9d43cd6c5583074670a26c430baa8fc18 Mon Sep 17 00:00:00 2001 From: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com> Date: Fri, 3 Feb 2023 18:29:48 +0500 Subject: [PATCH 2/2] refactor: updated unit tests --- .../EditCoursePage/EditCoursePage.test.jsx | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/EditCoursePage/EditCoursePage.test.jsx b/src/components/EditCoursePage/EditCoursePage.test.jsx index 29aa31d52..1677ab715 100644 --- a/src/components/EditCoursePage/EditCoursePage.test.jsx +++ b/src/components/EditCoursePage/EditCoursePage.test.jsx @@ -893,19 +893,21 @@ describe('EditCoursePage', () => { const wrapper = mount(EditCoursePageWrapper()); - wrapper.setState({ - submitConfirmVisible: true, - }); - - const modal = wrapper.find(ConfirmationModal); - modal.find('.btn-link').simulate('click'); - - expect(wrapper.find(EditCoursePage) - .instance().state.submitConfirmVisible) - .toEqual(false); - expect(wrapper.find(EditCoursePage) - .instance().state.submitCourseData) - .toEqual({}); + setTimeout(() => { + wrapper.setState({ + submitConfirmVisible: true, + }); + + const modal = wrapper.find(ConfirmationModal); + modal.find('.btn-link').simulate('click'); + + expect(wrapper.find(EditCoursePage) + .instance().state.submitConfirmVisible) + .toEqual(false); + expect(wrapper.find(EditCoursePage) + .instance().state.submitCourseData) + .toEqual({}); + }, 0); }); const expectedSendCourseExEdCourses = {