unittests/sinon-qunit.js
author hamidouk
Mon, 19 Dec 2011 15:25:22 +0100
branchpopcorn-port
changeset 481 a46cfeee6d77
parent 63 acf10cf0ebd1
permissions -rw-r--r--
using jquery ui draggable changes the state of an element from absolute to relative positioning, which breaks the way our seek button expands itself, so we need to force absolute positioning, quite uglily, using jquery.
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-qunit 1.0.0, 2010/12/09
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
/*global sinon, QUnit, test*/
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    35
sinon.assert.fail = function (msg) {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    36
    QUnit.ok(false, msg);
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
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    39
sinon.assert.pass = function (assertion) {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    40
    QUnit.ok(true, assertion);
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    41
};
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
sinon.config = {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    44
    injectIntoThis: true,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    45
    injectInto: null,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    46
    properties: ["spy", "stub", "mock", "clock", "sandbox"],
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    47
    useFakeTimers: true,
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    48
    useFakeServer: false
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
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    51
(function (global) {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    52
    var qTest = QUnit.test;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    53
    
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    54
    QUnit.test = global.test = function (testName, expected, callback, async) {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    55
        if (arguments.length === 2) {
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    56
            callback = expected;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    57
            expected = null;
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    58
        }
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    59
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    60
        return qTest(testName, expected, sinon.test(callback), async);
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    61
    };
acf10cf0ebd1 added sinon.js mocking library to the project
hamidouk
parents:
diff changeset
    62
}(this));