sinon-1.12.2.js revision 89092dc10fe08b037266c0b4efb94b221f6fffb3
/**
* Sinon.JS 1.12.2, 2014/12/12
*
* @author Christian Johansen (christian@cjohansen.no)
* @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
*
* (The BSD License)
*
* Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* * Neither the name of Christian Johansen nor the names of his contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
define([], function () {
});
} else if (typeof exports === 'object') {
} else {
}
}(this, function () {
(function () {
if (mod == "samsam") {
} else if (typeof fn === "function") {
}
}
(typeof module === "object" &&
function (m) { this.samsam = m(); } // Browser globals
)(function () {
var o = Object.prototype;
// Unlike global isNaN, this avoids type coercion
// typeof check avoids IE host object issues, hat tip to
// lodash
}
// Returns the internal [[Class]] by calling Object.prototype.toString
// with the provided value as this. Return value is a string, naming the
// internal class, e.g. "Array"
}
/**
* @name samsam.isArguments
* @param Object object
*
* Returns ``true`` if ``object`` is an ``arguments`` object,
* ``false`` otherwise.
*/
function isArguments(object) {
return false;
}
try {
} catch (e) {
return true;
}
return false;
}
/**
* @name samsam.isElement
* @param Object object
*
* Returns ``true`` if ``object`` is a DOM element node. Unlike
* Underscore.js/lodash, this function will return ``false`` if ``object``
* is an *element-like* object, i.e. a regular object with a ``nodeType``
* property that holds the value ``1``.
*/
try {
} catch (e) {
return false;
}
return true;
}
/**
* @name samsam.keys
* @param Object object
*
* Return an array of own property names.
*/
}
return ks;
}
/**
* @name samsam.isDate
* @param Object value
*
* Returns true if the object is a ``Date``, or *date-like*. Duck typing
* of date objects work by checking that the object has a ``getTime``
* function whose return value equals the return value from the object's
* ``valueOf``.
*/
}
/**
* @name samsam.isNegZero
* @param Object value
*
* Returns ``true`` if ``value`` is ``-0``.
*/
}
/**
* @name samsam.equal
* @param Object obj1
* @param Object obj2
*
* Returns ``true`` if two objects are strictly equal. Compared to
* ``===`` there are two exceptions:
*
* - NaN is considered equal to NaN
* - -0 and +0 are not considered equal
*/
}
}
/**
* @name samsam.deepEqual
* @param Object obj1
* @param Object obj2
*
* Deep equal comparison. Two values are "deep equal" if:
*
* - They are equal, according to samsam.identical
* - They are both date objects representing the same time
* - They are both arrays containing elements that are all deepEqual
* - They are objects with the same set of properties, and each property
* in ``obj1`` is deepEqual to the corresponding property in ``obj2``
*
* Supports cyclic objects.
*/
// used for cyclic comparison
// contain already visited objects
var objects1 = [],
objects2 = [],
// contain pathes (position in the object structure)
// of the already visited objects
// indexes same as in objects arrays
paths1 = [],
paths2 = [],
// contains combinations of already compared objects
// in the manner: { "$1['ref']$2['ref']": true }
compared = {};
/**
* used to check, if the value of a property is an object
* (cyclic logic is only needed for objects)
* only needed for cyclic logic
*/
!(value instanceof Boolean) &&
!(value instanceof Date) &&
!(value instanceof Number) &&
!(value instanceof RegExp) &&
!(value instanceof String)) {
return true;
}
return false;
}
/**
* returns the index of the given object in the
* given objects array, -1 if not contained
* only needed for cyclic logic
*/
var i;
return i;
}
}
return -1;
}
// does the recursion for the deep equal check
// == null also matches undefined
}
// Elements are only equal if identical(expected, actual)
return false;
}
}
}
} else {
return false;
}
}
var key, i, l,
// following vars are used for the cyclic logic
return false;
}
// Start of the cyclic logic
// determine, if the objects were already visited
// (it's faster to check for isObject first, than to
// get -1 from getIndex for non objects)
// determine the new pathes of the objects
// - for non cyclic objects the current path will be extended
// by current property name
// - for cyclic objects the stored path is taken
// stop recursion if current objects are already compared
return true;
}
// remember the current objects and their pathes
}
}
// remember that the current objects are already compared
}
// End of cyclic logic
// neither value1 nor value2 is a cycle
// continue with next level
return false;
}
}
return true;
}
var match;
var i, l, j, k;
}
return true;
}
}
return false;
}
/**
* @name samsam.match
* @param Object object
* @param Object matcher
*
* Compare arbitrary value ``object`` with matcher.
*/
}
if (typeof matcher === "function") {
}
if (typeof matcher === "string") {
return notNull &&
}
if (typeof matcher === "number") {
}
if (typeof matcher === "boolean") {
}
if (typeof(matcher) === "undefined") {
return typeof(object) === "undefined";
}
if (matcher === null) {
return object === null;
}
}
return true;
}
var prop;
if (typeof value === "undefined" &&
}
return false;
}
return false;
}
}
return true;
}
throw new Error("Matcher was not a string, a number, a " +
"function, a boolean or an object");
};
return {
};
});
}) || (typeof module === "object" && function (m) {
)(function (samsam) {
var formatio = {
excludeConstructors: ["Object", /^.$/],
quoteStrings: true,
};
var specialObjects = [];
if (typeof global !== "undefined") {
}
if (typeof document !== "undefined") {
value: "[object HTMLDocument]"
});
}
if (typeof window !== "undefined") {
}
function functionName(func) {
if (!func) { return ""; }
}
function constructorName(f, object) {
var excludes = f.excludeConstructors ||
formatio.excludeConstructors || [];
var i, l;
return "";
return "";
}
}
return name;
}
if (typeof object !== "object") { return false; }
var i, l;
}
return false;
}
if (typeof object === "string") {
var qs = f.quoteStrings;
}
}
}
}
var i, l;
return specialObjects[i].value;
}
}
}
};
var pieces = [];
var i, l;
l = (this.limitChildrenCount > 0) ?
for (i = 0; i < l; ++i) {
}
};
var length = 3;
l = (this.limitChildrenCount > 0) ?
for (i = 0; i < l; ++i) {
prop = properties[i];
str = "[Circular]";
} else {
}
}
var is = "";
if(l < properties.length)
is + "}";
}
};
}
}
}
};
}
}
},
constructorName: function (object) {
return constructorName(this, object);
},
}
};
});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.lolex=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/
/*global global*/
/**
* @author Christian Johansen (christian@cjohansen.no) and contributors
* @license BSD
*
* Copyright (c) 2010-2014 Christian Johansen
*/
// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref()
// browsers, a number.
var NativeDate = Date;
var id = 1;
/**
* Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into
* number of milliseconds. This is used to support human-readable strings passed
* to clock.tick()
*/
if (!str) {
return 0;
}
throw new Error("tick only understands numbers and 'h:m:s'");
}
while (i--) {
if (parsed >= 60) {
}
}
return ms * 1000;
}
/**
* Used to grok the `now` parameter to createClock.
*/
if (!epoch) { return 0; }
throw new TypeError("now should be milliseconds since UNIX epoch");
}
}
};
} else {
}
};
} else {
}
};
}
}
return target;
}
function createDate() {
// Defensive and verbose to avoid potential harm in passing
// explicit undefined when user does not pass argument
case 0:
case 1:
return new NativeDate(year);
case 2:
case 3:
case 4:
case 5:
case 6:
default:
}
}
}
throw new Error("Callback must be provided to timer calls");
}
}
if (addTimerReturnsObject) {
return {
ref: function() {},
unref: function() {}
};
}
else {
}
}
continue;
}
}
}
return timer;
}
function compareTimers(a, b) {
// Sort first by absolute timing
return -1;
}
return 1;
}
// Sort next by immediate, immediate timers take precedence
return -1;
}
return 1;
}
// Sort next by creation time, earlier-created timers take precedence
return -1;
}
return 1;
}
// Sort next by id, lower-id timers take precedence
return -1;
}
return 1;
}
// As timer ids are unique, no fallback `0` is necessary
}
} else {
}
try {
} else {
}
} catch (e) {
var exception = e;
}
if (exception) {
throw exception;
}
return;
}
if (exception) {
throw exception;
}
}
var method;
} else {
try {
} catch (e) {}
}
}
// Prevent multiple executions which will completely remove these props
}
if (method == "Date") {
} else {
};
}
}
}
}
var timers = {
Date: Date
};
var ks = [];
}
return ks;
};
var clock = {
timeouts: {},
Date: createDate()
};
});
};
if (!timerId) {
// null appears to be allowed in most browsers, and appears to be
// relied upon by some libraries, like Bootstrap carousel
return;
}
}
// in Node, timerId is an object with .ref()/.unref(), and
// its .id field is the actual timer id.
if (typeof timerId === "object") {
}
}
};
});
};
};
immediate: true
});
};
};
var firstException;
try {
} catch (e) {
firstException = firstException || e;
}
}
}
if (firstException) {
throw firstException;
}
};
};
return clock;
};
if (typeof target === "number") {
target = null;
}
if (!target) {
}
};
}
}
return clock;
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1])(1)
});
})();
var define;
/**
* Sinon core utilities. For internal use only.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
var sinon = (function () {
"use strict";
var sinon;
require("./sinon/times_in_words");
require("./sinon/collection");
}
if (isAMD) {
} else if (isNode) {
} else {
sinon = {};
}
return sinon;
}());
/**
* @depend ../../sinon.js
*/
/**
* Sinon core utilities. For internal use only.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
var success = false;
try {
} catch (e) {
return false;
} finally {
try {
} catch (e) {
// Remove failed, not much we can do about that
}
}
return success;
}
}
function isFunction(obj) {
}
function isReallyNaN(val) {
}
}
}
}
function isRestorable(obj) {
}
if (!object) {
throw new TypeError("Should wrap property of object");
}
if (typeof method != "function") {
throw new TypeError("Method wrapper should be function");
}
if (!isFunction(wrappedMethod)) {
property + " as function");
} else if (wrappedMethod.calledBefore) {
}
if (error) {
}
throw error;
}
// IE 8 does not support hasOwnProperty on the window object and Firefox has a problem
// when using hasOwn.call on objects from other frames.
var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property);
// Set up a stack trace which can be used later to find what line of
// code the original method was created on.
// For prototype properties try to reset by delete first.
// If this fails (ex: localStorage on mobile safari) then force a reset
// via direct assignment.
if (!owned) {
}
}
};
return method;
};
var F = function () {};
return new F();
};
return a.test(b);
}
if (typeof a != "object" || typeof b != "object") {
if (isReallyNaN(a) && isReallyNaN(b)) {
return true;
} else {
return a === b;
}
}
return a === b;
}
if (a === b) {
return true;
}
if ((a === null && b !== null) || (a !== null && b === null)) {
return false;
}
if (a instanceof RegExp && b instanceof RegExp) {
}
return false;
}
if (aString == "[object Date]") {
}
return false;
}
for (prop in a) {
aLength += 1;
if (!(prop in b)) {
return false;
}
return false;
}
}
for (prop in b) {
bLength += 1;
}
};
// Use function decomposition as a last resort to get function
// name. Does not rely on function decomposition to work - if it
// doesn't debugging will be slightly less informative
// (i.e. toString will say 'spy' rather than 'myFunc').
if (!name) {
}
return name;
};
while (i--) {
return prop;
}
}
}
}
return this.displayName || "sinon fake";
};
var config = {};
}
}
return config;
};
sinon.defaultConfig = {
injectIntoThis: true,
injectInto: null,
useFakeTimers: true,
useFakeServer: true
};
};
return false;
}
}
return true;
};
// uuid, won't ever be equal
});
};
if (typeof constructor !== "function") {
throw new TypeError("The constructor should be a function.");
}
};
}
}
} else if (isRestorable(object)) {
}
};
return sinon;
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend ../sinon.js
*/
(function (sinon) {
// Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
var hasDontEnumBug = (function () {
var obj = {
constructor: function () {
return "0";
},
toString: function () {
return "1";
},
valueOf: function () {
return "2";
},
toLocaleString: function () {
return "3";
},
prototype: function () {
return "4";
},
isPrototypeOf: function () {
return "5";
},
propertyIsEnumerable: function () {
return "6";
},
hasOwnProperty: function () {
return "7";
},
length: function () {
return "8";
},
unique: function () {
return "9"
}
};
var result = [];
}
})();
/* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
* override properties in previous sources.
*
* target - The Object to extend
* sources - Objects to copy properties from.
*
* Returns the extended target
*/
}
}
// Make sure we copy (own) toString method even when in JScript with DontEnum bug
// See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
}
}
return target;
};
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend ../sinon.js
*/
(function (sinon) {
function timesInWords(count) {
switch (count) {
case 1:
return "once";
case 2:
return "twice";
case 3:
return "thrice";
default:
}
}
return sinon.timesInWords;
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend ../sinon.js
*/
/**
* Format functions
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2014 Christian Johansen
*/
if (value === null) {
return "null";
return "undefined";
}
};
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
}(
));
/**
* @depend typeOf.js
*/
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
/*global module, require, sinon*/
/**
* Match functions
*
* @author Maximilian Antoni (mail@maxantoni.de)
* @license BSD
*
* Copyright (c) 2012 Maximilian Antoni
*/
(function (sinon) {
}
}
var matcher = {
toString: function () {
return this.message;
}
};
}
return false;
}
for (var key in expectation) {
return false;
}
return false;
}
return false;
}
}
}
return true;
}
throw new TypeError("Matcher expected");
}
var m1 = this;
};
return or;
};
throw new TypeError("Matcher expected");
}
var m1 = this;
};
return and;
};
switch (type) {
case "object":
};
return m;
}
var str = [];
for (var key in expectation) {
}
}
};
break;
case "number":
return expectation == actual;
};
break;
case "string":
if (typeof actual !== "string") {
return false;
}
};
break;
case "regexp":
if (typeof actual !== "string") {
return false;
}
};
break;
case "function":
m.test = expectation;
if (message) {
} else {
}
break;
default:
};
}
if (!m.message) {
}
return m;
};
return true;
}, "any");
}, "defined");
return !!actual;
}, "truthy");
return !actual;
}, "falsy");
return expectation === actual;
};
};
};
if (!onlyProperty) {
}
message += ")";
return false;
}
}, message);
};
}
if (typeof actual === "object") {
}
}, "has");
}, "hasOwn");
return match;
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend ../sinon.js
*/
/**
* Format functions
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2014 Christian Johansen
*/
function valueFormatter(value) {
return "" + value;
}
function getFormatioFormatter() {
quoteStrings: false,
limitChildrenCount: 250
});
function format() {
};
return format;
}
function getNodeFormatter(value) {
return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
};
try {
} catch (e) {
/* Node, but no util module - would be very old, but better safe than sorry */
}
}
if (isNode) {
try {
} catch (e) {}
}
if (formatio) {
} else if (isNode) {
} else {
}
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
}(
));
/**
* @depend match.js
* @depend format.js
*/
/**
* Spy calls
*
* @author Christian Johansen (christian@cjohansen.no)
* @author Maximilian Antoni (mail@maxantoni.de)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
* Copyright (c) 2013 Maximilian Antoni
*/
(function (sinon) {
}
}
var callProto = {
}
},
calledWith: function calledWith() {
return false;
}
}
return true;
},
calledWithMatch: function calledWithMatch() {
var expectation = arguments[i];
return false;
}
}
return true;
},
calledWithExactly: function calledWithExactly() {
},
notCalledWith: function notCalledWith() {
},
notCalledWithMatch: function notCalledWithMatch() {
},
},
return !!this.exception;
}
},
calledWithNew: function calledWithNew() {
},
calledBefore: function (other) {
},
calledAfter: function (other) {
},
},
},
callArgWith: function (pos) {
},
},
yield: function () {
},
if (typeof args[i] === "function") {
return;
}
}
},
},
return;
}
}
"' since no callback was passed.", args);
},
toString: function () {
var args = [];
}
if (typeof this.returnValue != "undefined") {
}
if (this.exception) {
}
}
return callStr;
}
};
if (typeof id !== "number") {
throw new TypeError("Call id is not a number");
}
return proxyCall;
}
return createSpyCall;
}
require("./match");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend times_in_words.js
* @depend extend.js
* @depend call.js
* @depend format.js
*/
/**
* Spy functions
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
var callId = 0;
}
}
}
if (!fakes) {
return;
}
return fakes[i];
}
}
}
function incrementCallCount() {
this.called = true;
this.callCount += 1;
this.notCalled = false;
}
function createCallProperties() {
}
var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
function createProxy(func) {
// Retain the function length:
var p;
") { return p.invoke(func, this, slice.call(arguments)); });");
} else {
p = function proxy() {
};
}
return p;
}
var uuid = 0;
// Public API
var spyApi = {
reset: function () {
if (this.invoking) {
"Move the call to .reset outside of the callback.");
throw err;
}
this.called = false;
this.notCalled = true;
this.calledOnce = false;
this.calledTwice = false;
this.calledThrice = false;
this.callCount = 0;
this.firstCall = null;
this.secondCall = null;
this.thirdCall = null;
this.lastCall = null;
this.args = [];
this.returnValues = [];
this.thisValues = [];
this.exceptions = [];
this.callIds = [];
if (this.fakes) {
}
}
},
var name;
if (typeof func != "function") {
func = function () { };
} else {
}
return proxy;
},
var exception, returnValue;
incrementCallCount.call(this);
// Make call properties available from within the spied function:
createCallProperties.call(this);
try {
this.invoking = true;
if (matching) {
} else {
}
}
} catch (e) {
exception = e;
} finally {
delete this.invoking;
}
// Make return value and exception available in the calls:
createCallProperties.call(this);
throw exception;
}
return returnValue;
},
this.displayName = name;
return this;
},
if (i < 0 || i >= this.callCount) {
return null;
}
this.returnValues[i], this.exceptions[i],
this.callIds[i]);
},
getCalls: function () {
var calls = [];
var i;
for (i = 0; i < this.callCount; i++) {
}
return calls;
},
if (!this.called) {
return false;
}
return true;
}
},
return false;
}
},
withArgs: function () {
if (this.fakes) {
if (match) {
return match;
}
} else {
this.fakes = [];
}
var original = this;
var fake = this.instantiateFake();
};
}
}
return fake;
},
var margs = this.matchingAguments;
}
},
var spy = this;
var formatter;
if (typeof formatter == "function") {
}
return "%" + specifyer;
});
}
};
if (!this.called) {
if (notCalled) {
}
return false;
}
var currentCall;
var matches = 0;
currentCall = this.getCall(i);
matches += 1;
if (matchAny) {
return true;
}
}
}
};
}
delegateToCalls("calledOn", true);
delegateToCalls("calledWith", true);
delegateToCalls("calledWithMatch", true);
delegateToCalls("calledWithExactly", true);
function () { return true; });
function () { return true; });
delegateToCalls("threw", true);
delegateToCalls("returned", true);
delegateToCalls("calledWithNew", true);
});
});
});
// "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
});
"' since it was not yet invoked.");
});
"' since it was not yet invoked.");
});
spyApi.formatters = {
c: function (spy) {
},
n: function (spy) {
},
C: function (spy) {
var calls = [];
}
}
},
t: function (spy) {
var objects = [];
}
},
var formatted = [];
}
}
};
return spy;
}
require("./call");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend extend.js
*/
/**
* Stub behavior
*
* @author Christian Johansen (christian@cjohansen.no)
* @author Tim Fischbach (mail@timfischbach.de)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
var nextTick = (function () {
} else if (typeof setImmediate === "function") {
return setImmediate;
} else {
return function (callback) {
};
}
})();
if (typeof error == "string") {
} else if (!error) {
} else {
}
return this;
}
if (callArgAt < 0) {
return args[i];
}
if (callArgProp && args[i] &&
return args[i][callArgProp];
}
}
return null;
}
}
var msg;
if (behavior.callArgProp) {
"', but no object with such a property was passed.";
} else {
" expected to yield, but no callback was passed.";
}
}
return msg;
}
}
if (typeof func != "function") {
}
if (behavior.callbackAsync) {
nextTick(function () {
});
} else {
}
}
}
var proto = {
return behavior;
},
return (typeof this.callArgAt == "number" ||
this.exception ||
typeof this.returnArgAt == "number" ||
this.returnThis ||
this.returnValueDefined);
},
callCallback(this, args);
if (this.exception) {
throw this.exception;
} else if (typeof this.returnArgAt == "number") {
return args[this.returnArgAt];
} else if (this.returnThis) {
return context;
}
return this.returnValue;
},
},
onFirstCall: function onFirstCall() {
return this.stub.onFirstCall();
},
onSecondCall: function onSecondCall() {
return this.stub.onSecondCall();
},
onThirdCall: function onThirdCall() {
return this.stub.onThirdCall();
},
throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " +
"Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments.");
},
if (typeof pos != "number") {
throw new TypeError("argument index is not number");
}
this.callbackArguments = [];
this.callbackContext = undefined;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
if (typeof pos != "number") {
throw new TypeError("argument index is not number");
}
if (typeof context != "object") {
throw new TypeError("argument context is not an object");
}
this.callbackArguments = [];
this.callbackContext = context;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
if (typeof pos != "number") {
throw new TypeError("argument index is not number");
}
this.callbackContext = undefined;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
if (typeof pos != "number") {
throw new TypeError("argument index is not number");
}
if (typeof context != "object") {
throw new TypeError("argument context is not an object");
}
this.callbackContext = context;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
yields: function () {
this.callArgAt = -1;
this.callbackContext = undefined;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
if (typeof context != "object") {
throw new TypeError("argument context is not an object");
}
this.callArgAt = -1;
this.callbackContext = context;
this.callArgProp = undefined;
this.callbackAsync = false;
return this;
},
this.callArgAt = -1;
this.callbackContext = undefined;
this.callArgProp = prop;
this.callbackAsync = false;
return this;
},
if (typeof context != "object") {
throw new TypeError("argument context is not an object");
}
this.callArgAt = -1;
this.callbackContext = context;
this.callArgProp = prop;
this.callbackAsync = false;
return this;
},
this.returnValue = value;
this.returnValueDefined = true;
return this;
},
if (typeof pos != "number") {
throw new TypeError("argument index is not number");
}
this.returnArgAt = pos;
return this;
},
returnsThis: function returnsThis() {
this.returnThis = true;
return this;
}
};
// create asynchronous versions of callsArg* and yields* methods
// need to avoid creating anotherasync versions of the newly added async methods
return function () {
this.callbackAsync = true;
return result;
};
})(method);
}
}
return proto;
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend extend.js
* @depend spy.js
* @depend behavior.js
*/
/**
* Stub functions
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
throw new TypeError("Custom stub should be function");
}
var wrapper;
if (func) {
} else {
}
}
}
}
return object;
}
}
function getDefaultBehavior(stub) {
}
function getParentBehaviour(stub) {
}
function getCurrentBehavior(stub) {
}
var uuid = 0;
var proto = {
var functionStub = function () {
};
var orig = functionStub;
functionStub.defaultBehavior = null;
functionStub.behaviors = [];
return functionStub;
},
resetBehavior: function () {
var i;
this.defaultBehavior = null;
this.behaviors = [];
delete this.returnValue;
delete this.returnArgAt;
this.returnThis = false;
if (this.fakes) {
this.fakes[i].resetBehavior();
}
}
},
}
},
onFirstCall: function onFirstCall() {
return this.onCall(0);
},
onSecondCall: function onSecondCall() {
return this.onCall(1);
},
onThirdCall: function onThirdCall() {
return this.onCall(2);
}
};
method != "create" &&
method != "withArgs" &&
method != "invoke") {
return function () {
return this;
};
}(method));
}
}
return stub;
}
require("./behavior");
require("./spy");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend times_in_words.js
* @depend extend.js
* @depend stub.js
* @depend format.js
*/
/**
* Mock functions.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
if (!object) {
}
}
if (!collection) {
return;
}
callback(collection[i]);
}
}
if (!object) {
throw new TypeError("object is null");
}
delete mockObject.create;
return mockObject;
},
if (!method) {
throw new TypeError("method is falsy");
}
if (!this.expectations) {
this.expectations = {};
this.proxies = [];
}
if (!this.expectations[method]) {
this.expectations[method] = [];
var mockObject = this;
});
}
return expectation;
},
}
});
},
var expectations = this.expectations || {};
if (!expectation.met()) {
} else {
}
});
});
this.restore();
}
return true;
},
if (!expectations[i].met() &&
}
}
} else {
exhausted += 1;
}
}
if (exhausted === 0) {
}
}));
}
});
function callCountInWords(callCount) {
if (callCount == 0) {
return "never called";
} else {
}
}
function expectedCallCountInWords(expectation) {
}
return str;
}
if (typeof min == "number") {
}
}
function receivedMinCalls(expectation) {
}
function receivedMaxCalls(expectation) {
return false;
}
}
} else {
return true;
}
}
sinon.expectation = {
minCalls: 1,
maxCalls: 1,
delete expectation.create;
return expectation;
},
},
if (typeof num != "number") {
}
if (!this.limitsSet) {
this.maxCalls = null;
this.limitsSet = true;
}
return this;
},
if (typeof num != "number") {
}
if (!this.limitsSet) {
this.minCalls = null;
this.limitsSet = true;
}
return this;
},
return this.exactly(0);
},
return this.exactly(1);
},
return this.exactly(2);
},
return this.exactly(3);
},
if (typeof num != "number") {
}
},
return !this.failed && receivedMinCalls(this);
},
if (receivedMaxCalls(this)) {
this.failed = true;
}
this.expectedThis);
}
if (!("expectedArguments" in this)) {
return;
}
if (!args) {
}
}
if (this.expectsExactArgCount &&
}
}
}
}
},
if (this.met() && receivedMaxCalls(this)) {
return false;
}
return false;
}
if (!("expectedArguments" in this)) {
return true;
}
return false;
}
if (this.expectsExactArgCount &&
return false;
}
return false;
}
return false;
}
}
return true;
},
return this;
},
withExactArgs: function withExactArgs() {
this.expectsExactArgCount = true;
return this;
},
this.expectedThis = thisValue;
return this;
},
toString: function () {
if (!this.expectsExactArgCount) {
}
});
expectedCallCountInWords(this);
if (this.met()) {
return "Expectation met: " + message;
}
},
if (!this.met()) {
} else {
}
return true;
},
},
throw exception;
}
};
return mock;
}
require("./call");
require("./match");
require("./spy");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend stub.js
* @depend mock.js
*/
/**
* Collections of stubs, spies and mocks.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
function getFakes(fakeCollection) {
if (!fakeCollection.fakes) {
fakeCollection.fakes = [];
}
return fakeCollection.fakes;
}
}
}
}
function compact(fakeCollection) {
var i = 0;
}
}
var collection = {
each(this, "verify");
},
each(this, "restore");
compact(this);
},
each(this, "reset");
},
verifyAndRestore: function verifyAndRestore() {
var exception;
try {
this.verify();
} catch (e) {
exception = e;
}
this.restore();
if (exception) {
throw exception;
}
},
return fake;
},
},
if (property) {
if (typeof original != "function") {
}
return this.add({
restore: function () {
}
});
}
}
for (var prop in stubbedObj) {
}
}
return stubbedObj;
}
},
},
var col = this;
};
};
};
return obj;
}
};
return collection;
}
require("./mock");
require("./spy");
require("./stub");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/*global lolex */
/**
* Fake timer API
* setTimeout
* setInterval
* clearTimeout
* clearInterval
* tick
* reset
* Date
*
* Inspired by jsUnitMockTimeOut from JsUnit
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
if (typeof sinon == "undefined") {
var sinon = {};
}
(function (global) {
sinon.useFakeTimers = function () {
now = 0;
} else {
}
return clock;
};
}
};
Date: Date
};
}
}
if (isAMD) {
} else if (isNode) {
} else {
}
/**
* Minimal Event interface implementation
*
* Original implementation by Sven Fuchs: https://gist.github.com/995028
* Modifications and tests by Christian Johansen.
*
* @author Sven Fuchs (svenfuchs@artweb-design.de)
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2011 Sven Fuchs, Christian Johansen
*/
if (typeof sinon == "undefined") {
this.sinon = {};
}
(function () {
};
this.cancelable = cancelable;
},
stopPropagation: function () {},
preventDefault: function () {
this.defaultPrevented = true;
}
};
};
};
sinon.EventTarget = {
this.eventListeners = this.eventListeners || {};
},
}
}
},
if (typeof listeners[i] == "function") {
} else {
}
}
return !!event.defaultPrevented;
}
};
}
function loadDependencies(require) {
}
if (isAMD) {
} else if (isNode) {
} else {
}
}());
/**
* @depend ../sinon.js
*/
/**
* Logs errors
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2014 Christian Johansen
*/
(function (sinon) {
// cache a reference to setTimeout, so that our reference won't be stubbed out
// when using fake timers and errors will still get logged
var realSetTimeout = setTimeout;
function log() {}
}
logError.setTimeout(function () {
throw err;
}, 0);
};
// wrap realSetTimeout with something we can stub in tests
}
var exports = {};
return exports;
}
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend core.js
* @depend ../extend.js
* @depend event.js
* @depend ../log_error.js
*/
/**
* Fake XMLHttpRequest object
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (global) {
sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX
sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest());
/*jsl:ignore*/
var unsafeHeaders = {
"Accept-Charset": true,
"Accept-Encoding": true,
Connection: true,
"Content-Length": true,
Cookie: true,
Cookie2: true,
"Content-Transfer-Encoding": true,
Date: true,
Expect: true,
Host: true,
"Keep-Alive": true,
Referer: true,
TE: true,
Trailer: true,
"Transfer-Encoding": true,
Upgrade: true,
"User-Agent": true,
Via: true
};
/*jsl:end*/
function FakeXMLHttpRequest() {
this.requestHeaders = {};
this.requestBody = null;
this.status = 0;
this.statusText = "";
this.upload = new UploadProgress();
if (sinonXhr.supportsCORS) {
this.withCredentials = false;
}
var xhr = this;
function addEventListener(eventName) {
}
});
}
addEventListener(events[i]);
}
FakeXMLHttpRequest.onCreate(this);
}
}
// An upload object is created for each
// FakeXMLHttpRequest and allows upload
// events to be simulated using uploadProgress
// and uploadError.
function UploadProgress() {
this.eventListeners = {
progress: [],
load: [],
abort: [],
error: []
}
}
};
}
}
};
}
};
function verifyState(xhr) {
throw new Error("INVALID_STATE_ERR");
}
throw new Error("INVALID_STATE_ERR");
}
}
for (var h in headers) {
if (h.toLowerCase() == header) {
return h;
}
}
return null;
}
// filtering to enable a white-list version of Sinon FakeXhr,
// where whitelisted requests are passed through to real XHR
if (!collection) {
return;
}
callback(collection[i]);
}
}
return true;
}
}
return false;
}
// largest arity in XHR is 5 - XHR#open
}
};
FakeXMLHttpRequest.filters = [];
};
each([
"open",
"setRequestHeader",
"send",
"abort",
"getResponseHeader",
"getAllResponseHeaders",
"addEventListener",
"overrideMimeType",
"removeEventListener"
], function (method) {
};
});
try {
} catch (e) {
throw e;
}
}
});
};
var stateChange = function stateChange() {
}
}
copyAttrs(["responseXML"]);
}
if (fakeXhr.onreadystatechange) {
}
};
if (xhr.addEventListener) {
});
}
}
} else {
}
};
FakeXMLHttpRequest.useFilters = false;
function verifyRequestOpened(xhr) {
}
}
function verifyRequestSent(xhr) {
throw new Error("Request done");
}
}
function verifyHeadersReceived(xhr) {
throw new Error("No headers received");
}
}
function verifyResponseBodyType(body) {
if (typeof body != "string") {
body + ", which is not a string.");
throw error;
}
}
var xmlDoc;
if (typeof DOMParser != "undefined") {
} else {
}
return xmlDoc;
};
100: "Continue",
101: "Switching Protocols",
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
206: "Partial Content",
207: "Multi-Status",
300: "Multiple Choice",
301: "Moved Permanently",
302: "Found",
303: "See Other",
304: "Not Modified",
305: "Use Proxy",
307: "Temporary Redirect",
400: "Bad Request",
401: "Unauthorized",
402: "Payment Required",
403: "Forbidden",
404: "Not Found",
405: "Method Not Allowed",
406: "Not Acceptable",
407: "Proxy Authentication Required",
408: "Request Timeout",
409: "Conflict",
410: "Gone",
411: "Length Required",
412: "Precondition Failed",
413: "Request Entity Too Large",
414: "Request-URI Too Long",
415: "Unsupported Media Type",
416: "Requested Range Not Satisfiable",
417: "Expectation Failed",
422: "Unprocessable Entity",
500: "Internal Server Error",
501: "Not Implemented",
502: "Bad Gateway",
503: "Service Unavailable",
504: "Gateway Timeout",
505: "HTTP Version Not Supported"
};
async: true,
this.responseText = null;
this.responseXML = null;
this.requestHeaders = {};
this.sendFlag = false;
if (FakeXMLHttpRequest.useFilters === true) {
});
if (defake) {
}
}
},
this.readyState = state;
if (typeof this.onreadystatechange == "function") {
try {
this.onreadystatechange();
} catch (e) {
}
}
switch (this.readyState) {
case FakeXMLHttpRequest.DONE:
if (supportsProgress) {
}
break;
}
},
verifyState(this);
}
if (this.requestHeaders[header]) {
} else {
}
},
// Helps testing
verifyRequestOpened(this);
this.responseHeaders = {};
}
}
if (this.async) {
} else {
}
},
// Currently treats ALL data as a DOMString (i.e. no Document)
verifyState(this);
if (this.requestHeaders[contentType]) {
} else {
}
this.requestBody = data;
}
this.errorFlag = false;
if (typeof this.onSend == "function") {
this.onSend(this);
}
},
this.aborted = true;
this.responseText = null;
this.errorFlag = true;
this.requestHeaders = {};
this.sendFlag = false;
}
if (typeof this.onerror === "function") {
this.onerror();
}
},
return null;
}
return null;
}
return this.responseHeaders[header] || null;
},
getAllResponseHeaders: function getAllResponseHeaders() {
return "";
}
var headers = "";
for (var header in this.responseHeaders) {
}
}
return headers;
},
verifyRequestSent(this);
verifyHeadersReceived(this);
var index = 0;
this.responseText = "";
do {
if (this.async) {
}
if (this.responseText &&
try {
} catch (e) {
// Unable to parse XML - no biggie
}
}
},
this.setResponseHeaders(headers || {});
},
if (supportsProgress) {
}
},
if (supportsCustomEvent) {
}
}
});
UNSENT: 0,
OPENED: 1,
HEADERS_RECEIVED: 2,
LOADING: 3,
DONE: 4
});
sinon.useFakeXMLHttpRequest = function () {
if (sinonXhr.supportsXHR) {
}
if (sinonXhr.supportsActiveX) {
}
delete FakeXMLHttpRequest.restore;
if (keepOnCreate !== true) {
delete FakeXMLHttpRequest.onCreate;
}
};
if (sinonXhr.supportsXHR) {
}
if (sinonXhr.supportsActiveX) {
return new FakeXMLHttpRequest();
}
};
}
return FakeXMLHttpRequest;
};
}
require("./event");
}
if (isAMD) {
} else if (isNode) {
} else if (typeof sinon === "undefined") {
return;
} else {
}
/**
* @depend fake_xml_http_request.js
* @depend ../format.js
* @depend ../log_error.js
*/
/**
* The Sinon "server" mimics a web server that receives requests from
* sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
* both synchronously and asynchronously. To respond synchronuously, canned
* answers have to be provided upfront.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
if (typeof sinon == "undefined") {
var sinon = {};
}
(function () {
function F() {}
return new F();
}
function responseArray(handler) {
}
throw new TypeError("Fake server response body should be string, but was " +
typeof response[2]);
}
return response;
}
return matchMethod && matchUrl;
}
if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
}
var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
}
return true;
}
return false;
}
sinon.fakeServer = {
create: function () {
};
return server;
},
var server = this;
server.handleRequest(this);
setTimeout(function () {
server.responding = false;
server.responding = true;
}
};
},
}
},
if (!this.queue) {
this.queue = [];
}
} else {
this.processRequest(xhr);
}
},
var str;
},
return;
}
}
method = null;
}
});
},
}
var request;
this.processRequest(request);
}
},
try {
return;
}
if (this.responses) {
break;
}
}
}
}
} catch (e) {
}
},
}
};
}
require("./fake_xml_http_request");
}
if (isAMD) {
} else if (isNode) {
} else {
}
}());
/**
* @depend fake_server.js
* @depend fake_timers.js
*/
/**
* Add-on for sinon.fakeServer that automatically handles a fake timer along with
* the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
* 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
* it polls the object for completion with setInterval. Dispite the direct
* motivation, there is nothing jQuery-specific in this file, so it can be used
* in any environment where the ajax implementation depends on setInterval or
* setTimeout.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function () {
function Server() {}
} else {
this.resetClock = true;
}
if (!this.longestTimeout) {
var server = this;
};
};
}
}
};
if (this.clock) {
this.longestTimeout = 0;
if (this.resetClock) {
this.resetClock = false;
}
}
return returnVal;
};
if (this.clock) {
}
};
}
function loadDependencies(require) {
require("./fake_server");
require("./fake_timers");
}
if (isAMD) {
} else if (isNode) {
} else {
}
}());
/**
* @depend extend.js
* @depend collection.js
* @depend util/fake_timers.js
* @depend util/fake_server_with_clock.js
*/
/**
* Manages fake collections as well as fake utilities such as Sinon's
* timers and fake XHR implementation in one convenient object.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function () {
if (!value) {
return;
}
} else {
}
}
function prepareSandboxFromConfig(config) {
if (config.useFakeServer) {
}
}
if (config.useFakeTimers) {
} else {
}
}
return sandbox;
}
useFakeTimers: function useFakeTimers() {
},
useFakeServer: function useFakeServer() {
return null;
}
},
if (this.clock) {
}
if (this.server) {
}
return obj;
},
restore: function () {
this.restoreContext();
},
restoreContext: function () {
if (this.injectedKeys) {
delete this.injectInto[this.injectedKeys[i]];
}
this.injectedKeys = [];
}
},
if (!config) {
}
sandbox.injectedKeys = [];
if (config.properties) {
}
} else {
}
return sandbox;
},
});
}
require("./util/fake_server");
require("./util/fake_timers");
require("./collection");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
}());
/**
* @depend stub.js
* @depend mock.js
* @depend sandbox.js
*/
/**
* Test function, sandboxes fakes
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
if (type != "function") {
}
function sinonSandboxedTest() {
var doneIsWrapped = false;
if (result) {
throw exception;
} else {
}
}
doneIsWrapped = true;
}
try {
} catch (e) {
exception = e;
}
if (!doneIsWrapped) {
if (typeof exception !== "undefined") {
throw exception;
} else {
}
}
return result;
};
return function sinonAsyncSandboxedTest(callback) {
};
}
return sinonSandboxedTest;
}
injectIntoThis: true,
injectInto: null,
useFakeTimers: true,
useFakeServer: true
};
return test;
}
require("./sandbox");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend test.js
*/
/**
* Test case, sandboxes all test functions
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
(function (sinon) {
return function () {
if (setUp) {
}
try {
} catch (e) {
exception = e;
}
if (tearDown) {
}
if (exception) {
throw exception;
}
return result;
};
}
/*jsl:ignore*/
throw new TypeError("sinon.testCase needs an object with test functions");
}
/*jsl:end*/
continue;
}
}
} else {
}
}
}
return methods;
}
return testCase;
}
require("./test");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
/**
* @depend times_in_words.js
* @depend stub.js
* @depend format.js
*/
/**
* Assertions matching the test spy retrieval interface.
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
var assert;
function verifyIsStub() {
var method;
if (!method) {
}
if (typeof method != "function") {
}
}
}
}
}
}
var failed = false;
if (typeof method == "function") {
} else {
}
if (failed) {
} else {
}
};
}
}
assert = {
failException: "AssertError",
throw error;
},
callOrder: function assertCallOrder() {
try {
while (i) {
}
}
} catch (e) {
// If this fails, we'll just fall back to the blank string
}
"called in order but were called as " + actual);
} else {
}
},
" but was called %c%C";
} else {
}
},
if (!target) {
throw new TypeError("target is null or undefined");
}
var o = options || {};
for (var method in this) {
}
}
return target;
},
} else {
var formatted = [
"expected value to match",
]
}
}
};
mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called");
"expected %n to not have been called but was called %c%C");
mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
return assert;
}
require("./match");
}
if (isAMD) {
} else if (isNode) {
} else if (!sinon) {
return;
} else {
}
}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
/**
* @depend core.js
* @depend ../extend.js
* @depend event.js
* @depend ../log_error.js
*/
/**
* Fake XDomainRequest object
*/
if (typeof sinon == "undefined") {
this.sinon = {};
}
// wrapper for global
(function (global) {
function FakeXDomainRequest() {
this.requestBody = null;
this.requestHeaders = {};
this.status = 0;
this.timeout = null;
FakeXDomainRequest.onCreate(this);
}
}
function verifyState(xdr) {
throw new Error("INVALID_STATE_ERR");
}
throw new Error("INVALID_STATE_ERR");
}
}
function verifyRequestSent(xdr) {
throw new Error("Request not sent");
}
throw new Error("Request done");
}
}
function verifyResponseBodyType(body) {
if (typeof body != "string") {
body + ", which is not a string.");
throw error;
}
}
this.responseText = null;
this.sendFlag = false;
},
this.readyState = state;
var eventName = "";
switch (this.readyState) {
case FakeXDomainRequest.UNSENT:
break;
case FakeXDomainRequest.OPENED:
break;
case FakeXDomainRequest.LOADING:
if (this.sendFlag) {
//raise the progress event
eventName = "onprogress";
}
break;
case FakeXDomainRequest.DONE:
if (this.isTimeout) {
eventName = "ontimeout"
eventName = "onerror";
} else {
eventName = "onload"
}
break;
}
// raising event (if defined)
if (eventName) {
if (typeof this[eventName] == "function") {
try {
this[eventName]();
} catch (e) {
}
}
}
},
verifyState(this);
this.requestBody = data;
}
this.errorFlag = false;
this.sendFlag = true;
if (typeof this.onSend == "function") {
this.onSend(this);
}
},
this.aborted = true;
this.responseText = null;
this.errorFlag = true;
this.sendFlag = false;
}
},
verifyRequestSent(this);
var index = 0;
this.responseText = "";
do {
},
// content-type ignored, since XDomainRequest does not carry this
// we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease
// test integration across browsers
},
simulatetimeout: function simulatetimeout() {
this.status = 0;
this.isTimeout = true;
// Access to this should actually throw an error
this.responseText = undefined;
}
});
UNSENT: 0,
OPENED: 1,
LOADING: 3,
DONE: 4
});
if (xdr.supportsXDR) {
}
if (keepOnCreate !== true) {
}
};
if (xdr.supportsXDR) {
}
return sinon.FakeXDomainRequest;
};
}
require("./event");
}
if (isAMD) {
} else if (isNode) {
} else {
}
})(this);
return sinon;
}));