Skip to content

Commit

Permalink
MDL-56210 behat: Ensure behat waits for dependancy manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Sep 30, 2016
1 parent ddd8dc0 commit eed52d6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/form/form.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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'));
},

/**
Expand Down Expand Up @@ -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);
}
};

0 comments on commit eed52d6

Please sign in to comment.