diff --git a/src/editors/sharedComponents/InsertLinkModal/BlockLink/index.jsx b/src/editors/sharedComponents/InsertLinkModal/BlockLink/index.jsx index 5800cd2f8..953d2a8d4 100644 --- a/src/editors/sharedComponents/InsertLinkModal/BlockLink/index.jsx +++ b/src/editors/sharedComponents/InsertLinkModal/BlockLink/index.jsx @@ -29,13 +29,9 @@ const BlockLink = ({ path, onCloseLink }) => { ); }; -BlockLink.defaultProps = { - onCloseLink: () => {}, -}; - BlockLink.propTypes = { path: PropTypes.string.isRequired, - onCloseLink: PropTypes.func, + onCloseLink: PropTypes.func.isRequired, }; export default BlockLink; diff --git a/src/editors/sharedComponents/InsertLinkModal/FilterBlock/index.jsx b/src/editors/sharedComponents/InsertLinkModal/FilterBlock/index.jsx index d4a71a46e..d1eddf3de 100644 --- a/src/editors/sharedComponents/InsertLinkModal/FilterBlock/index.jsx +++ b/src/editors/sharedComponents/InsertLinkModal/FilterBlock/index.jsx @@ -24,10 +24,6 @@ const FilterBlock = ({ block, onBlockFilterClick }) => { ); }; -FilterBlock.defaultProps = { - onBlockFilterClick: () => {}, -}; - const blockShape = PropTypes.shape({ id: PropTypes.string.isRequired, blockId: PropTypes.string.isRequired, @@ -41,7 +37,7 @@ const blockShape = PropTypes.shape({ FilterBlock.propTypes = { block: PropTypes.objectOf(blockShape).isRequired, - onBlockFilterClick: PropTypes.func, + onBlockFilterClick: PropTypes.func.isRequired, }; export default FilterBlock; diff --git a/src/editors/sharedComponents/TinyMceWidget/hooks.test.js b/src/editors/sharedComponents/TinyMceWidget/hooks.test.js index 4b4cfc1e5..d8ba18b8a 100644 --- a/src/editors/sharedComponents/TinyMceWidget/hooks.test.js +++ b/src/editors/sharedComponents/TinyMceWidget/hooks.test.js @@ -75,6 +75,7 @@ describe('TinyMceEditor hooks', () => { state.testGetter(state.keys.isImageModalOpen); state.testGetter(state.keys.isSourceCodeModalOpen); state.testGetter(state.keys.imageSelection); + state.testGetter(state.keys.isInsertLinkModalOpen); }); describe('non-state hooks', () => { @@ -404,6 +405,24 @@ describe('TinyMceEditor hooks', () => { }); }); + describe('insertLinkModalToggle', () => { + const hookKey = state.keys.isInsertLinkModalOpen; + beforeEach(() => { + hook = module.insertLinkModalToggle(); + }); + test('isInsertLinkOpen: state value', () => { + expect(hook.isInsertLinkOpen).toEqual(state.stateVals[hookKey]); + }); + test('openInsertLinkModal: calls setter with true', () => { + hook.openInsertLinkModal(); + expect(state.setState[hookKey]).toHaveBeenCalledWith(true); + }); + test('closeInsertLinkModal: calls setter with false', () => { + hook.closeInsertLinkModal(); + expect(state.setState[hookKey]).toHaveBeenCalledWith(false); + }); + }); + describe('openModalWithSelectedImage', () => { const setImage = jest.fn(); const openImgModal = jest.fn();