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:
Pierre Goiffon
2023-11-10 15:10:37 +01:00
committed by GitHub
parent 8a3d81c430
commit d725ba3d84
3 changed files with 34 additions and 2 deletions

View File

@@ -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
*