diff --git a/jsTestDriver-jquery.conf b/jsTestDriver-jquery.conf
index 26bdd614..add64fa0 100644
--- a/jsTestDriver-jquery.conf
+++ b/jsTestDriver-jquery.conf
@@ -1,7 +1,7 @@
server: http://localhost:9876
load:
- - lib/jasmine/jasmine-0.10.3.js
+ - lib/jasmine/jasmine-1.0.1.js
- lib/jasmine-jstd-adapter/JasmineAdapter.js
- lib/jquery/jquery-1.4.2.js
- test/jquery_alias.js
diff --git a/jsTestDriver.conf b/jsTestDriver.conf
index 9d3d980d..87d25a86 100644
--- a/jsTestDriver.conf
+++ b/jsTestDriver.conf
@@ -1,7 +1,7 @@
server: http://localhost:9876
load:
- - lib/jasmine/jasmine-0.10.3.js
+ - lib/jasmine/jasmine-1.0.1.js
- lib/jasmine-jstd-adapter/JasmineAdapter.js
- lib/jquery/jquery-1.4.2.js
- test/jquery_remove.js
diff --git a/lib/jasmine/.DS_Store b/lib/jasmine/.DS_Store
new file mode 100644
index 00000000..5008ddfc
Binary files /dev/null and b/lib/jasmine/.DS_Store differ
diff --git a/lib/jasmine/jasmine-0.10.3.js b/lib/jasmine/jasmine-1.0.1.js
similarity index 83%
rename from lib/jasmine/jasmine-0.10.3.js
rename to lib/jasmine/jasmine-1.0.1.js
index f309493f..964f99ed 100644
--- a/lib/jasmine/jasmine-0.10.3.js
+++ b/lib/jasmine/jasmine-1.0.1.js
@@ -21,11 +21,24 @@ jasmine.unimplementedMethod_ = function() {
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;
+/**
+ * Default timeout interval in milliseconds for waitsFor() blocks.
+ */
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
+
+jasmine.getGlobal = function() {
+ function getGlobal() {
+ return this;
+ }
+
+ return getGlobal();
+};
+
/**
* Allows for bound functions to be compared. Internal use only.
*
@@ -42,35 +55,49 @@ jasmine.bindOriginal_ = function(base, name) {
};
} else {
// IE support
- return window[name];
+ return jasmine.getGlobal()[name];
}
};
-jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
-jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
-jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
-jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
+jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
+jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
+jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
+jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
-jasmine.MessageResult = function(text) {
- this.type = 'MessageResult';
- this.text = text;
+jasmine.MessageResult = function(values) {
+ this.type = 'log';
+ this.values = values;
this.trace = new Error(); // todo: test better
};
+jasmine.MessageResult.prototype.toString = function() {
+ var text = "";
+ for(var i = 0; i < this.values.length; i++) {
+ if (i > 0) text += " ";
+ if (jasmine.isString_(this.values[i])) {
+ text += this.values[i];
+ } else {
+ text += jasmine.pp(this.values[i]);
+ }
+ }
+ return text;
+};
+
jasmine.ExpectationResult = function(params) {
- this.type = 'ExpectationResult';
+ this.type = 'expect';
this.matcherName = params.matcherName;
this.passed_ = params.passed;
this.expected = params.expected;
this.actual = params.actual;
- /** @deprecated */
- this.details = params.details;
-
this.message = this.passed_ ? 'Passed.' : params.message;
this.trace = this.passed_ ? '' : new Error(this.message);
};
+jasmine.ExpectationResult.prototype.toString = function () {
+ return this.message;
+};
+
jasmine.ExpectationResult.prototype.passed = function () {
return this.passed_;
};
@@ -150,7 +177,7 @@ jasmine.isDomNode = function(obj) {
*
* @example
* // don't care about which function is passed in, as long as it's a function
- * expect(mySpy).wasCalledWith(jasmine.any(Function));
+ * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
*
* @param {Class} clazz
* @returns matchable object of the type clazz
@@ -165,7 +192,8 @@ jasmine.any = function(clazz) {
* Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
* expectation syntax. Spies can be checked if they were called or not and what the calling params were.
*
- * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
+ * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
+ *
* Spies are torn down at the end of every spec.
*
* Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
@@ -195,8 +223,8 @@ jasmine.any = function(clazz) {
*
* // mock example
* foo.not(7 == 7);
- * expect(foo.not).wasCalled();
- * expect(foo.not).wasCalledWith(true);
+ * expect(foo.not).toHaveBeenCalled();
+ * expect(foo.not).toHaveBeenCalledWith(true);
*
* @constructor
* @see spyOn, jasmine.createSpy, jasmine.createSpyObj
@@ -387,8 +415,14 @@ jasmine.createSpyObj = function(baseName, methodNames) {
return obj;
};
-jasmine.log = function(message) {
- jasmine.getEnv().currentSpec.log(message);
+/**
+ * All parameters are pretty-printed and concatenated together, then written to the current spec's output.
+ *
+ * Be careful not to leave calls to jasmine.log in production code.
+ */
+jasmine.log = function() {
+ var spec = jasmine.getEnv().currentSpec;
+ spec.log.apply(spec, arguments);
};
/**
@@ -461,22 +495,24 @@ var runs = function(func) {
};
/**
- * Waits for a timeout before moving to the next runs()-defined block.
- * @param {Number} timeout
+ * Waits a fixed time period before moving to the next block.
+ *
+ * @deprecated Use waitsFor() instead
+ * @param {Number} timeout milliseconds to wait
*/
var waits = function(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 {String} message
+ * @param {String} optional_timeoutMessage
+ * @param {Number} optional_timeout
*/
-var waitsFor = function(timeout, latchFunction, message) {
- jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
+var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
+ jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
};
/**
@@ -551,31 +587,6 @@ jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
}
throw new Error("This browser does not support XMLHttpRequest.");
} : XMLHttpRequest;
-
-/**
- * Adds suite files to an HTML document so that they are executed, thus adding them to the current
- * Jasmine environment.
- *
- * @param {String} url path to the file to include
- * @param {Boolean} opt_global
- * @deprecated We suggest you use a different method of including JS source files. jasmine.include will be removed soon.
- */
-jasmine.include = function(url, opt_global) {
- if (opt_global) {
- document.write('