Skip to content

Commit

Permalink
fix: grade modal always showing
Browse files Browse the repository at this point in the history
  • Loading branch information
leangseu-edx committed Jan 5, 2023
1 parent db5414e commit 524116a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
30 changes: 3 additions & 27 deletions src/components/GradesView/EditModal/__snapshots__/test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<ModalDialogHeader
as="div"
>
<ModalDialogTitle
as="h2"
>
<FormattedMessage
defaultMessage="Edit Grades"
description="Edit Modal title"
id="gradebook.GradesView.EditModal.title"
/>
</ModalDialogTitle>
</ModalDialogHeader>
<ModalDialogBody
as="div"
>
Expand Down Expand Up @@ -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"
>
<ModalDialogHeader
as="div"
>
<ModalDialogTitle
as="h2"
>
<FormattedMessage
defaultMessage="Edit Grades"
description="Edit Modal title"
id="gradebook.GradesView.EditModal.title"
/>
</ModalDialogTitle>
</ModalDialogHeader>
<ModalDialogBody
as="div"
>
Expand Down
15 changes: 6 additions & 9 deletions src/components/GradesView/EditModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -47,19 +47,14 @@ export class EditModal extends React.Component {

render() {
return (

<ModalDialog
isOpen
title={this.props.intl.formatMessage(messages.title)}
isOpen={this.props.open}
onClose={this.closeAssignmentModal}
size="xl"
hasCloseButton
isFullscreenOnMobile
>
<ModalDialog.Header>
<ModalDialog.Title>
<FormattedMessage {...messages.title} />
</ModalDialog.Title>
</ModalDialog.Header>
<ModalDialog.Body>
<div>
<ModalHeaders />
Expand Down Expand Up @@ -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) => ({
Expand All @@ -114,4 +111,4 @@ export const mapDispatchToProps = {
updateGrades: thunkActions.grades.updateGrades,
};

export default connect(mapStateToProps, mapDispatchToProps)(EditModal);
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(EditModal));
2 changes: 2 additions & 0 deletions src/components/GradesView/EditModal/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ describe('EditModal', () => {
closeModal: jest.fn(),
doneViewingAssignment: jest.fn(),
updateGrades: jest.fn(),

intl: { formatMessage: (msg) => msg.defaultMessage },
};
});

Expand Down

0 comments on commit 524116a

Please sign in to comment.