From 524116a60148dee17dc1f8393d0ac86a189b0186 Mon Sep 17 00:00:00 2001 From: Leangseu Kim Date: Thu, 5 Jan 2023 10:20:54 -0500 Subject: [PATCH] fix: grade modal always showing --- .../EditModal/__snapshots__/test.jsx.snap | 30 ++----------------- src/components/GradesView/EditModal/index.jsx | 15 ++++------ src/components/GradesView/EditModal/test.jsx | 2 ++ 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/components/GradesView/EditModal/__snapshots__/test.jsx.snap b/src/components/GradesView/EditModal/__snapshots__/test.jsx.snap index 7da46b02..7ba9de08 100644 --- a/src/components/GradesView/EditModal/__snapshots__/test.jsx.snap +++ b/src/components/GradesView/EditModal/__snapshots__/test.jsx.snap @@ -10,21 +10,9 @@ exports[`EditModal Component snapshots gradeOverrideHistoryError is and empty an isOpen={true} onClose={[MockFunction this.closeAssignmentModal]} size="xl" + title="Edit Grades" variant="default" > - - - - - @@ -133,24 +121,12 @@ exports[`EditModal Component snapshots gradeOverrideHistoryError is empty and op isBlocking={false} isFullscreenOnMobile={true} isFullscreenScroll={false} - isOpen={true} + isOpen={false} onClose={[MockFunction this.closeAssignmentModal]} size="xl" + title="Edit Grades" variant="default" > - - - - - diff --git a/src/components/GradesView/EditModal/index.jsx b/src/components/GradesView/EditModal/index.jsx index 3ac26023..d093be89 100644 --- a/src/components/GradesView/EditModal/index.jsx +++ b/src/components/GradesView/EditModal/index.jsx @@ -9,7 +9,7 @@ import { ModalDialog, ActionRow, } from '@edx/paragon'; -import { FormattedMessage } from '@edx/frontend-platform/i18n'; +import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import selectors from 'data/selectors'; import actions from 'data/actions'; @@ -47,19 +47,14 @@ export class EditModal extends React.Component { render() { return ( - - - - - -
@@ -101,6 +96,8 @@ EditModal.propTypes = { closeModal: PropTypes.func.isRequired, doneViewingAssignment: PropTypes.func.isRequired, updateGrades: PropTypes.func.isRequired, + // injected + intl: intlShape.isRequired, }; export const mapStateToProps = (state) => ({ @@ -114,4 +111,4 @@ export const mapDispatchToProps = { updateGrades: thunkActions.grades.updateGrades, }; -export default connect(mapStateToProps, mapDispatchToProps)(EditModal); +export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(EditModal)); diff --git a/src/components/GradesView/EditModal/test.jsx b/src/components/GradesView/EditModal/test.jsx index e1578692..c0f6cbf6 100644 --- a/src/components/GradesView/EditModal/test.jsx +++ b/src/components/GradesView/EditModal/test.jsx @@ -49,6 +49,8 @@ describe('EditModal', () => { closeModal: jest.fn(), doneViewingAssignment: jest.fn(), updateGrades: jest.fn(), + + intl: { formatMessage: (msg) => msg.defaultMessage }, }; });