mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
22 lines
443 B
JavaScript
22 lines
443 B
JavaScript
|
/**
|
||
|
* Blocks are functions with executable code that make up a spec.
|
||
|
*
|
||
|
* @constructor
|
||
|
* @param {jasmine.Env} env
|
||
|
* @param {Function} func
|
||
|
* @param {jasmine.Spec} spec
|
||
|
*/
|
||
|
jasmine.Block = function(env, func, spec) {
|
||
|
this.env = env;
|
||
|
this.func = func;
|
||
|
this.spec = spec;
|
||
|
};
|
||
|
|
||
|
jasmine.Block.prototype.execute = function(onComplete) {
|
||
|
try {
|
||
|
this.func.apply(this.spec);
|
||
|
} catch (e) {
|
||
|
this.spec.fail(e);
|
||
|
}
|
||
|
onComplete();
|
||
|
};
|