Skip to content

Commit

Permalink
Updated QUnit to newest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil Maj committed Dec 17, 2009
1 parent f34b13b commit fcb5748
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 27 deletions.
130 changes: 116 additions & 14 deletions qunit.css
@@ -1,17 +1,119 @@
h1#qunit-header { padding: 15px; font-size: large; background-color: #06b; color: white; font-family: 'trebuchet ms', verdana, arial; margin: 0; }
h1#qunit-header a { color: white; }

h2#qunit-banner { height: 2em; border-bottom: 1px solid white; background-color: #eee; margin: 0; font-family: 'trebuchet ms', verdana, arial; }
h2#qunit-banner.pass { background-color: green; }
h2#qunit-banner.fail { background-color: red; }
ol#qunit-tests {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
padding:0;
list-style-position:inside;

h2#qunit-userAgent { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal; font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
font-size: smaller;
}
ol#qunit-tests li{
padding:0.4em 0.5em 0.4em 2.5em;
border-bottom:1px solid #fff;
font-size:small;
list-style-position:inside;
}
ol#qunit-tests li ol{
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
margin-top:0.5em;
margin-left:0;
padding:0.5em;
background-color:#fff;
border-radius:15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
ol#qunit-tests li li{
border-bottom:none;
margin:0.5em;
background-color:#fff;
list-style-position: inside;
padding:0.4em 0.5em 0.4em 0.5em;
}

div#qunit-testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; font-family: 'trebuchet ms', verdana, arial; margin: 0; font-size: 10pt; }

ol#qunit-tests { font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
ol#qunit-tests li strong { cursor:pointer; }
ol#qunit-tests .pass { color: green; }
ol#qunit-tests .fail { color: red; }

p#qunit-testresult { margin-left: 1em; font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
ol#qunit-tests li li.pass{
border-left:26px solid #C6E746;
background-color:#fff;
color:#5E740B;
}
ol#qunit-tests li li.fail{
border-left:26px solid #EE5757;
background-color:#fff;
color:#710909;
}
ol#qunit-tests li.pass{
background-color:#D2E0E6;
color:#528CE0;
}
ol#qunit-tests li.fail{
background-color:#EE5757;
color:#000;
}
ol#qunit-tests li strong {
cursor:pointer;
}
h1#qunit-header{
background-color:#0d3349;
margin:0;
padding:0.5em 0 0.5em 1em;
color:#fff;
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
border-top-right-radius:15px;
border-top-left-radius:15px;
-moz-border-radius-topright:15px;
-moz-border-radius-topleft:15px;
-webkit-border-top-right-radius:15px;
-webkit-border-top-left-radius:15px;
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
}
h2#qunit-banner{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
height:5px;
margin:0;
padding:0;
}
h2#qunit-banner.qunit-pass{
background-color:#C6E746;
}
h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {
background-color:#EE5757;
}
#qunit-testrunner-toolbar {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
padding:0;
/*width:80%;*/
padding:0em 0 0.5em 2em;
font-size: small;
}
h2#qunit-userAgent {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
background-color:#2b81af;
margin:0;
padding:0;
color:#fff;
font-size: small;
padding:0.5em 0 0.5em 2.5em;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
p#qunit-testresult{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
font-size: small;
color:#2b81af;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
-moz-border-radius-bottomright:15px;
-moz-border-radius-bottomleft:15px;
-webkit-border-bottom-right-radius:15px;
-webkit-border-bottom-left-radius:15px;
background-color:#D2E0E6;
padding:0.5em 0.5em 0.5em 2.5em;
}
strong b.fail{
color:#710909;
}
strong b.pass{
color:#5E740B;
}
41 changes: 28 additions & 13 deletions qunit.js
Expand Up @@ -104,12 +104,7 @@ var QUnit = {
QUnit.current_testEnvironment = testEnvironment;

config.assertions = [];
config.expected = null;

if ( arguments.length >= 3 ) {
config.expected = callback;
callback = arguments[2];
}
config.expected = expected;

try {
if ( !config.pollution ) {
Expand Down Expand Up @@ -194,7 +189,7 @@ var QUnit = {
});

addEvent(b, "dblclick", function(e) {
var target = (e || window.event).target;
var target = e && e.target ? e.target : window.event.srcElement;
if ( target.nodeName.toLowerCase() === "strong" ) {
var text = "", node = target.firstChild;

Expand Down Expand Up @@ -280,19 +275,35 @@ var QUnit = {
*
* Prefered to ok( actual == expected, message )
*
* @example equals( format("Received {0} bytes.", 2), "Received 2 bytes." );
* @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
*
* @param Object actual
* @param Object expected
* @param String message (optional)
*/
equals: function(actual, expected, message) {
equal: function(actual, expected, message) {
push(expected == actual, actual, expected, message);
},

notEqual: function(actual, expected, message) {
push(expected != actual, actual, expected, message);
},

same: function(a, b, message) {
deepEqual: function(a, b, message) {
push(QUnit.equiv(a, b), a, b, message);
},

notDeepEqual: function(a, b, message) {
push(!QUnit.equiv(a, b), a, b, message);
},

strictEqual: function(actual, expected, message) {
push(expected === actual, actual, expected, message);
},

notStrictEqual: function(actual, expected, message) {
push(expected !== actual, actual, expected, message);
},

start: function() {
// A slight delay, to avoid any current callbacks
Expand Down Expand Up @@ -367,6 +378,10 @@ var QUnit = {
moduleDone: function(name, failures, total) {}
};

// Backwards compatibility, deprecated
QUnit.equals = QUnit.equal;
QUnit.same = QUnit.deepEqual;

// Maintain internal state
var config = {
// The queue of tests to run
Expand Down Expand Up @@ -439,7 +454,7 @@ addEvent(window, "load", function() {
var li = document.getElementsByTagName("li");
for ( var i = 0; i < li.length; i++ ) {
if ( li[i].className.indexOf("pass") > -1 ) {
li[i].style.display = filter.checked ? "none" : "block";
li[i].style.display = filter.checked ? "none" : "";
}
}
});
Expand Down Expand Up @@ -511,10 +526,10 @@ function done() {
tests = id("qunit-tests"),
html = ['Tests completed in ',
+new Date - config.started, ' milliseconds.<br/>',
'<span class="bad">', config.stats.all - config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> passed, ', config.stats.bad,' failed.'].join('');
'<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join('');

if ( banner ) {
banner.className += " " + (config.stats.bad ? "fail" : "pass");
banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
}

if ( tests ) {
Expand Down

0 comments on commit fcb5748

Please sign in to comment.