From aff4223ea19885c1189835bfa4f9f4ebf055838b Mon Sep 17 00:00:00 2001 From: Matt Davidson Date: Fri, 20 Oct 2023 15:52:05 -0400 Subject: [PATCH] fix behat tests and grunt fix --- amd/build/massactionblock.min.js | 2 +- amd/build/massactionblock.min.js.map | 2 +- amd/src/massactionblock.js | 10 ++++++++-- styles.css | 4 ---- tests/behat/actions.feature | 1 - tests/behat/core.feature | 2 -- tests/behat/grid.feature | 1 - tests/behat/onetopic.feature | 5 ----- tests/behat/tiles.feature | 1 - tests/behat/topcoll.feature | 2 -- 10 files changed, 10 insertions(+), 20 deletions(-) diff --git a/amd/build/massactionblock.min.js b/amd/build/massactionblock.min.js index 1bdce24..7199161 100644 --- a/amd/build/massactionblock.min.js +++ b/amd/build/massactionblock.min.js @@ -6,6 +6,6 @@ define("block_massaction/massactionblock",["exports","block_massaction/checkboxm * @copyright 2022 ISB Bayern * @author Philipp Memmel * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.usedMoodleCssClasses=_exports.init=_exports.cssIds=_exports.constants=void 0,checkboxmanager=_interopRequireWildcard(checkboxmanager),Str=_interopRequireWildcard(Str),_log=_interopRequireDefault(_log),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);_exports.usedMoodleCssClasses={ACTIVITY_ITEM:".activity-item",SECTION_NAME:"sectionname",MODULE_ID_PREFIX:"module-",BOX_ID_PREFIX:"cmCheckbox"};const cssIds={BLOCK_CONTENT:"block-massaction",SELECT_ALL_LINK:"block-massaction-control-selectall",DESELECT_ALL_LINK:"block-massaction-control-deselectall",HIDE_LINK:"block-massaction-action-hide",SHOW_LINK:"block-massaction-action-show",MAKE_AVAILABLE_LINK:"block-massaction-action-makeavailable",DUPLICATE_LINK:"block-massaction-action-duplicate",DELETE_LINK:"block-massaction-action-delete",SHOW_DESCRIPTION_LINK:"block-massaction-action-showdescription",HIDE_DESCRIPTION_LINK:"block-massaction-action-hidedescription",CONTENT_CHANGED_NOTIFICATION_LINK:"block-massaction-action-contentchangednotification",MOVELEFT_LINK:"block-massaction-action-moveleft",MOVERIGHT_LINK:"block-massaction-action-moveright",MOVETO_ICON_LINK:"block-massaction-action-moveto",DUPLICATETO_ICON_LINK:"block-massaction-action-duplicateto",DUPLICATE_TO_COURSE_ICON_LINK:"block-massaction-action-duplicatetocourse",SECTION_SELECT:"block-massaction-control-section-list-select",MOVETO_SELECT:"block-massaction-control-section-list-moveto",DUPLICATETO_SELECT:"block-massaction-control-section-list-duplicateto",HIDDEN_FIELD_REQUEST_INFORMATION:"block-massaction-control-request",ACTION_FORM:"block-massaction-control-form"};_exports.cssIds=cssIds;const constants={SECTION_SELECT_DESCRIPTION_VALUE:"description",SECTION_NUMBER_ALL_PLACEHOLDER:"all"};_exports.constants=constants;const actions_HIDE="hide",actions_SHOW="show",actions_MAKE_AVAILABLE="makeavailable",actions_DUPLICATE="duplicate",actions_DELETE="delete",actions_SHOW_DESCRIPTION="showdescription",actions_HIDE_DESCRIPTION="hidedescription",actions_MOVE_LEFT="moveleft",actions_MOVE_RIGHT="moveright",actions_CONTENT_CHANGED_NOTIFICATION="contentchangednotification",actions_MOVE_TO="moveto",actions_DUPLICATE_TO="duplicateto",actions_DUPLICATE_TO_COURSE="duplicatetocourse";_exports.init=async()=>{var _document$getElementB,_document$getElementB2,_document$getElementB3,_document$getElementB4,_document$getElementB5,_document$getElementB6,_document$getElementB7,_document$getElementB8,_document$getElementB9,_document$getElementB10,_document$getElementB11,_document$getElementB12,_document$getElementB13,_document$getElementB14,_document$getElementB15;const pendingPromise=new _pending.default("block_massaction/init"),editor=(0,_courseeditor.getCurrentCourseEditor)();editor.stateManager.getInitialPromise().then((()=>{let elem;for(elem of(checkboxmanager.initCheckboxManager(),editor.dispatch("bulkEnable",!0),(0,_stickyFooter.disableStickyFooter)(),document.getElementsByClassName("bulk-hidden")))elem.classList.remove("bulk-hidden");return!0})).catch((error=>_log.default.debug(error))),null===(_document$getElementB=document.getElementById(cssIds.SELECT_ALL_LINK))||void 0===_document$getElementB||_document$getElementB.addEventListener("click",(()=>checkboxmanager.setSectionSelection(!0,constants.SECTION_NUMBER_ALL_PLACEHOLDER)),!1),null===(_document$getElementB2=document.getElementById(cssIds.DESELECT_ALL_LINK))||void 0===_document$getElementB2||_document$getElementB2.addEventListener("click",(()=>checkboxmanager.setSectionSelection(!1,constants.SECTION_NUMBER_ALL_PLACEHOLDER)),!1),null===(_document$getElementB3=document.getElementById(cssIds.HIDE_LINK))||void 0===_document$getElementB3||_document$getElementB3.addEventListener("click",(()=>submitAction(actions_HIDE)),!1),null===(_document$getElementB4=document.getElementById(cssIds.SHOW_LINK))||void 0===_document$getElementB4||_document$getElementB4.addEventListener("click",(()=>submitAction(actions_SHOW)),!1),null===(_document$getElementB5=document.getElementById(cssIds.MAKE_AVAILABLE_LINK))||void 0===_document$getElementB5||_document$getElementB5.addEventListener("click",(()=>submitAction(actions_MAKE_AVAILABLE)),!1),null===(_document$getElementB6=document.getElementById(cssIds.DUPLICATE_LINK))||void 0===_document$getElementB6||_document$getElementB6.addEventListener("click",(()=>submitAction(actions_DUPLICATE)),!1),null===(_document$getElementB7=document.getElementById(cssIds.DELETE_LINK))||void 0===_document$getElementB7||_document$getElementB7.addEventListener("click",(()=>submitAction(actions_DELETE)),!1),null===(_document$getElementB8=document.getElementById(cssIds.SHOW_DESCRIPTION_LINK))||void 0===_document$getElementB8||_document$getElementB8.addEventListener("click",(()=>submitAction(actions_SHOW_DESCRIPTION)),!1),null===(_document$getElementB9=document.getElementById(cssIds.HIDE_DESCRIPTION_LINK))||void 0===_document$getElementB9||_document$getElementB9.addEventListener("click",(()=>submitAction(actions_HIDE_DESCRIPTION)),!1),null===(_document$getElementB10=document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK))||void 0===_document$getElementB10||_document$getElementB10.addEventListener("click",(()=>submitAction(actions_CONTENT_CHANGED_NOTIFICATION)),!1),null===(_document$getElementB11=document.getElementById(cssIds.MOVELEFT_LINK))||void 0===_document$getElementB11||_document$getElementB11.addEventListener("click",(()=>submitAction(actions_MOVE_LEFT)),!1),null===(_document$getElementB12=document.getElementById(cssIds.MOVERIGHT_LINK))||void 0===_document$getElementB12||_document$getElementB12.addEventListener("click",(()=>submitAction(actions_MOVE_RIGHT)),!1),null===(_document$getElementB13=document.getElementById(cssIds.MOVETO_ICON_LINK))||void 0===_document$getElementB13||_document$getElementB13.addEventListener("click",(()=>submitAction(actions_MOVE_TO)),!1),null===(_document$getElementB14=document.getElementById(cssIds.DUPLICATETO_ICON_LINK))||void 0===_document$getElementB14||_document$getElementB14.addEventListener("click",(()=>submitAction(actions_DUPLICATE_TO)),!1),null===(_document$getElementB15=document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK))||void 0===_document$getElementB15||_document$getElementB15.addEventListener("click",(()=>submitAction(actions_DUPLICATE_TO_COURSE)),!1),pendingPromise.resolve()};const submitAction=action=>{const submitData={action:action,moduleIds:[]};if(submitData.moduleIds=checkboxmanager.getSelectedModIds(),0===submitData.moduleIds.length)return displayError(Str.get_string("noitemselected","block_massaction")),!1;switch(action){case actions_HIDE:case actions_SHOW:case actions_MAKE_AVAILABLE:case actions_DUPLICATE:case actions_DUPLICATE_TO_COURSE:case actions_CONTENT_CHANGED_NOTIFICATION:case actions_MOVE_LEFT:case actions_MOVE_RIGHT:case actions_DELETE:case actions_SHOW_DESCRIPTION:case actions_HIDE_DESCRIPTION:break;case actions_MOVE_TO:if(submitData.moveToTarget=document.getElementById(cssIds.MOVETO_SELECT).value,""===submitData.moveToTarget.trim())return displayError(Str.get_string("nomovingtargetselected","block_massaction")),!1;break;case actions_DUPLICATE_TO:if(submitData.duplicateToTarget=document.getElementById(cssIds.DUPLICATETO_SELECT).value,""===submitData.duplicateToTarget.trim())return displayError(Str.get_string("nomovingtargetselected","block_massaction")),!1;break;default:return displayError("Unknown action: "+action+". Coding error."),!1}return document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value=JSON.stringify(submitData),document.getElementById(cssIds.ACTION_FORM).submit(),!0},displayError=errorText=>{Promise.resolve([Str.get_string("error","core"),errorText,Str.get_string("back","core")]).then((text=>_notification.default.alert(text[0],text[1],text[2]))).catch((error=>_log.default.debug(error)))}})); + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.usedMoodleCssClasses=_exports.init=_exports.cssIds=_exports.constants=void 0,checkboxmanager=_interopRequireWildcard(checkboxmanager),Str=_interopRequireWildcard(Str),_log=_interopRequireDefault(_log),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);_exports.usedMoodleCssClasses={ACTIVITY_ITEM:".activity-item",SECTION_NAME:"sectionname",MODULE_ID_PREFIX:"module-",BOX_ID_PREFIX:"cmCheckbox"};const cssIds={BLOCK_CONTENT:"block-massaction",SELECT_ALL_LINK:"block-massaction-control-selectall",DESELECT_ALL_LINK:"block-massaction-control-deselectall",HIDE_LINK:"block-massaction-action-hide",SHOW_LINK:"block-massaction-action-show",MAKE_AVAILABLE_LINK:"block-massaction-action-makeavailable",DUPLICATE_LINK:"block-massaction-action-duplicate",DELETE_LINK:"block-massaction-action-delete",SHOW_DESCRIPTION_LINK:"block-massaction-action-showdescription",HIDE_DESCRIPTION_LINK:"block-massaction-action-hidedescription",CONTENT_CHANGED_NOTIFICATION_LINK:"block-massaction-action-contentchangednotification",MOVELEFT_LINK:"block-massaction-action-moveleft",MOVERIGHT_LINK:"block-massaction-action-moveright",MOVETO_ICON_LINK:"block-massaction-action-moveto",DUPLICATETO_ICON_LINK:"block-massaction-action-duplicateto",DUPLICATE_TO_COURSE_ICON_LINK:"block-massaction-action-duplicatetocourse",SECTION_SELECT:"block-massaction-control-section-list-select",MOVETO_SELECT:"block-massaction-control-section-list-moveto",DUPLICATETO_SELECT:"block-massaction-control-section-list-duplicateto",HIDDEN_FIELD_REQUEST_INFORMATION:"block-massaction-control-request",ACTION_FORM:"block-massaction-control-form"};_exports.cssIds=cssIds;const constants={SECTION_SELECT_DESCRIPTION_VALUE:"description",SECTION_NUMBER_ALL_PLACEHOLDER:"all"};_exports.constants=constants;const actions_HIDE="hide",actions_SHOW="show",actions_MAKE_AVAILABLE="makeavailable",actions_DUPLICATE="duplicate",actions_DELETE="delete",actions_SHOW_DESCRIPTION="showdescription",actions_HIDE_DESCRIPTION="hidedescription",actions_MOVE_LEFT="moveleft",actions_MOVE_RIGHT="moveright",actions_CONTENT_CHANGED_NOTIFICATION="contentchangednotification",actions_MOVE_TO="moveto",actions_DUPLICATE_TO="duplicateto",actions_DUPLICATE_TO_COURSE="duplicatetocourse";_exports.init=async()=>{var _document$getElementB,_document$getElementB2,_document$getElementB3,_document$getElementB4,_document$getElementB5,_document$getElementB6,_document$getElementB7,_document$getElementB8,_document$getElementB9,_document$getElementB10,_document$getElementB11,_document$getElementB12,_document$getElementB13,_document$getElementB14,_document$getElementB15;const pendingPromise=new _pending.default("block_massaction/init"),editor=(0,_courseeditor.getCurrentCourseEditor)();editor.stateManager.getInitialPromise().then((()=>(checkboxmanager.initCheckboxManager(),editor.dispatch("bulkEnable",!0),(0,_stickyFooter.disableStickyFooter)(),!0))).then((()=>{let elem;for(elem of document.getElementsByClassName("bulk-hidden"))elem.classList.remove("bulk-hidden");for(elem of document.querySelectorAll("[data-inplaceeditablelink]"))elem.classList.remove("d-none")})).catch((error=>_log.default.debug(error))),null===(_document$getElementB=document.getElementById(cssIds.SELECT_ALL_LINK))||void 0===_document$getElementB||_document$getElementB.addEventListener("click",(()=>checkboxmanager.setSectionSelection(!0,constants.SECTION_NUMBER_ALL_PLACEHOLDER)),!1),null===(_document$getElementB2=document.getElementById(cssIds.DESELECT_ALL_LINK))||void 0===_document$getElementB2||_document$getElementB2.addEventListener("click",(()=>checkboxmanager.setSectionSelection(!1,constants.SECTION_NUMBER_ALL_PLACEHOLDER)),!1),null===(_document$getElementB3=document.getElementById(cssIds.HIDE_LINK))||void 0===_document$getElementB3||_document$getElementB3.addEventListener("click",(()=>submitAction(actions_HIDE)),!1),null===(_document$getElementB4=document.getElementById(cssIds.SHOW_LINK))||void 0===_document$getElementB4||_document$getElementB4.addEventListener("click",(()=>submitAction(actions_SHOW)),!1),null===(_document$getElementB5=document.getElementById(cssIds.MAKE_AVAILABLE_LINK))||void 0===_document$getElementB5||_document$getElementB5.addEventListener("click",(()=>submitAction(actions_MAKE_AVAILABLE)),!1),null===(_document$getElementB6=document.getElementById(cssIds.DUPLICATE_LINK))||void 0===_document$getElementB6||_document$getElementB6.addEventListener("click",(()=>submitAction(actions_DUPLICATE)),!1),null===(_document$getElementB7=document.getElementById(cssIds.DELETE_LINK))||void 0===_document$getElementB7||_document$getElementB7.addEventListener("click",(()=>submitAction(actions_DELETE)),!1),null===(_document$getElementB8=document.getElementById(cssIds.SHOW_DESCRIPTION_LINK))||void 0===_document$getElementB8||_document$getElementB8.addEventListener("click",(()=>submitAction(actions_SHOW_DESCRIPTION)),!1),null===(_document$getElementB9=document.getElementById(cssIds.HIDE_DESCRIPTION_LINK))||void 0===_document$getElementB9||_document$getElementB9.addEventListener("click",(()=>submitAction(actions_HIDE_DESCRIPTION)),!1),null===(_document$getElementB10=document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK))||void 0===_document$getElementB10||_document$getElementB10.addEventListener("click",(()=>submitAction(actions_CONTENT_CHANGED_NOTIFICATION)),!1),null===(_document$getElementB11=document.getElementById(cssIds.MOVELEFT_LINK))||void 0===_document$getElementB11||_document$getElementB11.addEventListener("click",(()=>submitAction(actions_MOVE_LEFT)),!1),null===(_document$getElementB12=document.getElementById(cssIds.MOVERIGHT_LINK))||void 0===_document$getElementB12||_document$getElementB12.addEventListener("click",(()=>submitAction(actions_MOVE_RIGHT)),!1),null===(_document$getElementB13=document.getElementById(cssIds.MOVETO_ICON_LINK))||void 0===_document$getElementB13||_document$getElementB13.addEventListener("click",(()=>submitAction(actions_MOVE_TO)),!1),null===(_document$getElementB14=document.getElementById(cssIds.DUPLICATETO_ICON_LINK))||void 0===_document$getElementB14||_document$getElementB14.addEventListener("click",(()=>submitAction(actions_DUPLICATE_TO)),!1),null===(_document$getElementB15=document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK))||void 0===_document$getElementB15||_document$getElementB15.addEventListener("click",(()=>submitAction(actions_DUPLICATE_TO_COURSE)),!1),pendingPromise.resolve()};const submitAction=action=>{const submitData={action:action,moduleIds:[]};if(submitData.moduleIds=checkboxmanager.getSelectedModIds(),0===submitData.moduleIds.length)return displayError(Str.get_string("noitemselected","block_massaction")),!1;switch(action){case actions_HIDE:case actions_SHOW:case actions_MAKE_AVAILABLE:case actions_DUPLICATE:case actions_DUPLICATE_TO_COURSE:case actions_CONTENT_CHANGED_NOTIFICATION:case actions_MOVE_LEFT:case actions_MOVE_RIGHT:case actions_DELETE:case actions_SHOW_DESCRIPTION:case actions_HIDE_DESCRIPTION:break;case actions_MOVE_TO:if(submitData.moveToTarget=document.getElementById(cssIds.MOVETO_SELECT).value,""===submitData.moveToTarget.trim())return displayError(Str.get_string("nomovingtargetselected","block_massaction")),!1;break;case actions_DUPLICATE_TO:if(submitData.duplicateToTarget=document.getElementById(cssIds.DUPLICATETO_SELECT).value,""===submitData.duplicateToTarget.trim())return displayError(Str.get_string("nomovingtargetselected","block_massaction")),!1;break;default:return displayError("Unknown action: "+action+". Coding error."),!1}return document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value=JSON.stringify(submitData),document.getElementById(cssIds.ACTION_FORM).submit(),!0},displayError=errorText=>{Promise.resolve([Str.get_string("error","core"),errorText,Str.get_string("back","core")]).then((text=>_notification.default.alert(text[0],text[1],text[2]))).catch((error=>_log.default.debug(error)))}})); //# sourceMappingURL=massactionblock.min.js.map \ No newline at end of file diff --git a/amd/build/massactionblock.min.js.map b/amd/build/massactionblock.min.js.map index 8087ce8..1c84bfe 100644 --- a/amd/build/massactionblock.min.js.map +++ b/amd/build/massactionblock.min.js.map @@ -1 +1 @@ -{"version":3,"file":"massactionblock.min.js","sources":["../src/massactionblock.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Main module for the massaction block.\n *\n * @module block_massaction/massactionblock\n * @copyright 2022 ISB Bayern\n * @author Philipp Memmel\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as checkboxmanager from 'block_massaction/checkboxmanager';\nimport * as Str from 'core/str';\nimport Log from 'core/log';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {getCurrentCourseEditor} from 'core_courseformat/courseeditor';\nimport {disableStickyFooter} from 'core/sticky-footer';\n\nexport const usedMoodleCssClasses = {\n ACTIVITY_ITEM: '.activity-item',\n SECTION_NAME: 'sectionname',\n MODULE_ID_PREFIX: 'module-',\n BOX_ID_PREFIX: 'cmCheckbox'\n};\n\nexport const cssIds = {\n BLOCK_CONTENT: 'block-massaction',\n SELECT_ALL_LINK: 'block-massaction-control-selectall',\n DESELECT_ALL_LINK: 'block-massaction-control-deselectall',\n HIDE_LINK: 'block-massaction-action-hide',\n SHOW_LINK: 'block-massaction-action-show',\n MAKE_AVAILABLE_LINK: 'block-massaction-action-makeavailable',\n DUPLICATE_LINK: 'block-massaction-action-duplicate',\n DELETE_LINK: 'block-massaction-action-delete',\n SHOW_DESCRIPTION_LINK: 'block-massaction-action-showdescription',\n HIDE_DESCRIPTION_LINK: 'block-massaction-action-hidedescription',\n CONTENT_CHANGED_NOTIFICATION_LINK: 'block-massaction-action-contentchangednotification',\n MOVELEFT_LINK: 'block-massaction-action-moveleft',\n MOVERIGHT_LINK: 'block-massaction-action-moveright',\n MOVETO_ICON_LINK: 'block-massaction-action-moveto',\n DUPLICATETO_ICON_LINK: 'block-massaction-action-duplicateto',\n DUPLICATE_TO_COURSE_ICON_LINK: 'block-massaction-action-duplicatetocourse',\n SECTION_SELECT: 'block-massaction-control-section-list-select',\n MOVETO_SELECT: 'block-massaction-control-section-list-moveto',\n DUPLICATETO_SELECT: 'block-massaction-control-section-list-duplicateto',\n HIDDEN_FIELD_REQUEST_INFORMATION: 'block-massaction-control-request',\n ACTION_FORM: 'block-massaction-control-form',\n};\n\nexport const constants = {\n SECTION_SELECT_DESCRIPTION_VALUE: 'description',\n SECTION_NUMBER_ALL_PLACEHOLDER: 'all',\n};\n\nconst actions = {\n HIDE: 'hide',\n SHOW: 'show',\n MAKE_AVAILABLE: 'makeavailable',\n DUPLICATE: 'duplicate',\n DELETE: 'delete',\n SHOW_DESCRIPTION: 'showdescription',\n HIDE_DESCRIPTION: 'hidedescription',\n MOVE_LEFT: 'moveleft',\n MOVE_RIGHT: 'moveright',\n CONTENT_CHANGED_NOTIFICATION: 'contentchangednotification',\n MOVE_TO: 'moveto',\n DUPLICATE_TO: 'duplicateto',\n DUPLICATE_TO_COURSE: 'duplicatetocourse',\n};\n\n/**\n * Initialize the mass-action block.\n */\nexport const init = async() => {\n const pendingPromise = new Pending('block_massaction/init');\n\n const editor = getCurrentCourseEditor();\n // As soon as courseeditor is available, do some initial setup.\n editor.stateManager.getInitialPromise()\n .then(() => {\n // Initialize the checkbox manager.\n checkboxmanager.initCheckboxManager();\n\n // Enable bulk editing state.\n editor.dispatch('bulkEnable', true);\n\n // Remove sticky footer.\n disableStickyFooter();\n\n // Show course module menu by removing the class that hides them.\n let elem;\n for (elem of document.getElementsByClassName(\"bulk-hidden\")) {\n elem.classList.remove(\"bulk-hidden\");\n }\n return true;\n })\n .catch(error => Log.debug(error));\n\n document.getElementById(cssIds.SELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(true, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.DESELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(false, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.HIDE_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE), false);\n\n document.getElementById(cssIds.SHOW_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW), false);\n\n document.getElementById(cssIds.MAKE_AVAILABLE_LINK)?.addEventListener('click',\n () => submitAction(actions.MAKE_AVAILABLE), false);\n\n document.getElementById(cssIds.DUPLICATE_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE), false);\n\n document.getElementById(cssIds.DELETE_LINK)?.addEventListener('click',\n () => submitAction(actions.DELETE), false);\n\n document.getElementById(cssIds.SHOW_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW_DESCRIPTION), false);\n\n document.getElementById(cssIds.HIDE_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE_DESCRIPTION), false);\n\n document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK)?.addEventListener('click',\n () => submitAction(actions.CONTENT_CHANGED_NOTIFICATION), false);\n\n document.getElementById(cssIds.MOVELEFT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_LEFT), false);\n\n document.getElementById(cssIds.MOVERIGHT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_RIGHT), false);\n\n document.getElementById(cssIds.MOVETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_TO), false);\n\n document.getElementById(cssIds.DUPLICATETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO), false);\n\n document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO_COURSE), false);\n\n pendingPromise.resolve();\n};\n\n/**\n * Submit the selected action to server.\n *\n * @param {string} action\n * @return {boolean} true if action was successful, false otherwise\n */\nconst submitAction = (action) => {\n const submitData = {\n 'action': action,\n 'moduleIds': []\n };\n\n submitData.moduleIds = checkboxmanager.getSelectedModIds();\n\n // Verify that at least one checkbox is checked.\n if (submitData.moduleIds.length === 0) {\n displayError(Str.get_string('noitemselected', 'block_massaction'));\n return false;\n }\n\n // Prep the submission.\n switch (action) {\n case actions.HIDE:\n case actions.SHOW:\n case actions.MAKE_AVAILABLE:\n case actions.DUPLICATE:\n case actions.DUPLICATE_TO_COURSE:\n case actions.CONTENT_CHANGED_NOTIFICATION:\n case actions.MOVE_LEFT:\n case actions.MOVE_RIGHT:\n case actions.DELETE:\n case actions.SHOW_DESCRIPTION:\n case actions.HIDE_DESCRIPTION:\n break;\n\n case actions.MOVE_TO:\n // Get the target section.\n submitData.moveToTarget = document.getElementById(cssIds.MOVETO_SELECT).value;\n if (submitData.moveToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n\n case actions.DUPLICATE_TO:\n // Get the target section.\n submitData.duplicateToTarget = document.getElementById(cssIds.DUPLICATETO_SELECT).value;\n if (submitData.duplicateToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n default:\n displayError('Unknown action: ' + action + '. Coding error.');\n return false;\n }\n // Set the form value and submit.\n document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value = JSON.stringify(submitData);\n document.getElementById(cssIds.ACTION_FORM).submit();\n return true;\n};\n\nconst displayError = (errorText) => {\n Promise.resolve([Str.get_string('error', 'core'), errorText, Str.get_string('back', 'core')])\n .then(text => Notification.alert(text[0], text[1], text[2]))\n .catch(error => Log.debug(error));\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","checkboxmanager","Str","_log","_notification","_pending","_exports","usedMoodleCssClasses","ACTIVITY_ITEM","SECTION_NAME","MODULE_ID_PREFIX","BOX_ID_PREFIX","cssIds","BLOCK_CONTENT","SELECT_ALL_LINK","DESELECT_ALL_LINK","HIDE_LINK","SHOW_LINK","MAKE_AVAILABLE_LINK","DUPLICATE_LINK","DELETE_LINK","SHOW_DESCRIPTION_LINK","HIDE_DESCRIPTION_LINK","CONTENT_CHANGED_NOTIFICATION_LINK","MOVELEFT_LINK","MOVERIGHT_LINK","MOVETO_ICON_LINK","DUPLICATETO_ICON_LINK","DUPLICATE_TO_COURSE_ICON_LINK","SECTION_SELECT","MOVETO_SELECT","DUPLICATETO_SELECT","HIDDEN_FIELD_REQUEST_INFORMATION","ACTION_FORM","constants","SECTION_SELECT_DESCRIPTION_VALUE","SECTION_NUMBER_ALL_PLACEHOLDER","actions","init","async","_document$getElementB","_document$getElementB2","_document$getElementB3","_document$getElementB4","_document$getElementB5","_document$getElementB6","_document$getElementB7","_document$getElementB8","_document$getElementB9","_document$getElementB10","_document$getElementB11","_document$getElementB12","_document$getElementB13","_document$getElementB14","_document$getElementB15","pendingPromise","Pending","editor","getCurrentCourseEditor","stateManager","getInitialPromise","then","elem","initCheckboxManager","dispatch","disableStickyFooter","document","getElementsByClassName","classList","remove","catch","error","Log","debug","getElementById","addEventListener","setSectionSelection","submitAction","resolve","action","submitData","moduleIds","getSelectedModIds","length","displayError","get_string","moveToTarget","value","trim","duplicateToTarget","JSON","stringify","submit","errorText","Promise","text","Notification","alert"],"mappings":"wSA4BmC,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,aAAA,SAAAI,wBAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBA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A,aACL,KAAKA,uBACL,KAAKA,kBACL,KAAKA,4BACL,KAAKA,qCACL,KAAKA,kBACL,KAAKA,mBACL,KAAKA,eACL,KAAKA,yBACL,KAAKA,yBACD,MAEJ,KAAKA,gBAGD,GADA2C,WAAWM,aAAepB,SAASQ,eAAe9D,OAAOkB,eAAeyD,MACjC,KAAnCP,WAAWM,aAAaE,OAExB,OADAJ,aAAalF,IAAImF,WAAW,yBAA0B,sBAC/C,EAEX,MAEJ,KAAKhD,qBAGD,GADA2C,WAAWS,kBAAoBvB,SAASQ,eAAe9D,OAAOmB,oBAAoBwD,MACtC,KAAxCP,WAAWS,kBAAkBD,OAE7B,OADAJ,aAAalF,IAAImF,WAAW,yBAA0B,sBAC/C,EAEX,MACJ,QAEI,OADAD,aAAa,mBAAqBL,OAAS,oBACpC,EAKf,OAFAb,SAASQ,eAAe9D,OAAOoB,kCAAkCuD,MAAQG,KAAKC,UAAUX,YACxFd,SAASQ,eAAe9D,OAAOqB,aAAa2D,UACrC,CAAI,EAGTR,aAAgBS,YAClBC,QAAQhB,QAAQ,CAAC5E,IAAImF,WAAW,QAAS,QAASQ,UAAW3F,IAAImF,WAAW,OAAQ,UAC/ExB,MAAKkC,MAAQC,sBAAaC,MAAMF,KAAK,GAAIA,KAAK,GAAIA,KAAK,MACvDzB,OAAMC,OAASC,aAAIC,MAAMF,QAAO,CACvC"} \ No newline at end of file +{"version":3,"file":"massactionblock.min.js","sources":["../src/massactionblock.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Main module for the massaction block.\n *\n * @module block_massaction/massactionblock\n * @copyright 2022 ISB Bayern\n * @author Philipp Memmel\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as checkboxmanager from 'block_massaction/checkboxmanager';\nimport * as Str from 'core/str';\nimport Log from 'core/log';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {getCurrentCourseEditor} from 'core_courseformat/courseeditor';\nimport {disableStickyFooter} from 'core/sticky-footer';\n\nexport const usedMoodleCssClasses = {\n ACTIVITY_ITEM: '.activity-item',\n SECTION_NAME: 'sectionname',\n MODULE_ID_PREFIX: 'module-',\n BOX_ID_PREFIX: 'cmCheckbox'\n};\n\nexport const cssIds = {\n BLOCK_CONTENT: 'block-massaction',\n SELECT_ALL_LINK: 'block-massaction-control-selectall',\n DESELECT_ALL_LINK: 'block-massaction-control-deselectall',\n HIDE_LINK: 'block-massaction-action-hide',\n SHOW_LINK: 'block-massaction-action-show',\n MAKE_AVAILABLE_LINK: 'block-massaction-action-makeavailable',\n DUPLICATE_LINK: 'block-massaction-action-duplicate',\n DELETE_LINK: 'block-massaction-action-delete',\n SHOW_DESCRIPTION_LINK: 'block-massaction-action-showdescription',\n HIDE_DESCRIPTION_LINK: 'block-massaction-action-hidedescription',\n CONTENT_CHANGED_NOTIFICATION_LINK: 'block-massaction-action-contentchangednotification',\n MOVELEFT_LINK: 'block-massaction-action-moveleft',\n MOVERIGHT_LINK: 'block-massaction-action-moveright',\n MOVETO_ICON_LINK: 'block-massaction-action-moveto',\n DUPLICATETO_ICON_LINK: 'block-massaction-action-duplicateto',\n DUPLICATE_TO_COURSE_ICON_LINK: 'block-massaction-action-duplicatetocourse',\n SECTION_SELECT: 'block-massaction-control-section-list-select',\n MOVETO_SELECT: 'block-massaction-control-section-list-moveto',\n DUPLICATETO_SELECT: 'block-massaction-control-section-list-duplicateto',\n HIDDEN_FIELD_REQUEST_INFORMATION: 'block-massaction-control-request',\n ACTION_FORM: 'block-massaction-control-form',\n};\n\nexport const constants = {\n SECTION_SELECT_DESCRIPTION_VALUE: 'description',\n SECTION_NUMBER_ALL_PLACEHOLDER: 'all',\n};\n\nconst actions = {\n HIDE: 'hide',\n SHOW: 'show',\n MAKE_AVAILABLE: 'makeavailable',\n DUPLICATE: 'duplicate',\n DELETE: 'delete',\n SHOW_DESCRIPTION: 'showdescription',\n HIDE_DESCRIPTION: 'hidedescription',\n MOVE_LEFT: 'moveleft',\n MOVE_RIGHT: 'moveright',\n CONTENT_CHANGED_NOTIFICATION: 'contentchangednotification',\n MOVE_TO: 'moveto',\n DUPLICATE_TO: 'duplicateto',\n DUPLICATE_TO_COURSE: 'duplicatetocourse',\n};\n\n/**\n * Initialize the mass-action block.\n */\nexport const init = async() => {\n const pendingPromise = new Pending('block_massaction/init');\n\n const editor = getCurrentCourseEditor();\n // As soon as courseeditor is available, do some initial setup.\n editor.stateManager.getInitialPromise()\n .then(() => {\n // Initialize the checkbox manager.\n checkboxmanager.initCheckboxManager();\n\n // Enable bulk editing state.\n editor.dispatch('bulkEnable', true);\n\n // Remove sticky footer.\n disableStickyFooter();\n\n return true;\n })\n .then(() => {\n // Show module tools by removing the classes that hides them.\n let elem;\n for (elem of document.getElementsByClassName(\"bulk-hidden\")) {\n elem.classList.remove(\"bulk-hidden\");\n }\n\n for (elem of document.querySelectorAll('[data-inplaceeditablelink]')) {\n elem.classList.remove(\"d-none\");\n }\n })\n .catch(error => Log.debug(error));\n\n document.getElementById(cssIds.SELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(true, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.DESELECT_ALL_LINK)?.addEventListener('click',\n () => checkboxmanager.setSectionSelection(false, constants.SECTION_NUMBER_ALL_PLACEHOLDER), false);\n\n document.getElementById(cssIds.HIDE_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE), false);\n\n document.getElementById(cssIds.SHOW_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW), false);\n\n document.getElementById(cssIds.MAKE_AVAILABLE_LINK)?.addEventListener('click',\n () => submitAction(actions.MAKE_AVAILABLE), false);\n\n document.getElementById(cssIds.DUPLICATE_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE), false);\n\n document.getElementById(cssIds.DELETE_LINK)?.addEventListener('click',\n () => submitAction(actions.DELETE), false);\n\n document.getElementById(cssIds.SHOW_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.SHOW_DESCRIPTION), false);\n\n document.getElementById(cssIds.HIDE_DESCRIPTION_LINK)?.addEventListener('click',\n () => submitAction(actions.HIDE_DESCRIPTION), false);\n\n document.getElementById(cssIds.CONTENT_CHANGED_NOTIFICATION_LINK)?.addEventListener('click',\n () => submitAction(actions.CONTENT_CHANGED_NOTIFICATION), false);\n\n document.getElementById(cssIds.MOVELEFT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_LEFT), false);\n\n document.getElementById(cssIds.MOVERIGHT_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_RIGHT), false);\n\n document.getElementById(cssIds.MOVETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.MOVE_TO), false);\n\n document.getElementById(cssIds.DUPLICATETO_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO), false);\n\n document.getElementById(cssIds.DUPLICATE_TO_COURSE_ICON_LINK)?.addEventListener('click',\n () => submitAction(actions.DUPLICATE_TO_COURSE), false);\n\n pendingPromise.resolve();\n};\n\n/**\n * Submit the selected action to server.\n *\n * @param {string} action\n * @return {boolean} true if action was successful, false otherwise\n */\nconst submitAction = (action) => {\n const submitData = {\n 'action': action,\n 'moduleIds': []\n };\n\n submitData.moduleIds = checkboxmanager.getSelectedModIds();\n\n // Verify that at least one checkbox is checked.\n if (submitData.moduleIds.length === 0) {\n displayError(Str.get_string('noitemselected', 'block_massaction'));\n return false;\n }\n\n // Prep the submission.\n switch (action) {\n case actions.HIDE:\n case actions.SHOW:\n case actions.MAKE_AVAILABLE:\n case actions.DUPLICATE:\n case actions.DUPLICATE_TO_COURSE:\n case actions.CONTENT_CHANGED_NOTIFICATION:\n case actions.MOVE_LEFT:\n case actions.MOVE_RIGHT:\n case actions.DELETE:\n case actions.SHOW_DESCRIPTION:\n case actions.HIDE_DESCRIPTION:\n break;\n\n case actions.MOVE_TO:\n // Get the target section.\n submitData.moveToTarget = document.getElementById(cssIds.MOVETO_SELECT).value;\n if (submitData.moveToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n\n case actions.DUPLICATE_TO:\n // Get the target section.\n submitData.duplicateToTarget = document.getElementById(cssIds.DUPLICATETO_SELECT).value;\n if (submitData.duplicateToTarget.trim() === '') {\n displayError(Str.get_string('nomovingtargetselected', 'block_massaction'));\n return false;\n }\n break;\n default:\n displayError('Unknown action: ' + action + '. Coding error.');\n return false;\n }\n // Set the form value and submit.\n document.getElementById(cssIds.HIDDEN_FIELD_REQUEST_INFORMATION).value = JSON.stringify(submitData);\n document.getElementById(cssIds.ACTION_FORM).submit();\n return true;\n};\n\nconst displayError = (errorText) => {\n Promise.resolve([Str.get_string('error', 'core'), errorText, Str.get_string('back', 'core')])\n .then(text => Notification.alert(text[0], text[1], text[2]))\n .catch(error => Log.debug(error));\n};\n"],"names":["_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","checkboxmanager","Str","_log","_notification","_pending","_exports","usedMoodleCssClasses","ACTIVITY_ITEM","SECTION_NAME","MODULE_ID_PREFIX","BOX_ID_PREFIX","cssIds","BLOCK_CONTENT","SELECT_ALL_LINK","DESELECT_ALL_LINK","HIDE_LINK","SHOW_LINK","MAKE_AVAILABLE_LINK","DUPLICATE_LINK","DELETE_LINK","SHOW_DESCRIPTION_LINK","HIDE_DESCRIPTION_LINK","CONTENT_CHANGED_NOTIFICATION_LINK","MOVELEFT_LINK","MOVERIGHT_LINK","MOVETO_ICON_LINK","DUPLICATETO_ICON_LINK","DUPLICATE_TO_COURSE_ICON_LINK","SECTION_SELECT","MOVETO_SELECT","DUPLICATETO_SELECT","HIDDEN_FIELD_REQUEST_INFORMATION","ACTION_FORM","constants","SECTION_SELECT_DESCRIPTION_VALUE","SECTION_NUMBER_ALL_PLACEHOLDER","actions","init","async","_document$getElementB","_document$getElementB2","_document$getElementB3","_document$getElementB4","_document$getElementB5","_document$getElementB6","_document$getElementB7","_document$getElementB8","_document$getElementB9","_document$getElementB10","_document$getElementB11","_document$getElementB12","_document$getElementB13","_document$getElementB14","_document$getElementB15","pendingPromise","Pending","editor","getCurrentCourseEditor","stateManager","getInitialPromise","then","initCheckboxManager","dispatch","disableStickyFooter","elem","document","getElementsByClassName","classList","remove","querySelectorAll","catch","error","Log","debug","getElementById","addEventListener","setSectionSelection","submitAction","resolve","action","submitData","moduleIds","getSelectedModIds","length","displayError","get_string","moveToTarget","value","trim","duplicateToTarget","JSON","stringify","submit","errorText","Promise","text","Notification","alert"],"mappings":"wSA4BmC,SAAAA,uBAAAC,YAAAA,KAAAA,IAAAC,WAAAD,KAAAE,QAAAF,KAAA,SAAAG,yBAAAC,mCAAAC,wBAAAC,sBAAAD,QAAAE,qBAAAF,eAAAF,kCAAAC,oBAAAA,YAAAG,iBAAAD,oBAAAF,aAAA,SAAAI,wBAAAR,IAAAI,iBAAAA,aAAAJ,KAAAA,IAAAC,kBAAAD,cAAAA,sBAAAA,wBAAAA,WAAAE,QAAAF,SAAAS,MAAAN,yBAAAC,gBAAAK,OAAAA,MAAAC,IAAAV,YAAAS,MAAAE,IAAAX,SAAAY,UAAAC,sBAAAC,OAAAC,gBAAAD,OAAAE,iCAAAC,OAAAjB,mBAAAiB,KAAAH,OAAAI,UAAAC,eAAAC,KAAApB,IAAAiB,UAAAI,KAAAR,sB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,aAAaE,OAExB,OADAJ,aAAanF,IAAIoF,WAAW,yBAA0B,sBAC/C,EAEX,MAEJ,KAAKjD,qBAGD,GADA4C,WAAWS,kBAAoBxB,SAASS,eAAe/D,OAAOmB,oBAAoByD,MACtC,KAAxCP,WAAWS,kBAAkBD,OAE7B,OADAJ,aAAanF,IAAIoF,WAAW,yBAA0B,sBAC/C,EAEX,MACJ,QAEI,OADAD,aAAa,mBAAqBL,OAAS,oBACpC,EAKf,OAFAd,SAASS,eAAe/D,OAAOoB,kCAAkCwD,MAAQG,KAAKC,UAAUX,YACxFf,SAASS,eAAe/D,OAAOqB,aAAa4D,UACrC,CAAI,EAGTR,aAAgBS,YAClBC,QAAQhB,QAAQ,CAAC7E,IAAIoF,WAAW,QAAS,QAASQ,UAAW5F,IAAIoF,WAAW,OAAQ,UAC/EzB,MAAKmC,MAAQC,sBAAaC,MAAMF,KAAK,GAAIA,KAAK,GAAIA,KAAK,MACvDzB,OAAMC,OAASC,aAAIC,MAAMF,QAAO,CACvC"} \ No newline at end of file diff --git a/amd/src/massactionblock.js b/amd/src/massactionblock.js index 525777e..a6ad5ef 100644 --- a/amd/src/massactionblock.js +++ b/amd/src/massactionblock.js @@ -101,12 +101,18 @@ export const init = async() => { // Remove sticky footer. disableStickyFooter(); - // Show course module menu by removing the class that hides them. + return true; + }) + .then(() => { + // Show module tools by removing the classes that hides them. let elem; for (elem of document.getElementsByClassName("bulk-hidden")) { elem.classList.remove("bulk-hidden"); } - return true; + + for (elem of document.querySelectorAll('[data-inplaceeditablelink]')) { + elem.classList.remove("d-none"); + } }) .catch(error => Log.debug(error)); diff --git a/styles.css b/styles.css index 770987e..f04f97c 100644 --- a/styles.css +++ b/styles.css @@ -93,7 +93,3 @@ .course-section-header .bulkselect { display: none; } - -a[data-inplaceeditablelink] { - display: initial !important; -} diff --git a/tests/behat/actions.feature b/tests/behat/actions.feature index 883311e..844a0e2 100644 --- a/tests/behat/actions.feature +++ b/tests/behat/actions.feature @@ -25,7 +25,6 @@ Feature: Check if all the different type of actions of the mass actions block wo When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" @javascript Scenario: Check if mass actions 'hide' and 'show' work diff --git a/tests/behat/core.feature b/tests/behat/core.feature index b799506..baaa102 100644 --- a/tests/behat/core.feature +++ b/tests/behat/core.feature @@ -25,7 +25,6 @@ Feature: Check if in format_topics block properly disables the currently not act When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" # Dropdown list is being generated by JS, so we need to wait a bit until this has been loaded. And I wait "3" seconds And I set the field "target_section_selecting_all" to "Topic 1" @@ -70,7 +69,6 @@ Feature: Check if in format_topics block properly disables the currently not act When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" And I click on "Test Activity1" "checkbox" And I click on "Test Activity4" "checkbox" Then the field "Test Activity1" matches value "1" diff --git a/tests/behat/grid.feature b/tests/behat/grid.feature index 92cbbf2..2429c0a 100644 --- a/tests/behat/grid.feature +++ b/tests/behat/grid.feature @@ -23,7 +23,6 @@ Feature: Check if in format_grid block properly disables the currently not activ When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" And I click on "Test Activity1" "checkbox" And I click on "Test Activity4" "checkbox" Then the field "Test Activity1" matches value "1" diff --git a/tests/behat/onetopic.feature b/tests/behat/onetopic.feature index 034fa27..de55e7f 100644 --- a/tests/behat/onetopic.feature +++ b/tests/behat/onetopic.feature @@ -23,7 +23,6 @@ Feature: Check if in format_onetopic block properly disables the currently not a When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" When I click on ".nav-link[title='General']" "css_element" And I click on "Test Activity1" "checkbox" Then the field "Test Activity1" matches value "1" @@ -33,11 +32,9 @@ Feature: Check if in format_onetopic block properly disables the currently not a Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-3" "css_element" should be set Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-4" "css_element" should be set When I click on ".nav-link[title='Topic 4']" "css_element" - And I click on "Bulk edit" "button" And I click on "Test Activity4" "checkbox" Then the field "Test Activity4" matches value "1" When I click on ".nav-link[title='Topic 2']" "css_element" - And I click on "Bulk edit" "button" And I click on "Label text" "checkbox" Then the field "Label text" matches value "1" Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-0" "css_element" should be set @@ -46,7 +43,6 @@ Feature: Check if in format_onetopic block properly disables the currently not a Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-3" "css_element" should be set Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-4" "css_element" should be set When I click on ".nav-link[title='Topic 3']" "css_element" - And I click on "Bulk edit" "button" Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-0" "css_element" should be set Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-1" "css_element" should be set Then the "disabled" attribute of "#block-massaction-control-section-list-select-option-2" "css_element" should be set @@ -76,7 +72,6 @@ Feature: Check if in format_onetopic block properly disables the currently not a And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block And I click on ".nav-link[title='Topic 4']" "css_element" - And I click on "Bulk edit" "button" # Everything is setup now, let's do the real test. And I click on "Test Activity4" "checkbox" And I click on "Test Activity5" "checkbox" diff --git a/tests/behat/tiles.feature b/tests/behat/tiles.feature index 3eebd7a..f9b1ba0 100644 --- a/tests/behat/tiles.feature +++ b/tests/behat/tiles.feature @@ -26,7 +26,6 @@ Feature: Check if in format_tiles block properly disables the currently not acti When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" And I click on "Test Activity1" "checkbox" And I click on "Test Activity4" "checkbox" Then the field "Test Activity1" matches value "1" diff --git a/tests/behat/topcoll.feature b/tests/behat/topcoll.feature index 1c06607..56d6388 100644 --- a/tests/behat/topcoll.feature +++ b/tests/behat/topcoll.feature @@ -23,7 +23,6 @@ Feature: Check if in format_topcoll block properly disables the currently not ac When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" And I click on "Open all" "text" And I click on "Test Activity1" "checkbox" And I click on "Test Activity4" "checkbox" @@ -60,7 +59,6 @@ Feature: Check if in format_topcoll block properly disables the currently not ac When I log in as "teacher1" And I am on "Test course" course homepage with editing mode on And I add the "Mass Actions" block - And I click on "Bulk edit" "button" # Everything is setup now, let's do the real test. And I click on "Open all" "text" And I click on "Test Activity2" "checkbox"