`;
-
- global.scrollTo = jest.fn();
-
- const application = Application.start();
- application.register('config', ConfigController);
- });
-
- describe('#activateEmailAuthModal', () => {
- it('builds and adds a Modal to the page', () => {
- const button = document.getElementsByTagName('button')[0];
- const modalAnchor = document.querySelector(
- '[data-config-target="configModalAnchor"]',
- );
-
- button.click();
-
- expect(
- modalAnchor.firstElementChild.classList.contains('crayons-modal'),
- ).toBe(true);
- });
- });
-});
diff --git a/app/javascript/admin/adminModal.js b/app/javascript/admin/adminModal.js
index 87110f097..2da395d42 100644
--- a/app/javascript/admin/adminModal.js
+++ b/app/javascript/admin/adminModal.js
@@ -1,16 +1,17 @@
+import { closeWindowModal, showWindowModal } from '@utilities/showModal';
+
/**
* A function to generate the HTML for a Crayons modal within the /admin/ space.
*
* @function adminModal
* @param {Object} modalProps Properties of the Modal
* @param {string} modalProps.title The title of the modal.
- * @param {string} modalProps.controllerName The name of the controller activating the modal.
- * @param {string} modalProps.closeModalFunction The name of the function that closes the modal.
+ * @param {function} modalProps.closeModalFunction The name of the function that closes the modal.
* @param {string} modalProps.body The modal's content. May use HTML tags for styling.
* @param {string} modalProps.leftBtnText The text for the modal's left button.
- * @param {string} modalProps.leftBtnAction The function that fires when left button is clicked.
+ * @param {function} modalProps.leftBtnAction The function that fires when left button is clicked.
* @param {string} modalProps.rightBtnText The text for the modal's right button.
- * @param {string} modalProps.rightBtnAction The function that fires when right button is clicked.
+ * @param {function} modalProps.rightBtnAction The function that fires when right button is clicked.
* @param {string} modalProps.leftBtnClasses Classes applied to left button.
* @param {string} modalProps.rightBtnClasses Classes applied to right button.
* @param {string} modalProps.leftCustomDataAttr A custom data attribute for the left button.
@@ -18,7 +19,6 @@
*/
export const adminModal = function ({
title,
- controllerName,
closeModalFunction,
body,
leftBtnText,
@@ -30,36 +30,51 @@ export const adminModal = function ({
leftCustomDataAttr = null,
rightCustomDataAttr = null,
}) {
- return `
-