diff --git a/src/editors/containers/EditorContainer/components/EditorFooter/__snapshots__/index.test.jsx.snap b/src/editors/containers/EditorContainer/components/EditorFooter/__snapshots__/index.test.jsx.snap index 9fa3931b4..e6c47e92d 100644 --- a/src/editors/containers/EditorContainer/components/EditorFooter/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/EditorContainer/components/EditorFooter/__snapshots__/index.test.jsx.snap @@ -36,6 +36,42 @@ exports[`EditorFooter render snapshot: default args (disableSave: false, saveFai `; +exports[`EditorFooter render snapshot: dont show feedback link 1`] = ` +
+ + + + + + + +
+`; + exports[`EditorFooter render snapshot: save disabled. Show button spinner 1`] = `
`; + +exports[`EditorFooter render snapshot: show feedback link 1`] = ` +
+ + + + Share Feedback + + + + + + +
+`; diff --git a/src/editors/containers/EditorContainer/components/EditorFooter/index.jsx b/src/editors/containers/EditorContainer/components/EditorFooter/index.jsx index f7109901c..a5bb1f48d 100644 --- a/src/editors/containers/EditorContainer/components/EditorFooter/index.jsx +++ b/src/editors/containers/EditorContainer/components/EditorFooter/index.jsx @@ -7,8 +7,12 @@ import { Button, ModalDialog, Toast, + Hyperlink, } from '@edx/paragon'; import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { useSelector } from 'react-redux'; +import { selectors } from '../../../../data/redux'; +import { blockTypes } from '../../../../data/constants/app'; import { nullMethod } from '../../hooks'; import messages from './messages'; @@ -20,37 +24,50 @@ export const EditorFooter = ({ saveFailed, // injected intl, -}) => ( -
- {saveFailed && ( +}) => { + const blockType = useSelector(selectors.app.blockType); + + return ( +
+ {saveFailed && ( - )} + )} - - - - - - - -
-); + + + { + // TODO: Remove this code when the problem Editor Beta is complete. + blockType === blockTypes.problem + && ( + + Share Feedback + + ) + } + + + + + +
+ ); +}; EditorFooter.propTypes = { disableSave: PropTypes.bool.isRequired, onCancel: PropTypes.func.isRequired, diff --git a/src/editors/containers/EditorContainer/components/EditorFooter/index.test.jsx b/src/editors/containers/EditorContainer/components/EditorFooter/index.test.jsx index a45f6bcc1..9aac7b638 100644 --- a/src/editors/containers/EditorContainer/components/EditorFooter/index.test.jsx +++ b/src/editors/containers/EditorContainer/components/EditorFooter/index.test.jsx @@ -1,6 +1,7 @@ import React from 'react'; import { shallow } from 'enzyme'; +import { useSelector } from 'react-redux'; import { formatMessage } from '../../../../../testUtils'; import { EditorFooter } from '.'; @@ -8,6 +9,10 @@ jest.mock('../../hooks', () => ({ nullMethod: jest.fn().mockName('hooks.nullMethod'), })); +jest.mock('react-redux', () => ({ + useSelector: jest.fn(), +})); + describe('EditorFooter', () => { const props = { intl: { formatMessage }, @@ -26,5 +31,14 @@ describe('EditorFooter', () => { test('snapshot: save failed. Show error message', () => { expect(shallow()).toMatchSnapshot(); }); + + test('snapshot: show feedback link', () => { + useSelector.mockReturnValueOnce('problem'); + expect(shallow()).toMatchSnapshot(); + }); + test('snapshot: dont show feedback link', () => { + useSelector.mockReturnValueOnce('not a Problem'); + expect(shallow()).toMatchSnapshot(); + }); }); });