Bump to Jasmine 2.0.0-rc5
This commit is contained in:
parent
cbb57ff310
commit
2762631aea
127
vendor/jasmine-2.0.0-rc3/boot.js
vendored
127
vendor/jasmine-2.0.0-rc3/boot.js
vendored
@ -1,127 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2008-2013 Pivotal Labs
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
// Jasmine boot.js for browser runners - exposes external/global interface, builds the Jasmine environment and executes it.
|
|
||||||
(function() {
|
|
||||||
window.jasmine = jasmineRequire.core(jasmineRequire);
|
|
||||||
jasmineRequire.html(jasmine);
|
|
||||||
|
|
||||||
var env = jasmine.getEnv();
|
|
||||||
|
|
||||||
var jasmineInterface = {
|
|
||||||
describe: function(description, specDefinitions) {
|
|
||||||
return env.describe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
xdescribe: function(description, specDefinitions) {
|
|
||||||
return env.xdescribe(description, specDefinitions);
|
|
||||||
},
|
|
||||||
|
|
||||||
it: function(desc, func) {
|
|
||||||
return env.it(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
xit: function(desc, func) {
|
|
||||||
return env.xit(desc, func);
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeEach: function(beforeEachFunction) {
|
|
||||||
return env.beforeEach(beforeEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
afterEach: function(afterEachFunction) {
|
|
||||||
return env.afterEach(afterEachFunction);
|
|
||||||
},
|
|
||||||
|
|
||||||
expect: function(actual) {
|
|
||||||
return env.expect(actual);
|
|
||||||
},
|
|
||||||
|
|
||||||
pending: function() {
|
|
||||||
return env.pending();
|
|
||||||
},
|
|
||||||
|
|
||||||
addMatchers: function(matchers) {
|
|
||||||
return env.addMatchers(matchers);
|
|
||||||
},
|
|
||||||
|
|
||||||
spyOn: function(obj, methodName) {
|
|
||||||
return env.spyOn(obj, methodName);
|
|
||||||
},
|
|
||||||
|
|
||||||
clock: env.clock,
|
|
||||||
jsApiReporter: new jasmine.JsApiReporter({
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof window == "undefined" && typeof exports == "object") {
|
|
||||||
extend(exports, jasmineInterface);
|
|
||||||
} else {
|
|
||||||
extend(window, jasmineInterface);
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryString = new jasmine.QueryString({
|
|
||||||
getWindowLocation: function() { return window.location; }
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: move all of catching to raise so we don't break our brains
|
|
||||||
var catchingExceptions = queryString.getParam("catch");
|
|
||||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
|
||||||
|
|
||||||
var htmlReporter = new jasmine.HtmlReporter({
|
|
||||||
env: env,
|
|
||||||
queryString: queryString,
|
|
||||||
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
|
||||||
getContainer: function() { return document.body; },
|
|
||||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
|
||||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
|
||||||
timer: new jasmine.Timer()
|
|
||||||
});
|
|
||||||
|
|
||||||
env.addReporter(jasmineInterface.jsApiReporter);
|
|
||||||
env.addReporter(htmlReporter);
|
|
||||||
|
|
||||||
var specFilter = new jasmine.HtmlSpecFilter({
|
|
||||||
filterString: function() { return queryString.getParam("spec"); }
|
|
||||||
});
|
|
||||||
|
|
||||||
env.specFilter = function(spec) {
|
|
||||||
return specFilter.matches(spec.getFullName());
|
|
||||||
};
|
|
||||||
|
|
||||||
var currentWindowOnload = window.onload;
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
if (currentWindowOnload) {
|
|
||||||
currentWindowOnload();
|
|
||||||
}
|
|
||||||
htmlReporter.initialize();
|
|
||||||
env.execute();
|
|
||||||
};
|
|
||||||
|
|
||||||
function extend(destination, source) {
|
|
||||||
for (var property in source) destination[property] = source[property];
|
|
||||||
return destination;
|
|
||||||
}
|
|
||||||
|
|
||||||
}());
|
|
181
vendor/jasmine-2.0.0-rc5/boot.js
vendored
Executable file
181
vendor/jasmine-2.0.0-rc5/boot.js
vendored
Executable file
@ -0,0 +1,181 @@
|
|||||||
|
/**
|
||||||
|
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||||
|
|
||||||
|
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||||
|
|
||||||
|
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
|
||||||
|
|
||||||
|
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Require & Instantiate
|
||||||
|
*
|
||||||
|
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
|
||||||
|
*/
|
||||||
|
window.jasmine = jasmineRequire.core(jasmineRequire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
|
||||||
|
*/
|
||||||
|
jasmineRequire.html(jasmine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the Jasmine environment. This is used to run all specs in a project.
|
||||||
|
*/
|
||||||
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## The Global Interface
|
||||||
|
*
|
||||||
|
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||||
|
*/
|
||||||
|
var jasmineInterface = {
|
||||||
|
describe: function(description, specDefinitions) {
|
||||||
|
return env.describe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
xdescribe: function(description, specDefinitions) {
|
||||||
|
return env.xdescribe(description, specDefinitions);
|
||||||
|
},
|
||||||
|
|
||||||
|
it: function(desc, func) {
|
||||||
|
return env.it(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
xit: function(desc, func) {
|
||||||
|
return env.xit(desc, func);
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeEach: function(beforeEachFunction) {
|
||||||
|
return env.beforeEach(beforeEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
afterEach: function(afterEachFunction) {
|
||||||
|
return env.afterEach(afterEachFunction);
|
||||||
|
},
|
||||||
|
|
||||||
|
expect: function(actual) {
|
||||||
|
return env.expect(actual);
|
||||||
|
},
|
||||||
|
|
||||||
|
pending: function() {
|
||||||
|
return env.pending();
|
||||||
|
},
|
||||||
|
|
||||||
|
spyOn: function(obj, methodName) {
|
||||||
|
return env.spyOn(obj, methodName);
|
||||||
|
},
|
||||||
|
|
||||||
|
jsApiReporter: new jasmine.JsApiReporter({
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||||
|
*/
|
||||||
|
if (typeof window == "undefined" && typeof exports == "object") {
|
||||||
|
extend(exports, jasmineInterface);
|
||||||
|
} else {
|
||||||
|
extend(window, jasmineInterface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose the interface for adding custom equality testers.
|
||||||
|
*/
|
||||||
|
jasmine.addCustomEqualityTester = function(tester) {
|
||||||
|
env.addCustomEqualityTester(tester);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose the interface for adding custom expectation matchers
|
||||||
|
*/
|
||||||
|
jasmine.addMatchers = function(matchers) {
|
||||||
|
return env.addMatchers(matchers);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose the mock interface for the JavaScript timeout functions
|
||||||
|
*/
|
||||||
|
jasmine.clock = function() {
|
||||||
|
return env.clock;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Runner Parameters
|
||||||
|
*
|
||||||
|
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryString = new jasmine.QueryString({
|
||||||
|
getWindowLocation: function() { return window.location; }
|
||||||
|
});
|
||||||
|
|
||||||
|
var catchingExceptions = queryString.getParam("catch");
|
||||||
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Reporters
|
||||||
|
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||||
|
*/
|
||||||
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
||||||
|
getContainer: function() { return document.body; },
|
||||||
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
||||||
|
*/
|
||||||
|
env.addReporter(jasmineInterface.jsApiReporter);
|
||||||
|
env.addReporter(htmlReporter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||||
|
*/
|
||||||
|
var specFilter = new jasmine.HtmlSpecFilter({
|
||||||
|
filterString: function() { return queryString.getParam("spec"); }
|
||||||
|
});
|
||||||
|
|
||||||
|
env.specFilter = function(spec) {
|
||||||
|
return specFilter.matches(spec.getFullName());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
||||||
|
*/
|
||||||
|
window.setTimeout = window.setTimeout;
|
||||||
|
window.setInterval = window.setInterval;
|
||||||
|
window.clearTimeout = window.clearTimeout;
|
||||||
|
window.clearInterval = window.clearInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Execution
|
||||||
|
*
|
||||||
|
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
|
||||||
|
*/
|
||||||
|
var currentWindowOnload = window.onload;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (currentWindowOnload) {
|
||||||
|
currentWindowOnload();
|
||||||
|
}
|
||||||
|
htmlReporter.initialize();
|
||||||
|
env.execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for readability above.
|
||||||
|
*/
|
||||||
|
function extend(destination, source) {
|
||||||
|
for (var property in source) destination[property] = source[property];
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
}());
|
9
vendor/jasmine-2.0.0-rc3/jasmine-html.js → vendor/jasmine-2.0.0-rc5/jasmine-html.js
vendored
Normal file → Executable file
9
vendor/jasmine-2.0.0-rc3/jasmine-html.js → vendor/jasmine-2.0.0-rc5/jasmine-html.js
vendored
Normal file → Executable file
@ -26,11 +26,12 @@ jasmineRequire.html = function(j$) {
|
|||||||
j$.QueryString = jasmineRequire.QueryString();
|
j$.QueryString = jasmineRequire.QueryString();
|
||||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.HtmlReporter = function(j$) {
|
jasmineRequire.HtmlReporter = function(j$) {
|
||||||
|
|
||||||
var noopTimer = {
|
var noopTimer = {
|
||||||
start: function(){},
|
start: function() {},
|
||||||
elapsed: function(){ return 0; }
|
elapsed: function() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
function HtmlReporter(options) {
|
function HtmlReporter(options) {
|
||||||
@ -101,7 +102,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
symbols.appendChild(createDom("li", {
|
symbols.appendChild(createDom("li", {
|
||||||
className: result.status,
|
className: result.status,
|
||||||
id: "spec_" + result.id,
|
id: "spec_" + result.id,
|
||||||
title: result.fullName}
|
title: result.fullName
|
||||||
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
if (result.status == "failed") {
|
if (result.status == "failed") {
|
||||||
@ -307,6 +309,7 @@ jasmineRequire.ResultsNode = function() {
|
|||||||
|
|
||||||
return ResultsNode;
|
return ResultsNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.QueryString = function() {
|
jasmineRequire.QueryString = function() {
|
||||||
function QueryString(options) {
|
function QueryString(options) {
|
||||||
|
|
0
vendor/jasmine-2.0.0-rc3/jasmine.css → vendor/jasmine-2.0.0-rc5/jasmine.css
vendored
Normal file → Executable file
0
vendor/jasmine-2.0.0-rc3/jasmine.css → vendor/jasmine-2.0.0-rc5/jasmine.css
vendored
Normal file → Executable file
530
vendor/jasmine-2.0.0-rc3/jasmine.js → vendor/jasmine-2.0.0-rc5/jasmine.js
vendored
Normal file → Executable file
530
vendor/jasmine-2.0.0-rc3/jasmine.js → vendor/jasmine-2.0.0-rc5/jasmine.js
vendored
Normal file → Executable file
@ -142,18 +142,18 @@ getJasmineRequireObj().base = function(j$) {
|
|||||||
j$.createSpy = function(name, originalFn) {
|
j$.createSpy = function(name, originalFn) {
|
||||||
|
|
||||||
var spyStrategy = new j$.SpyStrategy({
|
var spyStrategy = new j$.SpyStrategy({
|
||||||
name: name,
|
name: name,
|
||||||
fn: originalFn,
|
fn: originalFn,
|
||||||
getSpy: function() { return spy; }
|
getSpy: function() { return spy; }
|
||||||
}),
|
}),
|
||||||
callTracker = new j$.CallTracker(),
|
callTracker = new j$.CallTracker(),
|
||||||
spy = function() {
|
spy = function() {
|
||||||
callTracker.track({
|
callTracker.track({
|
||||||
object: this,
|
object: this,
|
||||||
args: Array.prototype.slice.apply(arguments)
|
args: Array.prototype.slice.apply(arguments)
|
||||||
});
|
});
|
||||||
return spyStrategy.exec.apply(this, arguments);
|
return spyStrategy.exec.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var prop in originalFn) {
|
for (var prop in originalFn) {
|
||||||
if (prop === 'and' || prop === 'calls') {
|
if (prop === 'and' || prop === 'calls') {
|
||||||
@ -174,7 +174,7 @@ getJasmineRequireObj().base = function(j$) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return putativeSpy.and instanceof j$.SpyStrategy &&
|
return putativeSpy.and instanceof j$.SpyStrategy &&
|
||||||
putativeSpy.calls instanceof j$.CallTracker;
|
putativeSpy.calls instanceof j$.CallTracker;
|
||||||
};
|
};
|
||||||
|
|
||||||
j$.createSpyObj = function(baseName, methodNames) {
|
j$.createSpyObj = function(baseName, methodNames) {
|
||||||
@ -194,14 +194,16 @@ getJasmineRequireObj().util = function() {
|
|||||||
var util = {};
|
var util = {};
|
||||||
|
|
||||||
util.inherit = function(childClass, parentClass) {
|
util.inherit = function(childClass, parentClass) {
|
||||||
var subclass = function() {
|
var Subclass = function() {
|
||||||
};
|
};
|
||||||
subclass.prototype = parentClass.prototype;
|
Subclass.prototype = parentClass.prototype;
|
||||||
childClass.prototype = new subclass();
|
childClass.prototype = new Subclass();
|
||||||
};
|
};
|
||||||
|
|
||||||
util.htmlEscape = function(str) {
|
util.htmlEscape = function(str) {
|
||||||
if (!str) return str;
|
if (!str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
return str.replace(/&/g, '&')
|
return str.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
@ -209,7 +211,9 @@ getJasmineRequireObj().util = function() {
|
|||||||
|
|
||||||
util.argsToArray = function(args) {
|
util.argsToArray = function(args) {
|
||||||
var arrayOfArgs = [];
|
var arrayOfArgs = [];
|
||||||
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
arrayOfArgs.push(args[i]);
|
||||||
|
}
|
||||||
return arrayOfArgs;
|
return arrayOfArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -222,7 +226,6 @@ getJasmineRequireObj().util = function() {
|
|||||||
|
|
||||||
getJasmineRequireObj().Spec = function(j$) {
|
getJasmineRequireObj().Spec = function(j$) {
|
||||||
function Spec(attrs) {
|
function Spec(attrs) {
|
||||||
this.encounteredExpectations = false;
|
|
||||||
this.expectationFactory = attrs.expectationFactory;
|
this.expectationFactory = attrs.expectationFactory;
|
||||||
this.resultCallback = attrs.resultCallback || function() {};
|
this.resultCallback = attrs.resultCallback || function() {};
|
||||||
this.id = attrs.id;
|
this.id = attrs.id;
|
||||||
@ -248,13 +251,11 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
fullName: this.getFullName(),
|
fullName: this.getFullName(),
|
||||||
status: this.status(),
|
|
||||||
failedExpectations: []
|
failedExpectations: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Spec.prototype.addExpectationResult = function(passed, data) {
|
Spec.prototype.addExpectationResult = function(passed, data) {
|
||||||
this.encounteredExpectations = true;
|
|
||||||
if (passed) {
|
if (passed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -278,7 +279,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
function timeoutable(fn) {
|
function timeoutable(fn) {
|
||||||
return function(done) {
|
return function(done) {
|
||||||
var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
|
var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
|
||||||
onException(new Error('timeout'));
|
onException(new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'));
|
||||||
done();
|
done();
|
||||||
}, j$.DEFAULT_TIMEOUT_INTERVAL]]);
|
}, j$.DEFAULT_TIMEOUT_INTERVAL]]);
|
||||||
|
|
||||||
@ -292,8 +293,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var befores = this.beforeFns() || [],
|
var befores = this.beforeFns() || [],
|
||||||
afters = this.afterFns() || [],
|
afters = this.afterFns() || [],
|
||||||
thisOne = (this.fn.length) ? timeoutable(this.fn) : this.fn;
|
thisOne = (this.fn.length) ? timeoutable(this.fn) : this.fn;
|
||||||
var allFns = befores.concat(thisOne).concat(afters);
|
var allFns = befores.concat(thisOne).concat(afters);
|
||||||
|
|
||||||
this.queueRunner({
|
this.queueRunner({
|
||||||
@ -303,18 +304,18 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onException(e) {
|
function onException(e) {
|
||||||
if (Spec.isPendingSpecException(e)) {
|
if (Spec.isPendingSpecException(e)) {
|
||||||
self.pend();
|
self.pend();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addExpectationResult(false, {
|
self.addExpectationResult(false, {
|
||||||
matcherName: "",
|
matcherName: "",
|
||||||
passed: false,
|
passed: false,
|
||||||
expected: "",
|
expected: "",
|
||||||
actual: "",
|
actual: "",
|
||||||
error: e
|
error: e
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function complete() {
|
function complete() {
|
||||||
@ -340,7 +341,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.markedPending || !this.encounteredExpectations) {
|
if (this.markedPending) {
|
||||||
return 'pending';
|
return 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,6 +376,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
var global = options.global || j$.getGlobal();
|
var global = options.global || j$.getGlobal();
|
||||||
|
|
||||||
|
var totalSpecsDefined = 0;
|
||||||
|
|
||||||
var catchExceptions = true;
|
var catchExceptions = true;
|
||||||
|
|
||||||
var realSetTimeout = j$.getGlobal().setTimeout;
|
var realSetTimeout = j$.getGlobal().setTimeout;
|
||||||
@ -385,9 +388,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
var spies = [];
|
var spies = [];
|
||||||
|
|
||||||
this.currentSpec = null;
|
var currentSpec = null;
|
||||||
|
var currentSuite = null;
|
||||||
|
|
||||||
this.reporter = new j$.ReportDispatcher([
|
var reporter = new j$.ReportDispatcher([
|
||||||
"jasmineStarted",
|
"jasmineStarted",
|
||||||
"jasmineDone",
|
"jasmineDone",
|
||||||
"suiteStarted",
|
"suiteStarted",
|
||||||
@ -396,14 +400,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
"specDone"
|
"specDone"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.lastUpdate = 0;
|
|
||||||
this.specFilter = function() {
|
this.specFilter = function() {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nextSpecId_ = 0;
|
var equalityTesters = [];
|
||||||
this.nextSuiteId_ = 0;
|
|
||||||
this.equalityTesters_ = [];
|
|
||||||
|
|
||||||
var customEqualityTesters = [];
|
var customEqualityTesters = [];
|
||||||
this.addCustomEqualityTester = function(tester) {
|
this.addCustomEqualityTester = function(tester) {
|
||||||
@ -412,6 +413,16 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
j$.Expectation.addCoreMatchers(j$.matchers);
|
j$.Expectation.addCoreMatchers(j$.matchers);
|
||||||
|
|
||||||
|
var nextSpecId = 0;
|
||||||
|
var getNextSpecId = function() {
|
||||||
|
return 'spec' + nextSpecId++;
|
||||||
|
};
|
||||||
|
|
||||||
|
var nextSuiteId = 0;
|
||||||
|
var getNextSuiteId = function() {
|
||||||
|
return 'suite' + nextSuiteId++;
|
||||||
|
};
|
||||||
|
|
||||||
var expectationFactory = function(actual, spec) {
|
var expectationFactory = function(actual, spec) {
|
||||||
return j$.Expectation.Factory({
|
return j$.Expectation.Factory({
|
||||||
util: j$.matchersUtil,
|
util: j$.matchersUtil,
|
||||||
@ -426,32 +437,34 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var specStarted = function(spec) {
|
var specStarted = function(spec) {
|
||||||
self.currentSpec = spec;
|
currentSpec = spec;
|
||||||
self.reporter.specStarted(spec.result);
|
reporter.specStarted(spec.result);
|
||||||
};
|
};
|
||||||
|
|
||||||
var beforeFns = function(currentSuite) {
|
var beforeFns = function(suite) {
|
||||||
return function() {
|
return function() {
|
||||||
var befores = [];
|
var befores = [];
|
||||||
for (var suite = currentSuite; suite; suite = suite.parentSuite) {
|
while(suite) {
|
||||||
befores = befores.concat(suite.beforeFns);
|
befores = befores.concat(suite.beforeFns);
|
||||||
|
suite = suite.parentSuite;
|
||||||
}
|
}
|
||||||
return befores.reverse();
|
return befores.reverse();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var afterFns = function(currentSuite) {
|
var afterFns = function(suite) {
|
||||||
return function() {
|
return function() {
|
||||||
var afters = [];
|
var afters = [];
|
||||||
for (var suite = currentSuite; suite; suite = suite.parentSuite) {
|
while(suite) {
|
||||||
afters = afters.concat(suite.afterFns);
|
afters = afters.concat(suite.afterFns);
|
||||||
|
suite = suite.parentSuite;
|
||||||
}
|
}
|
||||||
return afters;
|
return afters;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSpecName = function(spec, currentSuite) {
|
var getSpecName = function(spec, suite) {
|
||||||
return currentSuite.getFullName() + ' ' + spec.description;
|
return suite.getFullName() + ' ' + spec.description;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: we may just be able to pass in the fn instead of wrapping here
|
// TODO: we may just be able to pass in the fn instead of wrapping here
|
||||||
@ -474,10 +487,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return catchExceptions;
|
return catchExceptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.catchException = function(e) {
|
|
||||||
return j$.Spec.isPendingSpecException(e) || catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
var maximumSpecCallbackDepth = 20;
|
var maximumSpecCallbackDepth = 20;
|
||||||
var currentSpecCallbackDepth = 0;
|
var currentSpecCallbackDepth = 0;
|
||||||
|
|
||||||
@ -491,19 +500,136 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var queueRunnerFactory = function(options) {
|
var catchException = function(e) {
|
||||||
options.catchException = self.catchException;
|
return j$.Spec.isPendingSpecException(e) || catchExceptions;
|
||||||
options.clearStack = options.clearStack || clearStack;
|
|
||||||
|
|
||||||
new j$.QueueRunner(options).run(options.fns, 0);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var totalSpecsDefined = 0;
|
var queueRunnerFactory = function(options) {
|
||||||
this.specFactory = function(description, fn, suite) {
|
options.catchException = catchException;
|
||||||
|
options.clearStack = options.clearStack || clearStack;
|
||||||
|
|
||||||
|
new j$.QueueRunner(options).execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
var topSuite = new j$.Suite({
|
||||||
|
env: this,
|
||||||
|
id: getNextSuiteId(),
|
||||||
|
description: 'Jasmine__TopLevel__Suite',
|
||||||
|
queueRunner: queueRunnerFactory,
|
||||||
|
resultCallback: function() {} // TODO - hook this up
|
||||||
|
});
|
||||||
|
runnableLookupTable[topSuite.id] = topSuite;
|
||||||
|
currentSuite = topSuite;
|
||||||
|
|
||||||
|
this.topSuite = function() {
|
||||||
|
return topSuite;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.execute = function(runnablesToRun) {
|
||||||
|
runnablesToRun = runnablesToRun || [topSuite.id];
|
||||||
|
|
||||||
|
var allFns = [];
|
||||||
|
for(var i = 0; i < runnablesToRun.length; i++) {
|
||||||
|
var runnable = runnableLookupTable[runnablesToRun[i]];
|
||||||
|
allFns.push((function(runnable) { return function(done) { runnable.execute(done); }; })(runnable));
|
||||||
|
}
|
||||||
|
|
||||||
|
reporter.jasmineStarted({
|
||||||
|
totalSpecsDefined: totalSpecsDefined
|
||||||
|
});
|
||||||
|
|
||||||
|
queueRunnerFactory({fns: allFns, onComplete: reporter.jasmineDone});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.addReporter = function(reporterToAdd) {
|
||||||
|
reporter.addReporter(reporterToAdd);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.addMatchers = function(matchersToAdd) {
|
||||||
|
j$.Expectation.addMatchers(matchersToAdd);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.spyOn = function(obj, methodName) {
|
||||||
|
if (j$.util.isUndefined(obj)) {
|
||||||
|
throw new Error("spyOn could not find an object to spy upon for " + methodName + "()");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j$.util.isUndefined(obj[methodName])) {
|
||||||
|
throw new Error(methodName + '() method does not exist');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj[methodName] && j$.isSpy(obj[methodName])) {
|
||||||
|
//TODO?: should this return the current spy? Downside: may cause user confusion about spy state
|
||||||
|
throw new Error(methodName + ' has already been spied upon');
|
||||||
|
}
|
||||||
|
|
||||||
|
var spy = j$.createSpy(methodName, obj[methodName]);
|
||||||
|
|
||||||
|
spies.push({
|
||||||
|
spy: spy,
|
||||||
|
baseObj: obj,
|
||||||
|
methodName: methodName,
|
||||||
|
originalValue: obj[methodName]
|
||||||
|
});
|
||||||
|
|
||||||
|
obj[methodName] = spy;
|
||||||
|
|
||||||
|
return spy;
|
||||||
|
};
|
||||||
|
|
||||||
|
var suiteFactory = function(description) {
|
||||||
|
var suite = new j$.Suite({
|
||||||
|
env: self,
|
||||||
|
id: getNextSuiteId(),
|
||||||
|
description: description,
|
||||||
|
parentSuite: currentSuite,
|
||||||
|
queueRunner: queueRunnerFactory,
|
||||||
|
onStart: suiteStarted,
|
||||||
|
resultCallback: function(attrs) {
|
||||||
|
reporter.suiteDone(attrs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
runnableLookupTable[suite.id] = suite;
|
||||||
|
return suite;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.describe = function(description, specDefinitions) {
|
||||||
|
var suite = suiteFactory(description);
|
||||||
|
|
||||||
|
var parentSuite = currentSuite;
|
||||||
|
parentSuite.addChild(suite);
|
||||||
|
currentSuite = suite;
|
||||||
|
|
||||||
|
var declarationError = null;
|
||||||
|
try {
|
||||||
|
specDefinitions.call(suite);
|
||||||
|
} catch (e) {
|
||||||
|
declarationError = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (declarationError) {
|
||||||
|
this.it("encountered a declaration exception", function() {
|
||||||
|
throw declarationError;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
currentSuite = parentSuite;
|
||||||
|
|
||||||
|
return suite;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.xdescribe = function(description, specDefinitions) {
|
||||||
|
var suite = this.describe(description, specDefinitions);
|
||||||
|
suite.disable();
|
||||||
|
return suite;
|
||||||
|
};
|
||||||
|
|
||||||
|
var specFactory = function(description, fn, suite) {
|
||||||
totalSpecsDefined++;
|
totalSpecsDefined++;
|
||||||
|
|
||||||
var spec = new j$.Spec({
|
var spec = new j$.Spec({
|
||||||
id: self.nextSpecId(),
|
id: getNextSpecId(),
|
||||||
beforeFns: beforeFns(suite),
|
beforeFns: beforeFns(suite),
|
||||||
afterFns: afterFns(suite),
|
afterFns: afterFns(suite),
|
||||||
expectationFactory: expectationFactory,
|
expectationFactory: expectationFactory,
|
||||||
@ -539,193 +665,45 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
function specResultCallback(result) {
|
function specResultCallback(result) {
|
||||||
removeAllSpies();
|
removeAllSpies();
|
||||||
j$.Expectation.resetMatchers();
|
j$.Expectation.resetMatchers();
|
||||||
customEqualityTesters.length = 0;
|
customEqualityTesters = [];
|
||||||
self.clock.uninstall();
|
currentSpec = null;
|
||||||
self.currentSpec = null;
|
reporter.specDone(result);
|
||||||
self.reporter.specDone(result);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var suiteStarted = function(suite) {
|
var suiteStarted = function(suite) {
|
||||||
self.reporter.suiteStarted(suite.result);
|
reporter.suiteStarted(suite.result);
|
||||||
};
|
};
|
||||||
|
|
||||||
var suiteConstructor = j$.Suite;
|
this.it = function(description, fn) {
|
||||||
|
var spec = specFactory(description, fn, currentSuite);
|
||||||
this.topSuite = new j$.Suite({
|
currentSuite.addChild(spec);
|
||||||
env: this,
|
return spec;
|
||||||
id: this.nextSuiteId(),
|
|
||||||
description: 'Jasmine__TopLevel__Suite',
|
|
||||||
queueRunner: queueRunnerFactory,
|
|
||||||
completeCallback: function() {}, // TODO - hook this up
|
|
||||||
resultCallback: function() {} // TODO - hook this up
|
|
||||||
});
|
|
||||||
runnableLookupTable[this.topSuite.id] = this.topSuite;
|
|
||||||
this.currentSuite = this.topSuite;
|
|
||||||
|
|
||||||
this.suiteFactory = function(description) {
|
|
||||||
var suite = new suiteConstructor({
|
|
||||||
env: self,
|
|
||||||
id: self.nextSuiteId(),
|
|
||||||
description: description,
|
|
||||||
parentSuite: self.currentSuite,
|
|
||||||
queueRunner: queueRunnerFactory,
|
|
||||||
onStart: suiteStarted,
|
|
||||||
resultCallback: function(attrs) {
|
|
||||||
self.reporter.suiteDone(attrs);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
runnableLookupTable[suite.id] = suite;
|
|
||||||
return suite;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.execute = function(runnablesToRun) {
|
this.xit = function(description, fn) {
|
||||||
runnablesToRun = runnablesToRun || [this.topSuite.id];
|
var spec = this.it(description, fn);
|
||||||
|
spec.pend();
|
||||||
var allFns = [];
|
return spec;
|
||||||
for(var i = 0; i < runnablesToRun.length; i++) {
|
|
||||||
var runnable = runnableLookupTable[runnablesToRun[i]];
|
|
||||||
allFns.push((function(runnable) { return function(done) { runnable.execute(done); }; })(runnable));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.reporter.jasmineStarted({
|
|
||||||
totalSpecsDefined: totalSpecsDefined
|
|
||||||
});
|
|
||||||
|
|
||||||
queueRunnerFactory({fns: allFns, onComplete: this.reporter.jasmineDone});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.spyOn = function(obj, methodName) {
|
this.expect = function(actual) {
|
||||||
if (j$.util.isUndefined(obj)) {
|
return currentSpec.expect(actual);
|
||||||
throw new Error("spyOn could not find an object to spy upon for " + methodName + "()");
|
};
|
||||||
}
|
|
||||||
|
|
||||||
if (j$.util.isUndefined(obj[methodName])) {
|
this.beforeEach = function(beforeEachFunction) {
|
||||||
throw new Error(methodName + '() method does not exist');
|
currentSuite.beforeEach(beforeEachFunction);
|
||||||
}
|
};
|
||||||
|
|
||||||
if (obj[methodName] && j$.isSpy(obj[methodName])) {
|
this.afterEach = function(afterEachFunction) {
|
||||||
//TODO?: should this return the current spy? Downside: may cause user confusion about spy state
|
currentSuite.afterEach(afterEachFunction);
|
||||||
throw new Error(methodName + ' has already been spied upon');
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var spy = j$.createSpy(methodName, obj[methodName]);
|
this.pending = function() {
|
||||||
|
throw j$.Spec.pendingSpecExceptionMessage;
|
||||||
spies.push({
|
|
||||||
spy: spy,
|
|
||||||
baseObj: obj,
|
|
||||||
methodName: methodName,
|
|
||||||
originalValue: obj[methodName]
|
|
||||||
});
|
|
||||||
|
|
||||||
obj[methodName] = spy;
|
|
||||||
|
|
||||||
return spy;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Env.prototype.addMatchers = function(matchersToAdd) {
|
|
||||||
j$.Expectation.addMatchers(matchersToAdd);
|
|
||||||
};
|
|
||||||
|
|
||||||
Env.prototype.version = function() {
|
|
||||||
return j$.version;
|
|
||||||
};
|
|
||||||
|
|
||||||
Env.prototype.expect = function(actual) {
|
|
||||||
return this.currentSpec.expect(actual);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.versionString = function() {
|
|
||||||
console.log("DEPRECATED == use j$.version");
|
|
||||||
return j$.version;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.nextSpecId = function() {
|
|
||||||
return 'spec' + this.nextSpecId_++;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.nextSuiteId = function() {
|
|
||||||
return 'suite' + this.nextSuiteId_++;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.addReporter = function(reporter) {
|
|
||||||
this.reporter.addReporter(reporter);
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.describe = function(description, specDefinitions) {
|
|
||||||
var suite = this.suiteFactory(description);
|
|
||||||
|
|
||||||
var parentSuite = this.currentSuite;
|
|
||||||
parentSuite.addSuite(suite);
|
|
||||||
this.currentSuite = suite;
|
|
||||||
|
|
||||||
var declarationError = null;
|
|
||||||
try {
|
|
||||||
specDefinitions.call(suite);
|
|
||||||
} catch (e) {
|
|
||||||
declarationError = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declarationError) {
|
|
||||||
this.it("encountered a declaration exception", function() {
|
|
||||||
throw declarationError;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentSuite = parentSuite;
|
|
||||||
|
|
||||||
return suite;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.xdescribe = function(description, specDefinitions) {
|
|
||||||
var suite = this.describe(description, specDefinitions);
|
|
||||||
suite.disable();
|
|
||||||
return suite;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.it = function(description, fn) {
|
|
||||||
var spec = this.specFactory(description, fn, this.currentSuite);
|
|
||||||
this.currentSuite.addSpec(spec);
|
|
||||||
return spec;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.xit = function(description, fn) {
|
|
||||||
var spec = this.it(description, fn);
|
|
||||||
spec.pend();
|
|
||||||
return spec;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.beforeEach = function(beforeEachFunction) {
|
|
||||||
this.currentSuite.beforeEach(beforeEachFunction);
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.afterEach = function(afterEachFunction) {
|
|
||||||
this.currentSuite.afterEach(afterEachFunction);
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: move this to closure
|
|
||||||
Env.prototype.pending = function() {
|
|
||||||
throw j$.Spec.pendingSpecExceptionMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: Still needed?
|
|
||||||
Env.prototype.currentRunner = function() {
|
|
||||||
return this.topSuite;
|
|
||||||
};
|
|
||||||
|
|
||||||
return Env;
|
return Env;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -839,6 +817,7 @@ getJasmineRequireObj().Any = function() {
|
|||||||
|
|
||||||
return Any;
|
return Any;
|
||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().CallTracker = function() {
|
getJasmineRequireObj().CallTracker = function() {
|
||||||
|
|
||||||
function CallTracker() {
|
function CallTracker() {
|
||||||
@ -905,7 +884,8 @@ getJasmineRequireObj().Clock = function() {
|
|||||||
setInterval: setInterval,
|
setInterval: setInterval,
|
||||||
clearInterval: clearInterval
|
clearInterval: clearInterval
|
||||||
},
|
},
|
||||||
installed = false;
|
installed = false,
|
||||||
|
timer;
|
||||||
|
|
||||||
self.install = function() {
|
self.install = function() {
|
||||||
replace(global, fakeTimingFunctions);
|
replace(global, fakeTimingFunctions);
|
||||||
@ -952,7 +932,7 @@ getJasmineRequireObj().Clock = function() {
|
|||||||
if (installed) {
|
if (installed) {
|
||||||
delayedFunctionScheduler.tick(millis);
|
delayedFunctionScheduler.tick(millis);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Mock clock is not installed, use jasmine.getEnv().clock.install()");
|
throw new Error("Mock clock is not installed, use jasmine.clock().install()");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -960,8 +940,6 @@ getJasmineRequireObj().Clock = function() {
|
|||||||
|
|
||||||
function legacyIE() {
|
function legacyIE() {
|
||||||
//if these methods are polyfilled, apply will be present
|
//if these methods are polyfilled, apply will be present
|
||||||
//TODO: it may be difficult to load the polyfill before jasmine loads
|
|
||||||
//(env should be new-ed inside of onload)
|
|
||||||
return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
|
return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,12 +1141,21 @@ getJasmineRequireObj().Expectation = function() {
|
|||||||
|
|
||||||
args.unshift(this.actual);
|
args.unshift(this.actual);
|
||||||
|
|
||||||
var result = matcherFactory(this.util, this.customEqualityTesters).compare.apply(null, args);
|
var matcher = matcherFactory(this.util, this.customEqualityTesters),
|
||||||
|
matcherCompare = matcher.compare;
|
||||||
|
|
||||||
|
function defaultNegativeCompare() {
|
||||||
|
var result = matcher.compare.apply(null, args);
|
||||||
|
result.pass = !result.pass;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isNot) {
|
if (this.isNot) {
|
||||||
result.pass = !result.pass;
|
matcherCompare = matcher.negativeCompare || defaultNegativeCompare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var result = matcherCompare.apply(null, args);
|
||||||
|
|
||||||
if (!result.pass) {
|
if (!result.pass) {
|
||||||
if (!result.message) {
|
if (!result.message) {
|
||||||
args.unshift(this.isNot);
|
args.unshift(this.isNot);
|
||||||
@ -1364,8 +1351,8 @@ getJasmineRequireObj().pp = function(j$) {
|
|||||||
|
|
||||||
PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||||
for (var property in obj) {
|
for (var property in obj) {
|
||||||
if (!obj.hasOwnProperty(property)) continue;
|
if (!obj.hasOwnProperty(property)) { continue; }
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') { continue; }
|
||||||
fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
|
fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
|
||||||
obj.__lookupGetter__(property) !== null) : false);
|
obj.__lookupGetter__(property) !== null) : false);
|
||||||
}
|
}
|
||||||
@ -1522,11 +1509,11 @@ getJasmineRequireObj().ReportDispatcher = function() {
|
|||||||
|
|
||||||
for (var i = 0; i < dispatchedMethods.length; i++) {
|
for (var i = 0; i < dispatchedMethods.length; i++) {
|
||||||
var method = dispatchedMethods[i];
|
var method = dispatchedMethods[i];
|
||||||
this[method] = function(m) {
|
this[method] = (function(m) {
|
||||||
return function() {
|
return function() {
|
||||||
dispatch(m, arguments);
|
dispatch(m, arguments);
|
||||||
};
|
};
|
||||||
}(method);
|
}(method));
|
||||||
}
|
}
|
||||||
|
|
||||||
var reporters = [];
|
var reporters = [];
|
||||||
@ -1610,7 +1597,6 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
this.parentSuite = attrs.parentSuite;
|
this.parentSuite = attrs.parentSuite;
|
||||||
this.description = attrs.description;
|
this.description = attrs.description;
|
||||||
this.onStart = attrs.onStart || function() {};
|
this.onStart = attrs.onStart || function() {};
|
||||||
this.completeCallback = attrs.completeCallback || function() {}; // TODO: this is unused
|
|
||||||
this.resultCallback = attrs.resultCallback || function() {};
|
this.resultCallback = attrs.resultCallback || function() {};
|
||||||
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
||||||
|
|
||||||
@ -1619,9 +1605,7 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
this.queueRunner = attrs.queueRunner || function() {};
|
this.queueRunner = attrs.queueRunner || function() {};
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
|
|
||||||
this.children_ = []; // TODO: rename
|
this.children = [];
|
||||||
this.suites = []; // TODO: needed?
|
|
||||||
this.specs = []; // TODO: needed?
|
|
||||||
|
|
||||||
this.result = {
|
this.result = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
@ -1653,19 +1637,8 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
this.afterFns.unshift(fn);
|
this.afterFns.unshift(fn);
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.addSpec = function(spec) {
|
Suite.prototype.addChild = function(child) {
|
||||||
this.children_.push(spec);
|
this.children.push(child);
|
||||||
this.specs.push(spec); // TODO: needed?
|
|
||||||
};
|
|
||||||
|
|
||||||
Suite.prototype.addSuite = function(suite) {
|
|
||||||
suite.parentSuite = this;
|
|
||||||
this.children_.push(suite);
|
|
||||||
this.suites.push(suite); // TODO: needed?
|
|
||||||
};
|
|
||||||
|
|
||||||
Suite.prototype.children = function() {
|
|
||||||
return this.children_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Suite.prototype.execute = function(onComplete) {
|
Suite.prototype.execute = function(onComplete) {
|
||||||
@ -1675,11 +1648,10 @@ getJasmineRequireObj().Suite = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allFns = [],
|
var allFns = [];
|
||||||
children = this.children_;
|
|
||||||
|
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < this.children.length; i++) {
|
||||||
allFns.push(wrapChildAsAsync(children[i]));
|
allFns.push(wrapChildAsAsync(this.children[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onStart(this);
|
this.onStart(this);
|
||||||
@ -1727,6 +1699,7 @@ getJasmineRequireObj().Timer = function() {
|
|||||||
|
|
||||||
return Timer;
|
return Timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().matchersUtil = function(j$) {
|
getJasmineRequireObj().matchersUtil = function(j$) {
|
||||||
// TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
|
// TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
|
||||||
|
|
||||||
@ -1766,7 +1739,9 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
|
|
||||||
if (expected.length > 0) {
|
if (expected.length > 0) {
|
||||||
for (var i = 0; i < expected.length; i++) {
|
for (var i = 0; i < expected.length; i++) {
|
||||||
if (i > 0) message += ",";
|
if (i > 0) {
|
||||||
|
message += ",";
|
||||||
|
}
|
||||||
message += " " + j$.pp(expected[i]);
|
message += " " + j$.pp(expected[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1781,9 +1756,9 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
var result = true;
|
var result = true;
|
||||||
|
|
||||||
for (var i = 0; i < customTesters.length; i++) {
|
for (var i = 0; i < customTesters.length; i++) {
|
||||||
result = customTesters[i](a, b);
|
var customTesterResult = customTesters[i](a, b);
|
||||||
if (result) {
|
if (!j$.util.isUndefined(customTesterResult)) {
|
||||||
return true;
|
return customTesterResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1814,11 +1789,11 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
|
|
||||||
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
||||||
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
||||||
if (a === b) return a !== 0 || 1 / a == 1 / b;
|
if (a === b) { return a !== 0 || 1 / a == 1 / b; }
|
||||||
// A strict comparison is necessary because `null == undefined`.
|
// A strict comparison is necessary because `null == undefined`.
|
||||||
if (a === null || b === null) return a === b;
|
if (a === null || b === null) { return a === b; }
|
||||||
var className = Object.prototype.toString.call(a);
|
var className = Object.prototype.toString.call(a);
|
||||||
if (className != Object.prototype.toString.call(b)) return false;
|
if (className != Object.prototype.toString.call(b)) { return false; }
|
||||||
switch (className) {
|
switch (className) {
|
||||||
// Strings, numbers, dates, and booleans are compared by value.
|
// Strings, numbers, dates, and booleans are compared by value.
|
||||||
case '[object String]':
|
case '[object String]':
|
||||||
@ -1842,14 +1817,14 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
a.multiline == b.multiline &&
|
a.multiline == b.multiline &&
|
||||||
a.ignoreCase == b.ignoreCase;
|
a.ignoreCase == b.ignoreCase;
|
||||||
}
|
}
|
||||||
if (typeof a != 'object' || typeof b != 'object') return false;
|
if (typeof a != 'object' || typeof b != 'object') { return false; }
|
||||||
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
||||||
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
||||||
var length = aStack.length;
|
var length = aStack.length;
|
||||||
while (length--) {
|
while (length--) {
|
||||||
// Linear search. Performance is inversely proportional to the number of
|
// Linear search. Performance is inversely proportional to the number of
|
||||||
// unique nested structures.
|
// unique nested structures.
|
||||||
if (aStack[length] == a) return bStack[length] == b;
|
if (aStack[length] == a) { return bStack[length] == b; }
|
||||||
}
|
}
|
||||||
// Add the first object to the stack of traversed objects.
|
// Add the first object to the stack of traversed objects.
|
||||||
aStack.push(a);
|
aStack.push(a);
|
||||||
@ -1863,7 +1838,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
if (result) {
|
if (result) {
|
||||||
// Deep compare the contents, ignoring non-numeric properties.
|
// Deep compare the contents, ignoring non-numeric properties.
|
||||||
while (size--) {
|
while (size--) {
|
||||||
if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) break;
|
if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1880,13 +1855,13 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
// Count the expected number of properties.
|
// Count the expected number of properties.
|
||||||
size++;
|
size++;
|
||||||
// Deep compare each member.
|
// Deep compare each member.
|
||||||
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) break;
|
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ensure that both objects contain the same number of properties.
|
// Ensure that both objects contain the same number of properties.
|
||||||
if (result) {
|
if (result) {
|
||||||
for (key in b) {
|
for (key in b) {
|
||||||
if (has(b, key) && !(size--)) break;
|
if (has(b, key) && !(size--)) { break; }
|
||||||
}
|
}
|
||||||
result = !size;
|
result = !size;
|
||||||
}
|
}
|
||||||
@ -1906,6 +1881,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().toBe = function() {
|
getJasmineRequireObj().toBe = function() {
|
||||||
function toBe() {
|
function toBe() {
|
||||||
return {
|
return {
|
||||||
@ -2387,5 +2363,5 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().version = function() {
|
getJasmineRequireObj().version = function() {
|
||||||
return "2.0.0-rc3";
|
return "2.0.0-rc5";
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user