unittests/sinon-ie.js
author hamidouk
Thu, 22 Dec 2011 16:10:15 +0100
branchcalage-segmentsWidget
changeset 514 f5865a99be69
parent 63 acf10cf0ebd1
permissions -rw-r--r--
WIP - first version of the rounding algorithm.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     1
/**
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     2
 * Sinon.JS 1.2.0, 2011/09/27
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     3
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     4
 * @author Christian Johansen (christian@cjohansen.no)
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     5
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     6
 * (The BSD License)
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     7
 * 
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     8
 * Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
     9
 * All rights reserved.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    10
 * 
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    11
 * Redistribution and use in source and binary forms, with or without modification,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    12
 * are permitted provided that the following conditions are met:
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    13
 * 
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    14
 *     * Redistributions of source code must retain the above copyright notice,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    15
 *       this list of conditions and the following disclaimer.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    16
 *     * Redistributions in binary form must reproduce the above copyright notice,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    17
 *       this list of conditions and the following disclaimer in the documentation
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    18
 *       and/or other materials provided with the distribution.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    19
 *     * Neither the name of Christian Johansen nor the names of his contributors
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    20
 *       may be used to endorse or promote products derived from this software
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    21
 *       without specific prior written permission.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    22
 * 
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    23
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    24
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    25
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    26
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    27
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    28
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    29
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    30
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    31
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    32
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    33
 */
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    34
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    35
"use strict";
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    36
/*global sinon, setTimeout, setInterval, clearTimeout, clearInterval, Date*/
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    37
/**
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    38
 * Helps IE run the fake timers. By defining global functions, IE allows
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    39
 * them to be overwritten at a later point. If these are not defined like
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    40
 * this, overwriting them will result in anything from an exception to browser
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    41
 * crash.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    42
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    43
 * If you don't require fake timers to work in IE, don't include this file.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    44
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    45
 * @author Christian Johansen (christian@cjohansen.no)
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    46
 * @license BSD
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    47
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    48
 * Copyright (c) 2010-2011 Christian Johansen
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    49
 */
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    50
function setTimeout() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    51
function clearTimeout() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    52
function setInterval() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    53
function clearInterval() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    54
function Date() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    55
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    56
// Reassign the original functions. Now their writable attribute
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    57
// should be true. Hackish, I know, but it works.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    58
setTimeout = sinon.timers.setTimeout;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    59
clearTimeout = sinon.timers.clearTimeout;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    60
setInterval = sinon.timers.setInterval;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    61
clearInterval = sinon.timers.clearInterval;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    62
Date = sinon.timers.Date;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    63
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    64
/*global sinon*/
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    65
/**
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    66
 * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    67
 * them to be overwritten at a later point. If these are not defined like
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    68
 * this, overwriting them will result in anything from an exception to browser
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    69
 * crash.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    70
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    71
 * If you don't require fake XHR to work in IE, don't include this file.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    72
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    73
 * @author Christian Johansen (christian@cjohansen.no)
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    74
 * @license BSD
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    75
 *
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    76
 * Copyright (c) 2010-2011 Christian Johansen
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    77
 */
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    78
function XMLHttpRequest() {}
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    79
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    80
// Reassign the original function. Now its writable attribute
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    81
// should be true. Hackish, I know, but it works.
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    82
XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined;