Regenerate jasmine.js.
This commit is contained in:
parent
e7a57606a2
commit
3ec736f64c
|
@ -21,11 +21,16 @@ jasmine.unimplementedMethod_ = function() {
|
||||||
jasmine.undefined = jasmine.___undefined___;
|
jasmine.undefined = jasmine.___undefined___;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default interval for event loop yields. Small values here may result in slow test running. Zero means no updates until all tests have completed.
|
* Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default timeout interval in milliseconds for waitsFor() blocks.
|
||||||
|
*/
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
||||||
|
|
||||||
jasmine.getGlobal = function() {
|
jasmine.getGlobal = function() {
|
||||||
function getGlobal() {
|
function getGlobal() {
|
||||||
return this;
|
return this;
|
||||||
|
@ -490,22 +495,24 @@ var runs = function(func) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for a timeout before moving to the next runs()-defined block.
|
* Waits a fixed time period before moving to the next block.
|
||||||
* @param {Number} timeout
|
*
|
||||||
|
* @deprecated Use waitsFor() instead
|
||||||
|
* @param {Number} timeout milliseconds to wait
|
||||||
*/
|
*/
|
||||||
var waits = function(timeout) {
|
var waits = function(timeout) {
|
||||||
jasmine.getEnv().currentSpec.waits(timeout);
|
jasmine.getEnv().currentSpec.waits(timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
* Waits for the latchFunction to return true before proceeding to the next block.
|
||||||
*
|
*
|
||||||
* @param {Number} timeout
|
|
||||||
* @param {Function} latchFunction
|
* @param {Function} latchFunction
|
||||||
* @param {String} message
|
* @param {String} optional_timeoutMessage
|
||||||
|
* @param {Number} optional_timeout
|
||||||
*/
|
*/
|
||||||
var waitsFor = function(timeout, latchFunction, message) {
|
var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
||||||
jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
|
jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -660,6 +667,7 @@ jasmine.Env = function() {
|
||||||
this.reporter = new jasmine.MultiReporter();
|
this.reporter = new jasmine.MultiReporter();
|
||||||
|
|
||||||
this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
|
this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
|
||||||
|
this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.specFilter = function() {
|
this.specFilter = function() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1660,6 +1668,7 @@ jasmine.Queue = function(env) {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.index = 0;
|
this.index = 0;
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
|
this.abort = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.addBefore = function(block) {
|
jasmine.Queue.prototype.addBefore = function(block) {
|
||||||
|
@ -1694,7 +1703,7 @@ jasmine.Queue.prototype.next_ = function() {
|
||||||
while (goAgain) {
|
while (goAgain) {
|
||||||
goAgain = false;
|
goAgain = false;
|
||||||
|
|
||||||
if (self.index < self.blocks.length) {
|
if (self.index < self.blocks.length && !this.abort) {
|
||||||
var calledSynchronously = true;
|
var calledSynchronously = true;
|
||||||
var completedSynchronously = false;
|
var completedSynchronously = false;
|
||||||
|
|
||||||
|
@ -1704,6 +1713,10 @@ jasmine.Queue.prototype.next_ = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.blocks[self.index].abort) {
|
||||||
|
self.abort = true;
|
||||||
|
}
|
||||||
|
|
||||||
self.offset = 0;
|
self.offset = 0;
|
||||||
self.index++;
|
self.index++;
|
||||||
|
|
||||||
|
@ -1900,14 +1913,46 @@ jasmine.Spec.prototype.expect = function(actual) {
|
||||||
return positive;
|
return positive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits a fixed time period before moving to the next block.
|
||||||
|
*
|
||||||
|
* @deprecated Use waitsFor() instead
|
||||||
|
* @param {Number} timeout milliseconds to wait
|
||||||
|
*/
|
||||||
jasmine.Spec.prototype.waits = function(timeout) {
|
jasmine.Spec.prototype.waits = function(timeout) {
|
||||||
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
||||||
this.addToQueue(waitsFunc);
|
this.addToQueue(waitsFunc);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
|
/**
|
||||||
var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
|
* Waits for the latchFunction to return true before proceeding to the next block.
|
||||||
|
*
|
||||||
|
* @param {Function} latchFunction
|
||||||
|
* @param {String} optional_timeoutMessage
|
||||||
|
* @param {Number} optional_timeout
|
||||||
|
*/
|
||||||
|
jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
||||||
|
var latchFunction_ = null;
|
||||||
|
var optional_timeoutMessage_ = null;
|
||||||
|
var optional_timeout_ = null;
|
||||||
|
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var arg = arguments[i];
|
||||||
|
switch (typeof arg) {
|
||||||
|
case 'function':
|
||||||
|
latchFunction_ = arg;
|
||||||
|
break;
|
||||||
|
case 'string':
|
||||||
|
optional_timeoutMessage_ = arg;
|
||||||
|
break;
|
||||||
|
case 'number':
|
||||||
|
optional_timeout_ = arg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
|
||||||
this.addToQueue(waitsForFunc);
|
this.addToQueue(waitsForFunc);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -2142,7 +2187,7 @@ jasmine.WaitsBlock.prototype.execute = function (onComplete) {
|
||||||
* @param {jasmine.Spec} spec The Jasmine spec.
|
* @param {jasmine.Spec} spec The Jasmine spec.
|
||||||
*/
|
*/
|
||||||
jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
|
jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
|
||||||
this.timeout = timeout;
|
this.timeout = timeout || env.defaultTimeoutInterval;
|
||||||
this.latchFunction = latchFunction;
|
this.latchFunction = latchFunction;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.totalTimeSpentWaitingForLatch = 0;
|
this.totalTimeSpentWaitingForLatch = 0;
|
||||||
|
@ -2171,7 +2216,9 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
|
||||||
name: 'timeout',
|
name: 'timeout',
|
||||||
message: message
|
message: message
|
||||||
});
|
});
|
||||||
// todo: need to prevent additional blocks in this spec from running... [xw 20100819]
|
|
||||||
|
this.abort = true;
|
||||||
|
onComplete();
|
||||||
} else {
|
} else {
|
||||||
this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
|
this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -2368,5 +2415,5 @@ jasmine.version_= {
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 11,
|
"minor": 11,
|
||||||
"build": 1,
|
"build": 1,
|
||||||
"revision": 1282768601
|
"revision": 1282784791
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue