MDL-59845 tool_lp: Add js tracking around UI refresh

This commit is contained in:
Andrew Nicols
2018-05-02 09:18:21 +08:00
parent 1e65154616
commit 0153ce4fad
2 changed files with 10 additions and 2 deletions
File diff suppressed because one or more lines are too long
+9 -1
View File
@@ -129,6 +129,11 @@ define(['jquery',
* @return {Promise}
*/
PlanActions.prototype._callAndRefresh = function(calls, planData) {
// Because this function causes a refresh, we must track the JS completion from start to finish to prevent
// stale reference issues in Behat.
var callKey = 'tool_lp/planactions:_callAndRefresh-' + Math.floor(Math.random() * Math.floor(1000));
M.util.js_pending(callKey);
var self = this;
calls.push({
@@ -141,7 +146,10 @@ define(['jquery',
.then(function() {
self._renderView(arguments[arguments.length - 1]);
})
.fail(notification.exception);
.fail(notification.exception)
.always(function() {
return M.util.js_complete(callKey);
});
};
/**