diff --git a/lib/form/form.js b/lib/form/form.js index 43e209c394a..ef65209a2be 100644 --- a/lib/form/form.js +++ b/lib/form/form.js @@ -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); } };