Sha256: 8f2ba3a5828a52e1b2227e2e6cae08c52aba07ec21cb4b13b11d94dc33aee3f0

Contents?: true

Size: 1.78 KB

Versions: 8

Compression:

Stored size: 1.78 KB

Contents

/**
 * Internal representation of a Jasmine suite.
 *
 * @constructor
 * @param {jasmine.Env} env
 * @param {String} description
 * @param {Function} specDefinitions
 * @param {jasmine.Suite} parentSuite
 */
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
  var self = this;
  self.id = env.nextSuiteId ? env.nextSuiteId() : null;
  self.description = description;
  self.queue = new jasmine.Queue(env);
  self.parentSuite = parentSuite;
  self.env = env;
  self.before_ = [];
  self.after_ = [];
  self.specs_ = [];
};

jasmine.Suite.prototype.getFullName = function() {
  var fullName = this.description;
  for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
    fullName = parentSuite.description + ' ' + fullName;
  }
  return fullName;
};

jasmine.Suite.prototype.finish = function(onComplete) {
  this.env.reporter.reportSuiteResults(this);
  this.finished = true;
  if (typeof(onComplete) == 'function') {
    onComplete();
  }
};

jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
  beforeEachFunction.typeName = 'beforeEach';
  this.before_.push(beforeEachFunction);
};

jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
  afterEachFunction.typeName = 'afterEach';
  this.after_.push(afterEachFunction);
};

jasmine.Suite.prototype.results = function() {
  return this.queue.results();
};

jasmine.Suite.prototype.add = function(block) {
  if (block instanceof jasmine.Suite) {
    this.env.currentRunner().addSuite(block);
  } else {
    this.specs_.push(block);
  }
  this.queue.add(block);
};

jasmine.Suite.prototype.specs = function() {
  return this.specs_;
};

jasmine.Suite.prototype.execute = function(onComplete) {
  var self = this;
  this.queue.start(function () {
    self.finish(onComplete);
  });
};

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
jasnode-0.4.3.0 jasmine/src/Suite.js
jasnode-0.4.2.0 jasmine/src/Suite.js
jasnode-0.4.1.0 jasmine/src/Suite.js
jasnode-0.4.0.0 jasmine/src/Suite.js
jasnode-0.2.0.0 jasmine/src/Suite.js
jazz-0.1.1 vendor/jasmine/src/Suite.js
jazrb-0.1.1 vendor/jasmine/src/Suite.js
jazrb-0.1.0 vendor/jasmine/src/Suite.js