Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Cleanup whitespace
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 16 May 2011 19:47:58 +0000 (21:47 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 16 May 2011 19:47:58 +0000 (21:47 +0200)
qunit/qunit.css
qunit/qunit.js
test/logs.js
test/same.js
test/test.js

index be37520..b3c6db5 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * QUnit - A JavaScript Unit Testing Framework
- * 
+ *
  * http://docs.jquery.com/QUnit
  *
  * Copyright (c) 2011 John Resig, Jörn Zaefferer
@@ -37,7 +37,7 @@
        font-size: 1.5em;
        line-height: 1em;
        font-weight: normal;
-       
+
        border-radius: 15px 15px 0 0;
        -moz-border-radius: 15px 15px 0 0;
        -webkit-border-top-right-radius: 15px;
 #qunit-tests ol {
        margin-top: 0.5em;
        padding: 0.5em;
-       
+
        background-color: #fff;
-       
+
        border-radius: 15px;
        -moz-border-radius: 15px;
        -webkit-border-radius: 15px;
-       
+
        box-shadow: inset 0px 2px 13px #999;
        -moz-box-shadow: inset 0px 2px 13px #999;
        -webkit-box-shadow: inset 0px 2px 13px #999;
 
 #qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
 #qunit-tests .pass .test-name               { color: #366097; }
+
 #qunit-tests .pass .test-actual,
 #qunit-tests .pass .test-expected           { color: #999999; }
 
index 221cd38..d56936e 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * QUnit - A JavaScript Unit Testing Framework
- * 
+ *
  * http://docs.jquery.com/QUnit
  *
  * Copyright (c) 2011 John Resig, Jörn Zaefferer
@@ -78,7 +78,7 @@ Test.prototype = {
                // allow utility functions to access the current test environment
                // TODO why??
                QUnit.current_testEnvironment = this.testEnvironment;
-               
+
                try {
                        if ( !config.pollution ) {
                                saveGlobal();
@@ -124,7 +124,7 @@ Test.prototype = {
                if ( this.expected && this.expected != this.assertions.length ) {
                        QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
                }
-               
+
                var good = 0, bad = 0,
                        tests = id("qunit-tests");
 
@@ -166,17 +166,17 @@ Test.prototype = {
 
                        var b = document.createElement("strong");
                        b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
-                       
+
                        var a = document.createElement("a");
                        a.innerHTML = "Rerun";
                        a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
-                       
+
                        addEvent(b, "click", function() {
                                var next = b.nextSibling.nextSibling,
                                        display = next.style.display;
                                next.style.display = display === "none" ? "block" : "none";
                        });
-                       
+
                        addEvent(b, "dblclick", function(e) {
                                var target = e && e.target ? e.target : window.event.srcElement;
                                if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
@@ -217,7 +217,7 @@ Test.prototype = {
                        total: this.assertions.length
                } );
        },
-       
+
        queue: function() {
                var test = this;
                synchronize(function() {
@@ -246,7 +246,7 @@ Test.prototype = {
                        synchronize(run);
                };
        }
-       
+
 };
 
 var QUnit = {
@@ -265,7 +265,7 @@ var QUnit = {
 
                QUnit.test(testName, expected, callback, true);
        },
-       
+
        test: function(testName, expected, callback, async) {
                var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
 
@@ -286,13 +286,13 @@ var QUnit = {
                if ( !validTest(config.currentModule + ": " + testName) ) {
                        return;
                }
-               
+
                var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
                test.module = config.currentModule;
                test.moduleTestEnvironment = config.currentModuleTestEnviroment;
                test.queue();
        },
-       
+
        /**
         * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
         */
@@ -337,7 +337,7 @@ var QUnit = {
        notEqual: function(actual, expected, message) {
                QUnit.push(expected != actual, actual, expected, message);
        },
-       
+
        deepEqual: function(actual, expected, message) {
                QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
        },
@@ -356,34 +356,34 @@ var QUnit = {
 
        raises: function(block, expected, message) {
                var actual, ok = false;
-       
+
                if (typeof expected === 'string') {
                        message = expected;
                        expected = null;
                }
-       
+
                try {
                        block();
                } catch (e) {
                        actual = e;
                }
-       
+
                if (actual) {
                        // we don't want to validate thrown error
                        if (!expected) {
                                ok = true;
-                       // expected is a regexp 
+                       // expected is a regexp
                        } else if (QUnit.objectType(expected) === "regexp") {
                                ok = expected.test(actual);
-                       // expected is a constructor    
+                       // expected is a constructor
                        } else if (actual instanceof expected) {
                                ok = true;
-                       // expected is a validation function which returns true is validation passed    
+                       // expected is a validation function which returns true is validation passed
                        } else if (expected.call({}, actual) === true) {
                                ok = true;
                        }
                }
-                       
+
                QUnit.ok(ok, message);
        },
 
@@ -412,7 +412,7 @@ var QUnit = {
                        process();
                }
        },
-       
+
        stop: function(timeout) {
                config.semaphore++;
                config.blocking = true;
@@ -438,7 +438,7 @@ var config = {
 
        // block until document ready
        blocking: true,
-       
+
        // by default, run previously failed tests first
        // very useful in combination with "Hide passed tests" checked
        reorder: true,
@@ -519,7 +519,7 @@ extend(QUnit, {
                if ( result ) {
                        result.parentNode.removeChild( result );
                }
-               
+
                if ( tests ) {
                        result = document.createElement( "p" );
                        result.id = "qunit-testresult";
@@ -528,10 +528,10 @@ extend(QUnit, {
                        result.innerHTML = 'Running...<br/>&nbsp;';
                }
        },
-       
+
        /**
         * Resets the test setup. Useful for tests that modify the DOM.
-        * 
+        *
         * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
         */
        reset: function() {
@@ -544,7 +544,7 @@ extend(QUnit, {
                        }
                }
        },
-       
+
        /**
         * Trigger an event on an element.
         *
@@ -564,12 +564,12 @@ extend(QUnit, {
                        elem.fireEvent("on"+type);
                }
        },
-       
+
        // Safe object type checking
        is: function( type, obj ) {
                return QUnit.objectType( obj ) == type;
        },
-       
+
        objectType: function( obj ) {
                if (typeof obj === "undefined") {
                                return "undefined";
@@ -603,7 +603,7 @@ extend(QUnit, {
                }
                return undefined;
        },
-       
+
        push: function(result, actual, expected, message) {
                var details = {
                        result: result,
@@ -611,7 +611,7 @@ extend(QUnit, {
                        actual: actual,
                        expected: expected
                };
-               
+
                message = escapeHtml(message) || (result ? "okay" : "failed");
                message = '<span class="test-message">' + message + "</span>";
                expected = escapeHtml(QUnit.jsDump.parse(expected));
@@ -629,15 +629,15 @@ extend(QUnit, {
                        }
                }
                output += "</table>";
-               
+
                QUnit.log(details);
-               
+
                config.current.assertions.push({
                        result: !!result,
                        message: output
                });
        },
-       
+
        url: function( params ) {
                params = extend( extend( {}, QUnit.urlParams ), params );
                var querystring = "?",
@@ -648,7 +648,7 @@ extend(QUnit, {
                }
                return window.location.pathname + querystring.slice( 0, -1 );
        },
-       
+
        // Logging callbacks; all receive a single argument with the listed properties
        // run test/logs.html for any related changes
        begin: function() {},
@@ -672,7 +672,7 @@ if ( typeof document === "undefined" || document.readyState === "complete" ) {
 
 addEvent(window, "load", function() {
        QUnit.begin({});
-       
+
        // Initialize the config, saving the execution queue
        var oldconfig = extend({}, config);
        QUnit.init();
@@ -695,7 +695,7 @@ addEvent(window, "load", function() {
                        window.location = QUnit.url( params );
                });
        }
-       
+
        var toolbar = id("qunit-testrunner-toolbar");
        if ( toolbar ) {
                var filter = document.createElement("input");
@@ -774,7 +774,7 @@ function done() {
                banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
        }
 
-       if ( tests ) {  
+       if ( tests ) {
                id( "qunit-testresult" ).innerHTML = html;
        }
 
@@ -786,7 +786,7 @@ function done() {
 
        QUnit.done( {
                failed: config.stats.bad,
-               passed: passed, 
+               passed: passed,
                total: config.stats.all,
                runtime: runtime
        } );
@@ -875,7 +875,7 @@ function process() {
 
 function saveGlobal() {
        config.pollution = [];
-       
+
        if ( config.noglobals ) {
                for ( var key in window ) {
                        config.pollution.push( key );
@@ -886,7 +886,7 @@ function saveGlobal() {
 function checkPollution( name ) {
        var old = config.pollution;
        saveGlobal();
-       
+
        var newGlobals = diff( config.pollution, old );
        if ( newGlobals.length > 0 ) {
                ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
@@ -972,7 +972,7 @@ QUnit.equiv = function () {
             }
         }
     }
-    
+
     var callbacks = function () {
 
         // for string, boolean, number and null
@@ -1026,13 +1026,13 @@ QUnit.equiv = function () {
                 // b could be an object literal here
                 if ( ! (QUnit.objectType(b) === "array")) {
                     return false;
-                }   
-                
+                }
+
                 len = a.length;
                 if (len !== b.length) { // safe and faster
                     return false;
                 }
-                
+
                 //track reference to avoid circular references
                 parents.push(a);
                 for (i = 0; i < len; i++) {
@@ -1065,7 +1065,7 @@ QUnit.equiv = function () {
                 callers.push(a.constructor);
                 //track reference to avoid circular references
                 parents.push(a);
-                
+
                 for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
                     loop = false;
                     for(j=0;j<parents.length;j++){
@@ -1131,7 +1131,7 @@ QUnit.jsDump = (function() {
                return '"' + str.toString().replace(/"/g, '\\"') + '"';
        };
        function literal( o ) {
-               return o + '';  
+               return o + '';
        };
        function join( pre, arr, post ) {
                var s = jsDump.separator(),
@@ -1144,21 +1144,21 @@ QUnit.jsDump = (function() {
                return [ pre, inner + arr, base + post ].join(s);
        };
        function array( arr ) {
-               var i = arr.length,     ret = Array(i);                                 
+               var i = arr.length,     ret = Array(i);
                this.up();
                while ( i-- )
-                       ret[i] = this.parse( arr[i] );                          
+                       ret[i] = this.parse( arr[i] );
                this.down();
                return join( '[', ret, ']' );
        };
-       
+
        var reName = /^function (\w+)/;
-       
+
        var jsDump = {
                parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
                        var     parser = this.parsers[ type || this.typeOf(obj) ];
-                       type = typeof parser;                   
-                       
+                       type = typeof parser;
+
                        return type == 'function' ? parser.call( this, obj ) :
                                   type == 'string' ? parser :
                                   this.parsers.error;
@@ -1209,7 +1209,7 @@ QUnit.jsDump = (function() {
                        this.parsers[name] = parser;
                },
                // The next 3 are exposed so you can use them
-               quote:quote, 
+               quote:quote,
                literal:literal,
                join:join,
                //
@@ -1228,7 +1228,7 @@ QUnit.jsDump = (function() {
                                if ( name )
                                        ret += ' ' + name;
                                ret += '(';
-                               
+
                                ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join('');
                                return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' );
                        },
@@ -1246,10 +1246,10 @@ QUnit.jsDump = (function() {
                        node:function( node ) {
                                var open = QUnit.jsDump.HTML ? '&lt;' : '<',
                                        close = QUnit.jsDump.HTML ? '&gt;' : '>';
-                                       
+
                                var tag = node.nodeName.toLowerCase(),
                                        ret = open + tag;
-                                       
+
                                for ( var a in QUnit.jsDump.DOMAttrs ) {
                                        var val = node[QUnit.jsDump.DOMAttrs[a]];
                                        if ( val )
@@ -1259,8 +1259,8 @@ QUnit.jsDump = (function() {
                        },
                        functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
                                var l = fn.length;
-                               if ( !l ) return '';                            
-                               
+                               if ( !l ) return '';
+
                                var args = Array(l);
                                while ( l-- )
                                        args[l] = String.fromCharCode(97+l);//97 is 'a'
@@ -1317,34 +1317,34 @@ function getText( elems ) {
  *
  * More Info:
  *  http://ejohn.org/projects/javascript-diff-algorithm/
- *  
+ *
  * Usage: QUnit.diff(expected, actual)
- * 
+ *
  * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the  quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
  */
 QUnit.diff = (function() {
        function diff(o, n){
                var ns = new Object();
                var os = new Object();
-               
+
                for (var i = 0; i < n.length; i++) {
-                       if (ns[n[i]] == null) 
+                       if (ns[n[i]] == null)
                                ns[n[i]] = {
                                        rows: new Array(),
                                        o: null
                                };
                        ns[n[i]].rows.push(i);
                }
-               
+
                for (var i = 0; i < o.length; i++) {
-                       if (os[o[i]] == null) 
+                       if (os[o[i]] == null)
                                os[o[i]] = {
                                        rows: new Array(),
                                        n: null
                                };
                        os[o[i]].rows.push(i);
                }
-               
+
                for (var i in ns) {
                        if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
                                n[ns[i].rows[0]] = {
@@ -1357,7 +1357,7 @@ QUnit.diff = (function() {
                                };
                        }
                }
-               
+
                for (var i = 0; i < n.length - 1; i++) {
                        if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
                        n[i + 1] == o[n[i].row + 1]) {
@@ -1371,7 +1371,7 @@ QUnit.diff = (function() {
                                };
                        }
                }
-               
+
                for (var i = n.length - 1; i > 0; i--) {
                        if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
                        n[i - 1] == o[n[i].row - 1]) {
@@ -1385,20 +1385,20 @@ QUnit.diff = (function() {
                                };
                        }
                }
-               
+
                return {
                        o: o,
                        n: n
                };
        }
-       
+
        return function(o, n){
                o = o.replace(/\s+$/, '');
                n = n.replace(/\s+$/, '');
                var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
 
                var str = "";
-               
+
                var oSpace = o.match(/\s+/g);
                if (oSpace == null) {
                        oSpace = [" "];
@@ -1413,7 +1413,7 @@ QUnit.diff = (function() {
                else {
                        nSpace.push(" ");
                }
-               
+
                if (out.n.length == 0) {
                        for (var i = 0; i < out.o.length; i++) {
                                str += '<del>' + out.o[i] + oSpace[i] + "</del>";
@@ -1425,14 +1425,14 @@ QUnit.diff = (function() {
                                        str += '<del>' + out.o[n] + oSpace[n] + "</del>";
                                }
                        }
-                       
+
                        for (var i = 0; i < out.n.length; i++) {
                                if (out.n[i].text == null) {
                                        str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
                                }
                                else {
                                        var pre = "";
-                                       
+
                                        for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
                                                pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
                                        }
@@ -1440,7 +1440,7 @@ QUnit.diff = (function() {
                                }
                        }
                }
-               
+
                return str;
        };
 })();
index 5d7a235..64dc203 100644 (file)
@@ -109,7 +109,7 @@ test("test2", 10, function() {
 });
 
 module("logs2");
-       
+
 test("test1", 9, function() {
        equal(begin, 1);
        equal(moduleStart, 2);
index 40c7384..fa7e3eb 100644 (file)
@@ -69,7 +69,7 @@ test("Primitive types and constants", function () {
     equals(QUnit.equiv('', false), false, "string");
     equals(QUnit.equiv('', null), false, "string");
     equals(QUnit.equiv('', undefined), false, "string");
-    
+
     // Short annotation VS new annotation
     equals(QUnit.equiv(0, new Number()), true, "short annotation VS new annotation");
     equals(QUnit.equiv(new Number(), 0), true, "short annotation VS new annotation");
@@ -344,7 +344,7 @@ test("Date instances.", function() {
     // Date, we don't need to test Date.parse() because it returns a number.
     // Only test the Date instances by setting them a fix date.
     // The date use is midnight January 1, 1970
-    
+
     var d1 = new Date();
     d1.setTime(0); // fix the date
 
@@ -451,7 +451,7 @@ test("Complex Objects.", function() {
     function fn2() {
         return "fn2";
     }
-    
+
     // Try to invert the order of some properties to make sure it is covered.
     // It can failed when properties are compared between unsorted arrays.
     equals(QUnit.equiv(
@@ -1177,15 +1177,15 @@ test("Prototypal inheritance", function() {
 
 
 test("Instances", function() {
-    function A() {} 
-    var a1 = new A(); 
-    var a2 = new A(); 
+    function A() {}
+    var a1 = new A();
+    var a2 = new A();
 
     function B() {
         this.fn = function () {};
-    } 
-    var b1 = new B(); 
-    var b2 = new B(); 
+    }
+    var b1 = new B();
+    var b2 = new B();
 
     equals(QUnit.equiv(a1, a2), true, "Same property, same constructor");
 
@@ -1361,46 +1361,46 @@ test('object with references to self wont loop', function(){
     circularA.abc = circularA;
     circularB.abc = circularB;
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
-    
+
     circularA.def = 1;
     circularB.def = 1;
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object (ambigous test)");
-    
+
     circularA.def = 1;
     circularB.def = 0;
     equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object (unambigous test)");
 });
 
 test('array with references to self wont loop', function(){
-    var circularA = [], 
+    var circularA = [],
         circularB = [];
     circularA.push(circularA);
     circularB.push(circularB);
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
-    
+
     circularA.push( 'abc' );
     circularB.push( 'abc' );
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on array (ambigous test)");
-    
+
     circularA.push( 'hello' );
     circularB.push( 'goodbye' );
     equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on array (unambigous test)");
 });
 
 test('mixed object/array with references to self wont loop', function(){
-    var circularA = [{abc:null}], 
+    var circularA = [{abc:null}],
         circularB = [{abc:null}];
     circularA[0].abc = circularA;
     circularB[0].abc = circularB;
-    
+
     circularA.push(circularA);
     circularB.push(circularB);
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
-    
+
     circularA[0].def = 1;
     circularB[0].def = 1;
     equals(QUnit.equiv(circularA, circularB), true, "Should not repeat test on object/array (ambigous test)");
-    
+
     circularA[0].def = 1;
     circularB[0].def = 0;
     equals(QUnit.equiv(circularA, circularB), false, "Should not repeat test on object/array (unambigous test)");
index 44735e3..3f942d2 100644 (file)
@@ -206,7 +206,7 @@ test("makeurl working with settings from testEnvironment", function() {
 test("each test can extend the module testEnvironment", {
        q:'hamstersoup'
 }, function() {
-       equal( makeurl(), 'http://google.com/?q=hamstersoup', 'url from module, q from test');  
+       equal( makeurl(), 'http://google.com/?q=hamstersoup', 'url from module, q from test');
 });
 
 module("jsDump");
@@ -224,24 +224,24 @@ test("raises",function() {
        function CustomError( message ) {
                this.message = message;
        }
-       
+
        CustomError.prototype.toString = function() {
-               return this.message;    
+               return this.message;
        };
-       
+
        raises(
                function() {
                        throw "error"
                }
        );
-       
+
        raises(
                function() {
                        throw "error"
                },
                'raises with just a message, no expected'
        );
-       
+
        raises(
                function() {
                        throw new CustomError();
@@ -249,7 +249,7 @@ test("raises",function() {
                CustomError,
                'raised error is an instance of CustomError'
        );
-       
+
        raises(
                function() {
                        throw new CustomError("some error description");
@@ -257,7 +257,7 @@ test("raises",function() {
                /description/,
                "raised error message contains 'description'"
        );
-       
+
        raises(
                function() {
                        throw new CustomError("some error description");
@@ -267,9 +267,9 @@ test("raises",function() {
                                return true;
                        }
                },
-               "custom validation function"            
-       );      
-               
+               "custom validation function"
+       );
+
 });
 
 if (typeof document !== "undefined") {

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