vendredi 20 février 2015

ember-cli extend assert with custom assertion helpers

In the latest ember-cli, in the unit tests the test function expect as last parameter a function which would have the assert object as first parameter.


I was wondering how can I extend this object to add my own custom assertion helpers?


For example I want to add a controlDisabled helper that would return true if the control is disabled, and false otherwise. So somewhere (but not in each test files) I want to extend that assert object given as paramter like so:



assert.controlDisabled = function(selector, message) {
return this.ok(findWithAssert(selector).attr('disabled'), message);
};


Where should I define this?


Aucun commentaire:

Enregistrer un commentaire