1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bootstrap-source/bootstrap-3.0.3/js/tests/unit/phantom.js Fri Dec 20 22:49:16 2013 +0100
1.3 @@ -0,0 +1,69 @@
1.4 +/*
1.5 + * grunt-contrib-qunit
1.6 + * http://gruntjs.com/
1.7 + *
1.8 + * Copyright (c) 2013 "Cowboy" Ben Alman, contributors
1.9 + * Licensed under the MIT license.
1.10 + */
1.11 +
1.12 +/*global QUnit:true, alert:true*/
1.13 +(function () {
1.14 + 'use strict';
1.15 +
1.16 + // Don't re-order tests.
1.17 + QUnit.config.reorder = false
1.18 + // Run tests serially, not in parallel.
1.19 + QUnit.config.autorun = false
1.20 +
1.21 + // Send messages to the parent PhantomJS process via alert! Good times!!
1.22 + function sendMessage() {
1.23 + var args = [].slice.call(arguments)
1.24 + alert(JSON.stringify(args))
1.25 + }
1.26 +
1.27 + // These methods connect QUnit to PhantomJS.
1.28 + QUnit.log = function(obj) {
1.29 + // What is this I don’t even
1.30 + if (obj.message === '[object Object], undefined:undefined') { return }
1.31 + // Parse some stuff before sending it.
1.32 + var actual = QUnit.jsDump.parse(obj.actual)
1.33 + var expected = QUnit.jsDump.parse(obj.expected)
1.34 + // Send it.
1.35 + sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
1.36 + }
1.37 +
1.38 + QUnit.testStart = function(obj) {
1.39 + sendMessage('qunit.testStart', obj.name)
1.40 + }
1.41 +
1.42 + QUnit.testDone = function(obj) {
1.43 + sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total)
1.44 + }
1.45 +
1.46 + QUnit.moduleStart = function(obj) {
1.47 + sendMessage('qunit.moduleStart', obj.name)
1.48 + }
1.49 +
1.50 + QUnit.begin = function () {
1.51 + sendMessage('qunit.begin')
1.52 + console.log("Starting test suite")
1.53 + console.log("================================================\n")
1.54 + }
1.55 +
1.56 + QUnit.moduleDone = function (opts) {
1.57 + if (opts.failed === 0) {
1.58 + console.log("\r\u2714 All tests passed in '" + opts.name + "' module")
1.59 + } else {
1.60 + console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
1.61 + }
1.62 + sendMessage('qunit.moduleDone', opts.name, opts.failed, opts.passed, opts.total)
1.63 + }
1.64 +
1.65 + QUnit.done = function (opts) {
1.66 + console.log("\n================================================")
1.67 + console.log("Tests completed in " + opts.runtime + " milliseconds")
1.68 + console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
1.69 + sendMessage('qunit.done', opts.failed, opts.passed, opts.total, opts.runtime)
1.70 + }
1.71 +
1.72 +}())