Skip to content

Commit

Permalink
style: Nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Dec 11, 2023
1 parent 4bf6f0f commit fd18b0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/taxonomy/data/apiHooks.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jest.mock('./api', () => ({
deleteTaxonomy: jest.fn(),
}));

/*
* TODO: We can refactor this test: Mock the API response using axiosMock.
* Ref: https://github.com/openedx/frontend-app-course-authoring/pull/684#issuecomment-1847694090
*/
describe('useTaxonomyListDataResponse', () => {
it('should return data when status is success', () => {
useQuery.mockReturnValueOnce({ status: 'success', data: { data: 'data' } });
Expand Down
8 changes: 4 additions & 4 deletions src/taxonomy/delete-dialog/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ const DeleteDialog = ({
const [deleteButtonDisabled, setDeleteButtonDisabled] = useState(true);
const deleteLabel = intl.formatMessage(messages.deleteDialogConfirmDeleteLabel);

const handleInputChange = (event) => {
const handleInputChange = React.useCallback((event) => {
if (event.target.value === deleteLabel) {
setDeleteButtonDisabled(false);
} else {
setDeleteButtonDisabled(true);
}
};
});

const onClickDelete = () => {
const onClickDelete = React.useCallback(() => {
onClose();
onDelete();
};
}, [onClose, onDelete]);

return (
<ModalDialog
Expand Down
4 changes: 2 additions & 2 deletions src/taxonomy/export-modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const ExportModal = ({
const intl = useIntl();
const [outputFormat, setOutputFormat] = useState('csv');

const onClickExport = () => {
const onClickExport = React.useCallback(() => {
onClose();
getTaxonomyExportFile(taxonomyId, outputFormat);
};
}, [onClose, taxonomyId, outputFormat]);

return (
<ModalDialog
Expand Down

0 comments on commit fd18b0f

Please sign in to comment.