Blame view

framework/thirdparty/jasmine/src/Block.js 443 Bytes
70f4f18b   Administrator   first_commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /**
   * 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();
  };