mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°6765 Avoid behat scenario loading issues on portal modal (#569)
- New CombodoJsActivity API - Replace existing calls in NiceWebPage (ready scripts) - Add calls in ready block in portal object create template (used in both create and edit)
This commit is contained in:
28
js/utils.js
28
js/utils.js
@@ -994,6 +994,34 @@ const CombodoJSConsole = {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to reflect ongoing JS activity to other processes like BeHat
|
||||
* @api
|
||||
* @since 3.0.4 3.1.1 3.2.0 N°6765
|
||||
*/
|
||||
const CombodoJsActivity = {
|
||||
BODY_DATA_ATTR_NAME_READY: "data-ready-scripts",
|
||||
|
||||
/**
|
||||
* Counter so that we set the flag as done only on the last call
|
||||
* @type number
|
||||
*/
|
||||
iOngoingScriptsCount: 0,
|
||||
|
||||
AddOngoingScript: function() {
|
||||
this.iOngoingScriptsCount++;
|
||||
$("body").attr(this.BODY_DATA_ATTR_NAME_READY, "start");
|
||||
},
|
||||
|
||||
RemoveOngoingScript: function() {
|
||||
this.iOngoingScriptsCount--;
|
||||
|
||||
if (this.iOngoingScriptsCount < 1) {
|
||||
$("body").attr(this.BODY_DATA_ATTR_NAME_READY, "done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to Sanitize string
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user