From 352dbfa38fca660a80d6fae2c6e810f820247791 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 17 Oct 2010 21:12:51 -0700 Subject: [PATCH] upgraded jasmine to 1.0.1 Close #63 --- jsTestDriver-jquery.conf | 2 +- jsTestDriver.conf | 2 +- lib/jasmine/.DS_Store | Bin 0 -> 6148 bytes .../{jasmine-0.10.3.js => jasmine-1.0.1.js} | 802 ++++++++++-------- 4 files changed, 448 insertions(+), 358 deletions(-) create mode 100644 lib/jasmine/.DS_Store rename lib/jasmine/{jasmine-0.10.3.js => jasmine-1.0.1.js} (83%) 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 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 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('