From e7bfbaf7b2d49d3f9dc2ceb7873cac73fce286fe Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 17 Dec 2019 10:44:32 +0800 Subject: [PATCH] MDL-70151 assign: Fix bulk change for behat Behat does not play well with confirmation dialogues and in some situations it does not wait for the page to reload before starting the next step. This change adds a pending_js call which is only resolved if the cancel button was pressed, otherwise it remains in-progress until the page reloads resetting the entire state of it. --- mod/assign/module.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/assign/module.js b/mod/assign/module.js index 111003ba61d..9b7ad6b3c7e 100644 --- a/mod/assign/module.js +++ b/mod/assign/module.js @@ -76,6 +76,7 @@ M.mod_assign.init_grading_table = function(Y) { var batchform = Y.one('form.gradingbatchoperationsform'); if (batchform) { batchform.on('submit', function(e) { + M.util.js_pending('mod_assign/module.js:batch:submit'); checkboxes = Y.all('td.c0 input'); var selectedusers = []; checkboxes.each(function(node) { @@ -102,8 +103,10 @@ M.mod_assign.init_grading_table = function(Y) { confirmmessage = M.util.get_string('batchoperationconfirm' + operation.get('value'), 'assign'); } if (!confirm(confirmmessage)) { + M.util.js_complete('mod_assign/module.js:batch:submit'); e.preventDefault(); } + // Note: Do not js_complete. The page being reloaded will empty it. } }); } -- 2.11.4.GIT