|
|
|
|
@@ -34,6 +34,11 @@ jasmine.VERBOSE = false;
|
|
|
|
|
*/
|
|
|
|
|
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum levels of nesting that will be included when an object is pretty-printed
|
|
|
|
|
*/
|
|
|
|
|
jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Default timeout interval in milliseconds for waitsFor() blocks.
|
|
|
|
|
*/
|
|
|
|
|
@@ -470,7 +475,7 @@ jasmine.log = function() {
|
|
|
|
|
* @see jasmine.createSpy
|
|
|
|
|
* @param obj
|
|
|
|
|
* @param methodName
|
|
|
|
|
* @returns a Jasmine spy that can be chained with all spy methods
|
|
|
|
|
* @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods
|
|
|
|
|
*/
|
|
|
|
|
var spyOn = function(obj, methodName) {
|
|
|
|
|
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
|
|
|
|
@@ -515,6 +520,7 @@ if (isCommonJS) exports.xit = xit;
|
|
|
|
|
* jasmine.Matchers functions.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} actual Actual value to test against and expected value
|
|
|
|
|
* @return {jasmine.Matchers}
|
|
|
|
|
*/
|
|
|
|
|
var expect = function(actual) {
|
|
|
|
|
return jasmine.getEnv().currentSpec.expect(actual);
|
|
|
|
|
@@ -1404,18 +1410,14 @@ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
|
|
|
|
|
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
|
|
|
|
}
|
|
|
|
|
this.message = function() {
|
|
|
|
|
var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was.";
|
|
|
|
|
var positiveMessage = "";
|
|
|
|
|
if (this.actual.callCount === 0) {
|
|
|
|
|
// todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
|
|
|
|
|
return [
|
|
|
|
|
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
|
|
|
|
|
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
|
|
|
|
|
];
|
|
|
|
|
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
|
|
|
|
|
} else {
|
|
|
|
|
return [
|
|
|
|
|
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
|
|
|
|
|
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
|
|
|
|
|
];
|
|
|
|
|
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '')
|
|
|
|
|
}
|
|
|
|
|
return [positiveMessage, invertedMessage];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return this.env.contains_(this.actual.argsForCall, expectedArgs);
|
|
|
|
|
@@ -1473,7 +1475,7 @@ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
|
|
|
|
* up to a given level of decimal precision (default 2).
|
|
|
|
|
*
|
|
|
|
|
* @param {Number} expected
|
|
|
|
|
* @param {Number} precision
|
|
|
|
|
* @param {Number} precision, as number of decimal places
|
|
|
|
|
*/
|
|
|
|
|
jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
|
|
|
|
|
if (!(precision === 0)) {
|
|
|
|
|
@@ -1485,7 +1487,7 @@ jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
|
|
|
|
|
/**
|
|
|
|
|
* Matcher that checks that the expected exception was thrown by the actual.
|
|
|
|
|
*
|
|
|
|
|
* @param {String} expected
|
|
|
|
|
* @param {String} [expected]
|
|
|
|
|
*/
|
|
|
|
|
jasmine.Matchers.prototype.toThrow = function(expected) {
|
|
|
|
|
var result = false;
|
|
|
|
|
@@ -1883,10 +1885,6 @@ jasmine.PrettyPrinter = function() {
|
|
|
|
|
* @param value
|
|
|
|
|
*/
|
|
|
|
|
jasmine.PrettyPrinter.prototype.format = function(value) {
|
|
|
|
|
if (this.ppNestLevel_ > 40) {
|
|
|
|
|
throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ppNestLevel_++;
|
|
|
|
|
try {
|
|
|
|
|
if (value === jasmine.undefined) {
|
|
|
|
|
@@ -1929,6 +1927,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|
|
|
|
|
|
|
|
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
|
|
|
|
for (var property in obj) {
|
|
|
|
|
if (!obj.hasOwnProperty(property)) continue;
|
|
|
|
|
if (property == '__Jasmine_been_here_before__') continue;
|
|
|
|
|
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
|
|
|
|
obj.__lookupGetter__(property) !== null) : false);
|
|
|
|
|
@@ -1956,6 +1955,11 @@ jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
|
|
|
|
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
|
|
|
|
this.append("Array");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.append('[ ');
|
|
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
@@ -1967,6 +1971,11 @@ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
|
|
|
|
|
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
|
|
|
|
this.append("Object");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
this.append('{ ');
|
|
|
|
|
var first = true;
|
|
|
|
|
@@ -2585,7 +2594,7 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
|
|
|
|
|
|
|
|
|
|
jasmine.version_= {
|
|
|
|
|
"major": 1,
|
|
|
|
|
"minor": 2,
|
|
|
|
|
"minor": 3,
|
|
|
|
|
"build": 0,
|
|
|
|
|
"revision": 1343710612
|
|
|
|
|
"revision": 1354052693
|
|
|
|
|
};
|
|
|
|
|
|