MDL-59845 tool_lp: Add js tracking around UI refresh

This commit is contained in:
Andrew Nicols
2018-05-02 09:16:14 +08:00
parent 533e41f82e
commit 2964d00f94
2 changed files with 10 additions and 2 deletions
File diff suppressed because one or more lines are too long
+9 -1
View File
@@ -130,6 +130,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({
methodname: self._contextMethod,
@@ -141,7 +146,10 @@ define(['jquery',
.then(function() {
return self._renderView(arguments[arguments.length - 1]);
})
.fail(notification.exception);
.fail(notification.exception)
.always(function() {
return M.util.js_complete(callKey);
});
};
/**