Sha256: 7fb37522d8cd63199ae0d7737bbc06d15dc07453dd98fa1debfa7a96b73989e8

Contents?: true

Size: 1.71 KB

Versions: 29

Compression:

Stored size: 1.71 KB

Contents

/**
 * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
 *
 * @constructor
 */
jasmine.NestedResults = function() {
  /**
   * The total count of results
   */
  this.totalCount = 0;
  /**
   * Number of passed results
   */
  this.passedCount = 0;
  /**
   * Number of failed results
   */
  this.failedCount = 0;
  /**
   * Was this suite/spec skipped?
   */
  this.skipped = false;
  /**
   * @ignore
   */
  this.items_ = [];
};

/**
 * Roll up the result counts.
 *
 * @param result
 */
jasmine.NestedResults.prototype.rollupCounts = function(result) {
  this.totalCount += result.totalCount;
  this.passedCount += result.passedCount;
  this.failedCount += result.failedCount;
};

/**
 * Adds a log message.
 * @param values Array of message parts which will be concatenated later.
 */
jasmine.NestedResults.prototype.log = function(values) {
  this.items_.push(new jasmine.MessageResult(values));
};

/**
 * Getter for the results: message & results.
 */
jasmine.NestedResults.prototype.getItems = function() {
  return this.items_;
};

/**
 * Adds a result, tracking counts (total, passed, & failed)
 * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
 */
jasmine.NestedResults.prototype.addResult = function(result) {
  if (result.type != 'log') {
    if (result.items_) {
      this.rollupCounts(result);
    } else {
      this.totalCount++;
      if (result.passed()) {
        this.passedCount++;
      } else {
        this.failedCount++;
      }
    }
  }
  this.items_.push(result);
};

/**
 * @returns {Boolean} True if <b>everything</b> below passed
 */
jasmine.NestedResults.prototype.passed = function() {
  return this.passedCount === this.totalCount;
};

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
evergreen-0.4.0 lib/jasmine/src/NestedResults.js
js-test-driver-rails-0.2.6 vendor/jasmine/src/NestedResults.js
js-test-driver-rails-0.2.5 vendor/jasmine/src/NestedResults.js
js-test-driver-rails-0.2.1 vendor/jasmine/src/NestedResults.js
js-test-driver-rails-0.2.0 vendor/jasmine/src/NestedResults.js
evergreen-0.3.0 lib/jasmine/src/NestedResults.js
evergreen-0.2.2 lib/jasmine/src/NestedResults.js
evergreen-0.2.1 lib/jasmine/src/NestedResults.js
evergreen-0.2.0 lib/jasmine/src/NestedResults.js