MDL-56210 behat: Ensure behat waits for dependancy manager

This commit is contained in:
Rajesh Taneja
2016-09-30 10:19:09 +08:00
parent ddd8dc0d1b
commit eed52d64bb
+12
View File
@@ -23,6 +23,9 @@ if (typeof M.form.dependencyManager === 'undefined') {
this._hides = {};
this._dirty = {};
// Let behat know that JS is pending.
M.util.js_pending('mform-dependency-manager-' + this.get('form').get('id'));
// Setup event handlers.
Y.Object.each(this.get('dependencies'), function(value, i) {
var elements = this.elementsByName(i);
@@ -56,6 +59,9 @@ if (typeof M.form.dependencyManager === 'undefined') {
}, this);
this.updateAllDependencies();
// Let behat know that JS is complete.
M.util.js_complete('mform-dependency-manager-' + this.get('form').get('id'));
},
/**
@@ -588,6 +594,12 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
*/
M.form.updateFormState = function(formid) {
if (formid in M.form.dependencyManagers) {
// Let behat know that JS is pending.
M.util.js_pending('mform-dependency-manager-' + formid);
M.form.dependencyManagers[formid].updateAllDependencies();
// Let behat know that JS is complete.
M.util.js_complete('mform-dependency-manager-' + formid);
}
};