Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Move checkboxes into toolbar and give them labels and descriptions (as tooltip)....
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 30 Jun 2012 22:32:25 +0000 (15:32 -0700)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 30 Jun 2012 22:32:25 +0000 (15:32 -0700)
qunit/qunit.css
qunit/qunit.js

index 114b7c3..436c6f2 100644 (file)
@@ -54,9 +54,9 @@
        color: #fff;
 }
 
-#qunit-header label {
+#qunit-testrunner-toolbar label {
        display: inline-block;
-       padding-left: 0.5em;
+       padding: 0 .5em 0 .1em;
 }
 
 #qunit-banner {
index 99887c9..a4ffd08 100644 (file)
@@ -561,7 +561,20 @@ config = {
        // when enabled, all tests must call expect()
        requireExpects: false,
 
-       urlConfig: [ "noglobals", "notrycatch" ],
+       // add checkboxes that are persisted in the query-string
+       // when enabled, the id is set to `true` as a `QUnit.config` property
+       urlConfig: [
+               {
+                       id: "noglobals",
+                       label: "Check for Globals",
+                       tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
+               },
+               {
+                       id: "notrycatch",
+                       label: "No try-catch",
+                       tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
+               }
+       ],
 
        // logging callback queues
        begin: [],
@@ -892,8 +905,15 @@ QUnit.load = function() {
 
        for ( i = 0; i < len; i++ ) {
                val = config.urlConfig[i];
-               config[val] = QUnit.urlParams[val];
-               urlConfigHtml += "<label><input name='" + val + "' type='checkbox'" + ( config[val] ? " checked='checked'" : "" ) + ">" + val + "</label>";
+               if ( typeof val === "string" ) {
+                       val = {
+                               id: val,
+                               label: val,
+                               tooltip: "[no tooltip available]"
+                       };
+               }
+               config[ val.id ] = QUnit.urlParams[ val.id ];
+               urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
        }
 
        // `userAgent` initialized at top of scope
@@ -905,12 +925,7 @@ QUnit.load = function() {
        // `banner` initialized at top of scope
        banner = id( "qunit-header" );
        if ( banner ) {
-               banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> " + urlConfigHtml;
-               addEvent( banner, "change", function( event ) {
-                       var params = {};
-                       params[ event.target.name ] = event.target.checked ? true : undefined;
-                       window.location = QUnit.url( params );
-               });
+               banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
        }
 
        // `toolbar` initialized at top of scope
@@ -951,8 +966,18 @@ QUnit.load = function() {
                // `label` initialized at top of scope
                label = document.createElement( "label" );
                label.setAttribute( "for", "qunit-filter-pass" );
+               label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
                label.innerHTML = "Hide passed tests";
                toolbar.appendChild( label );
+
+               var urlConfigCheckboxes = document.createElement( 'span' );
+               urlConfigCheckboxes.innerHTML = urlConfigHtml;
+               addEvent( urlConfigCheckboxes, "change", function( event ) {
+                       var params = {};
+                       params[ event.target.name ] = event.target.checked ? true : undefined;
+                       window.location = QUnit.url( params );
+               });
+               toolbar.appendChild( urlConfigCheckboxes );
        }
 
        // `main` initialized at top of scope

Hosting is provided AltSPAHow to use Git
Please direct any questions on jabber alex.wolf@jabber.ru

Valid HTML 4.0 Transitional Valid CSS!

Designer Alexander Wolf