Fix getFullName on spec.

- Fixes specFiltering on nested specs
This commit is contained in:
Davis W. Frank & Rajan Agaskar
2012-12-07 11:11:09 -08:00
parent 74f928fd54
commit c584f182ab
6 changed files with 36 additions and 30 deletions

View File

@@ -593,14 +593,8 @@ jasmine.buildExpectationResult = function(params) {
var specConstructor = jasmine.Spec;
// TODO: this deserves a better name (not a Factory the way others are)
var fullNameFactory = function(spec, currentSuite) {
var descriptions = [];
for (var suite = currentSuite; suite; suite = suite.parentSuite) {
descriptions.push(suite.description)
}
descriptions.push(spec.description);
return descriptions.join(' ') + '.';
var getSpecName = function(spec, currentSuite) {
return currentSuite.getFullName() + ' ' + spec.description + '.';
};
var buildExpectationResult = jasmine.buildExpectationResult;
@@ -616,7 +610,7 @@ jasmine.buildExpectationResult = function(params) {
expectationFactory: expectationFactory,
exceptionFormatter: exceptionFormatter,
resultCallback: specResultCallback,
fullNameFactory: function(spec) { return fullNameFactory(spec, suite) },
getSpecName: function(spec) { return getSpecName(spec, suite) },
startCallback: startCallback,
description: description,
catchExceptions: self.catchExceptions,
@@ -1933,7 +1927,7 @@ jasmine.Spec = function(attrs) {
this.catchExceptions = attrs.catchExceptions;
this.startCallback = attrs.startCallback || function() {};
this.exceptionFormatter = attrs.exceptionFormatter || function() {};
this.fullNameFactory = attrs.fullNameFactory;
this.getSpecName = attrs.getSpecName;
this.expectationResultFactory = attrs.expectationResultFactory || function() {};
};
@@ -2013,9 +2007,8 @@ jasmine.Spec.prototype.status = function() {
}
};
//TODO: remove
jasmine.Spec.prototype.getFullName = function() {
return this.fullNameFactory(this);
return this.getSpecName(this);
}
/**
* Internal representation of a Jasmine suite.