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();