]>
git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/js/tests/unit/phantom.js
5 * Copyright (c) 2014 "Cowboy" Ben Alman, contributors
6 * Licensed under the MIT license.
12 // Don't re-order tests.
13 QUnit
.config
.reorder
= false
14 // Run tests serially, not in parallel.
15 QUnit
.config
.autorun
= false
17 // Send messages to the parent PhantomJS process via alert! Good times!!
18 function sendMessage() {
19 var args
= [].slice
.call(arguments
)
20 alert(JSON
.stringify(args
))
23 // These methods connect QUnit to PhantomJS.
24 QUnit
.log(function (obj
) {
25 // What is this I don’t even
26 if (obj
.message
=== '[object Object], undefined:undefined') { return }
28 // Parse some stuff before sending it.
32 // Dumping large objects can be very slow, and the dump isn't used for
33 // passing tests, so only dump if the test failed.
34 actual
= QUnit
.dump
.parse(obj
.actual
)
35 expected
= QUnit
.dump
.parse(obj
.expected
)
38 sendMessage('qunit.log', obj
.result
, actual
, expected
, obj
.message
, obj
.source
)
41 QUnit
.testStart(function (obj
) {
42 sendMessage('qunit.testStart', obj
.name
)
45 QUnit
.testDone(function (obj
) {
46 sendMessage('qunit.testDone', obj
.name
, obj
.failed
, obj
.passed
, obj
.total
, obj
.duration
)
49 QUnit
.moduleStart(function (obj
) {
50 sendMessage('qunit.moduleStart', obj
.name
)
53 QUnit
.moduleDone(function (obj
) {
54 if (obj
.failed
=== 0) {
55 console
.log('\r\u221A All tests passed in "' + obj
.name
+ '" module')
57 console
.log('\u00D7 ' + obj
.failed
+ ' tests failed in "' + obj
.name
+ '" module')
59 sendMessage('qunit.moduleDone', obj
.name
, obj
.failed
, obj
.passed
, obj
.total
)
62 QUnit
.begin(function () {
63 sendMessage('qunit.begin')
64 console
.log('\n\nStarting test suite')
65 console
.log('================================================\n')
68 QUnit
.done(function (obj
) {
69 sendMessage('qunit.done', obj
.failed
, obj
.passed
, obj
.total
, obj
.runtime
)