Merge in new HTML runner. Tests green, regression on focused running.

This commit is contained in:
ragaskar
2009-08-19 07:42:47 -07:00
20 changed files with 462 additions and 164 deletions
+50 -11
View File
@@ -1084,6 +1084,16 @@ jasmine.Matchers.prototype.toNotContain = function(item) {
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
};
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
return this.report(this.actual < expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
};
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
return this.report(this.actual > expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
};
/**
* Matcher that checks that the expected exception was thrown by the actual.
*
@@ -1366,7 +1376,8 @@ jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
jasmine.StringPrettyPrinter.prototype.append = function(value) {
this.string += value;
};
jasmine.Queue = function() {
jasmine.Queue = function(env) {
this.env = env;
this.blocks = [];
this.running = false;
this.index = 0;
@@ -1405,13 +1416,17 @@ jasmine.Queue.prototype.isRunning = function () {
jasmine.Queue.prototype._next = function () {
var self = this;
self.offset = 0;
self.index++;
if (self.index < self.blocks.length) {
self.blocks[self.index].execute(function () {self._next();});
} else {
self.finish();
}
self.env.setTimeout(function () {
self.offset = 0;
self.index++;
if (self.index < self.blocks.length) {
self.blocks[self.index].execute(function () {
self._next();
});
} else {
self.finish();
}
}, 0);
};
jasmine.Queue.prototype.finish = function () {
@@ -1472,7 +1487,7 @@ jasmine.Reporters.reporter = function(callbacks) {
jasmine.Runner = function(env) {
var self = this;
self.env = env;
self.queue = new jasmine.Queue();
self.queue = new jasmine.Queue(env);
};
jasmine.Runner.prototype.execute = function() {
@@ -1487,10 +1502,34 @@ jasmine.Runner.prototype.finishCallback = function() {
this.env.reporter.reportRunnerResults(this);
};
jasmine.Runner.prototype.add = function(block) {
this.queue.add(block);
};
jasmine.Runner.prototype.getAllSuites = function() {
var suitesToReturn = [];
function addSuite(suite) {
suitesToReturn.push(suite);
for (var j = 0; j < suite.specs.length; j++) {
var spec = suite.specs[j];
if (spec instanceof jasmine.Suite) {
addSuite(spec);
}
}
}
for (var i = 0; i < this.suites.length; i++) {
var suite = this.suites[i];
addSuite(suite);
}
return suitesToReturn;
};
jasmine.Runner.prototype.getResults = function() {
var results = new jasmine.NestedResults();
var runnerResults = this.queue.getResults();
@@ -1516,7 +1555,7 @@ jasmine.Spec = function(env, suite, description) {
spec.env = env;
spec.suite = suite;
spec.description = description;
spec.queue = new jasmine.Queue();
spec.queue = new jasmine.Queue(env);
spec.finished = false;
spec.afterCallbacks = [];
@@ -1705,7 +1744,7 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
var self = this;
self.id = env.nextSuiteId_++;
self.description = description;
self.queue = new jasmine.Queue();
self.queue = new jasmine.Queue(env);
self.parentSuite = parentSuite;
self.env = env;
self.beforeQueue = [];