bootstrap-source/bootstrap-3.0.3/js/tests/unit/phantom.js
author stetrabby <info@trabucchi.de>
Fri, 20 Dec 2013 22:49:16 +0100
changeset 54 0ded9d7748b7
permissions -rwxr-xr-x
initial less based on the pymove3d.css
     1 /*
     2  * grunt-contrib-qunit
     3  * http://gruntjs.com/
     4  *
     5  * Copyright (c) 2013 "Cowboy" Ben Alman, contributors
     6  * Licensed under the MIT license.
     7  */
     8 
     9 /*global QUnit:true, alert:true*/
    10 (function () {
    11   'use strict';
    12 
    13   // Don't re-order tests.
    14   QUnit.config.reorder = false
    15   // Run tests serially, not in parallel.
    16   QUnit.config.autorun = false
    17 
    18   // Send messages to the parent PhantomJS process via alert! Good times!!
    19   function sendMessage() {
    20     var args = [].slice.call(arguments)
    21     alert(JSON.stringify(args))
    22   }
    23 
    24   // These methods connect QUnit to PhantomJS.
    25   QUnit.log = function(obj) {
    26     // What is this I don’t even
    27     if (obj.message === '[object Object], undefined:undefined') { return }
    28     // Parse some stuff before sending it.
    29     var actual = QUnit.jsDump.parse(obj.actual)
    30     var expected = QUnit.jsDump.parse(obj.expected)
    31     // Send it.
    32     sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
    33   }
    34 
    35   QUnit.testStart = function(obj) {
    36     sendMessage('qunit.testStart', obj.name)
    37   }
    38 
    39   QUnit.testDone = function(obj) {
    40     sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total)
    41   }
    42 
    43   QUnit.moduleStart = function(obj) {
    44     sendMessage('qunit.moduleStart', obj.name)
    45   }
    46 
    47   QUnit.begin = function () {
    48     sendMessage('qunit.begin')
    49     console.log("Starting test suite")
    50     console.log("================================================\n")
    51   }
    52 
    53   QUnit.moduleDone = function (opts) {
    54     if (opts.failed === 0) {
    55       console.log("\r\u2714 All tests passed in '" + opts.name + "' module")
    56     } else {
    57       console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
    58     }
    59     sendMessage('qunit.moduleDone', opts.name, opts.failed, opts.passed, opts.total)
    60   }
    61 
    62   QUnit.done = function (opts) {
    63     console.log("\n================================================")
    64     console.log("Tests completed in " + opts.runtime + " milliseconds")
    65     console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
    66     sendMessage('qunit.done', opts.failed, opts.passed, opts.total, opts.runtime)
    67   }
    68 
    69 }())
Impressum Datenschutzerklärung