]> source.dussan.org Git - jquery-ui.git/commitdiff
update to latest QUnit
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 29 Sep 2009 07:48:14 +0000 (07:48 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 29 Sep 2009 07:48:14 +0000 (07:48 +0000)
18 files changed:
external/testrunner-r6574.js [deleted file]
external/testrunner-r6588.js [new file with mode: 0644]
tests/unit/accordion/accordion.html
tests/unit/all.html
tests/unit/all_2.html
tests/unit/core/core.html
tests/unit/datepicker/datepicker.html
tests/unit/defaults.html
tests/unit/dialog/dialog.html
tests/unit/draggable/draggable.html
tests/unit/droppable/droppable.html
tests/unit/position/position.html
tests/unit/progressbar/progressbar.html
tests/unit/resizable/resizable.html
tests/unit/selectable/selectable.html
tests/unit/slider/slider.html
tests/unit/sortable/sortable.html
tests/unit/tabs/tabs.html

diff --git a/external/testrunner-r6574.js b/external/testrunner-r6574.js
deleted file mode 100644 (file)
index 2870818..0000000
+++ /dev/null
@@ -1,797 +0,0 @@
-/*\r
- * QUnit - jQuery unit testrunner\r
- * \r
- * http://docs.jquery.com/QUnit\r
- *\r
- * Copyright (c) 2008 John Resig, Jörn Zaefferer\r
- * Dual licensed under the MIT (MIT-LICENSE.txt)\r
- * and GPL (GPL-LICENSE.txt) licenses.\r
- *\r
- * $Id: testrunner.js 6574 2009-09-15 20:30:29Z joern.zaefferer $\r
- */\r
-\r
-(function($) {\r
-\r
-// Test for equality any JavaScript type.\r
-// Discussions and reference: http://philrathe.com/articles/equiv\r
-// Test suites: http://philrathe.com/tests/equiv\r
-// Author: Philippe Rathé <prathe@gmail.com>\r
-var equiv = function () {\r
-\r
-    var innerEquiv; // the real equiv function\r
-    var callers = []; // stack to decide between skip/abort functions\r
-\r
-\r
-    // Determine what is o.\r
-    function hoozit(o) {\r
-        if (o.constructor === String) {\r
-            return "string";\r
-            \r
-        } else if (o.constructor === Boolean) {\r
-            return "boolean";\r
-\r
-        } else if (o.constructor === Number) {\r
-\r
-            if (isNaN(o)) {\r
-                return "nan";\r
-            } else {\r
-                return "number";\r
-            }\r
-\r
-        } else if (typeof o === "undefined") {\r
-            return "undefined";\r
-\r
-        // consider: typeof null === object\r
-        } else if (o === null) {\r
-            return "null";\r
-\r
-        // consider: typeof [] === object\r
-        } else if (o instanceof Array) {\r
-            return "array";\r
-        \r
-        // consider: typeof new Date() === object\r
-        } else if (o instanceof Date) {\r
-            return "date";\r
-\r
-        // consider: /./ instanceof Object;\r
-        //           /./ instanceof RegExp;\r
-        //          typeof /./ === "function"; // => false in IE and Opera,\r
-        //                                          true in FF and Safari\r
-        } else if (o instanceof RegExp) {\r
-            return "regexp";\r
-\r
-        } else if (typeof o === "object") {\r
-            return "object";\r
-\r
-        } else if (o instanceof Function) {\r
-            return "function";\r
-        } else {\r
-            return undefined;\r
-        }\r
-    }\r
-\r
-    // Call the o related callback with the given arguments.\r
-    function bindCallbacks(o, callbacks, args) {\r
-        var prop = hoozit(o);\r
-        if (prop) {\r
-            if (hoozit(callbacks[prop]) === "function") {\r
-                return callbacks[prop].apply(callbacks, args);\r
-            } else {\r
-                return callbacks[prop]; // or undefined\r
-            }\r
-        }\r
-    }\r
-    \r
-    var callbacks = function () {\r
-\r
-        // for string, boolean, number and null\r
-        function useStrictEquality(b, a) {\r
-            if (b instanceof a.constructor || a instanceof b.constructor) {\r
-                // to catch short annotaion VS 'new' annotation of a declaration\r
-                // e.g. var i = 1;\r
-                //      var j = new Number(1);\r
-                return a == b;\r
-            } else {\r
-                return a === b;\r
-            }\r
-        }\r
-\r
-        return {\r
-            "string": useStrictEquality,\r
-            "boolean": useStrictEquality,\r
-            "number": useStrictEquality,\r
-            "null": useStrictEquality,\r
-            "undefined": useStrictEquality,\r
-\r
-            "nan": function (b) {\r
-                return isNaN(b);\r
-            },\r
-\r
-            "date": function (b, a) {\r
-                return hoozit(b) === "date" && a.valueOf() === b.valueOf();\r
-            },\r
-\r
-            "regexp": function (b, a) {\r
-                return hoozit(b) === "regexp" &&\r
-                    a.source === b.source && // the regex itself\r
-                    a.global === b.global && // and its modifers (gmi) ...\r
-                    a.ignoreCase === b.ignoreCase &&\r
-                    a.multiline === b.multiline;\r
-            },\r
-\r
-            // - skip when the property is a method of an instance (OOP)\r
-            // - abort otherwise,\r
-            //   initial === would have catch identical references anyway\r
-            "function": function () {\r
-                var caller = callers[callers.length - 1];\r
-                return caller !== Object &&\r
-                        typeof caller !== "undefined";\r
-            },\r
-\r
-            "array": function (b, a) {\r
-                var i;\r
-                var len;\r
-\r
-                // b could be an object literal here\r
-                if ( ! (hoozit(b) === "array")) {\r
-                    return false;\r
-                }\r
-\r
-                len = a.length;\r
-                if (len !== b.length) { // safe and faster\r
-                    return false;\r
-                }\r
-                for (i = 0; i < len; i++) {\r
-                    if( ! innerEquiv(a[i], b[i])) {\r
-                        return false;\r
-                    }\r
-                }\r
-                return true;\r
-            },\r
-\r
-            "object": function (b, a) {\r
-                var i;\r
-                var eq = true; // unless we can proove it\r
-                var aProperties = [], bProperties = []; // collection of strings\r
-\r
-                // comparing constructors is more strict than using instanceof\r
-                if ( a.constructor !== b.constructor) {\r
-                    return false;\r
-                }\r
-\r
-                // stack constructor before traversing properties\r
-                callers.push(a.constructor);\r
-\r
-                for (i in a) { // be strict: don't ensures hasOwnProperty and go deep\r
-\r
-                    aProperties.push(i); // collect a's properties\r
-\r
-                    if ( ! innerEquiv(a[i], b[i])) {\r
-                        eq = false;\r
-                    }\r
-                }\r
-\r
-                callers.pop(); // unstack, we are done\r
-\r
-                for (i in b) {\r
-                    bProperties.push(i); // collect b's properties\r
-                }\r
-\r
-                // Ensures identical properties name\r
-                return eq && innerEquiv(aProperties.sort(), bProperties.sort());\r
-            }\r
-        };\r
-    }();\r
-\r
-    innerEquiv = function () { // can take multiple arguments\r
-        var args = Array.prototype.slice.apply(arguments);\r
-        if (args.length < 2) {\r
-            return true; // end transition\r
-        }\r
-\r
-        return (function (a, b) {\r
-            if (a === b) {\r
-                return true; // catch the most you can\r
-            } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {\r
-                return false; // don't lose time with error prone cases\r
-            } else {\r
-                return bindCallbacks(a, callbacks, [b, a]);\r
-            }\r
-\r
-        // apply transition with (1..n) arguments\r
-        })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));\r
-    };\r
-\r
-    return innerEquiv;\r
-\r
-}();\r
-\r
-var GETParams = $.map( location.search.slice(1).split('&'), decodeURIComponent );\r
-\r
-var config = {\r
-       stats: {\r
-               all: 0,\r
-               bad: 0\r
-       },\r
-       queue: [],\r
-       // block until document ready\r
-       blocking: true,\r
-       //restrict modules/tests by get parameters\r
-       filters: GETParams,\r
-       isLocal: !!(window.location.protocol == 'file:')\r
-};\r
-\r
-// public API as global methods\r
-$.extend(window, {\r
-       test: test,\r
-       module: module,\r
-       expect: expect,\r
-       ok: ok,\r
-       equals: equals,\r
-       start: start,\r
-       stop: stop,\r
-       reset: reset,\r
-       isLocal: config.isLocal,\r
-       same: function(a, b, message) {\r
-               push(equiv(a, b), a, b, message);\r
-       },\r
-       QUnit: {\r
-               equiv: equiv,\r
-               ok: ok,\r
-               done: function(failures, total){},\r
-               log: function(result, message){}\r
-       },\r
-       // legacy methods below\r
-       isSet: isSet,\r
-       isObj: isObj,\r
-       compare: function() {\r
-               throw "compare is deprecated - use same() instead";\r
-       },\r
-       compare2: function() {\r
-               throw "compare2 is deprecated - use same() instead";\r
-       },\r
-       serialArray: function() {\r
-               throw "serialArray is deprecated - use jsDump.parse() instead";\r
-       },\r
-       q: q,\r
-       t: t,\r
-       url: url,\r
-       triggerEvent: triggerEvent\r
-});\r
-\r
-$(window).load(function() {\r
-       \r
-       if (!$("#header, #banner, #userAgent, #tests").length) {\r
-               $('body').prepend(\r
-                       '<h1 id="header">' + document.title + '</h1>' +\r
-                       '<h2 id="banner"></h2>' +\r
-                       '<h2 id="userAgent"></h2>' +\r
-                       '<ol id="tests"></ol>'\r
-               );\r
-       }\r
-       \r
-       $('#userAgent').html(navigator.userAgent);\r
-       var head = $('<div class="testrunner-toolbar"><label for="filter-pass">Hide passed tests</label></div>').insertAfter("#userAgent");\r
-       $('<input type="checkbox" id="filter-pass" />').attr("disabled", true).prependTo(head).click(function() {\r
-               $('li.pass')[this.checked ? 'hide' : 'show']();\r
-       });\r
-       $('<input type="checkbox" id="filter-missing">').attr("disabled", true).appendTo(head).click(function() {\r
-               $("li.fail:contains('missing test - untested code is broken code')").parent('ol').parent('li.fail')[this.checked ? 'hide' : 'show']();\r
-       });\r
-       $("#filter-missing").after('<label for="filter-missing">Hide missing tests (untested code is broken code)</label>');\r
-       runTest();      \r
-});\r
-\r
-function synchronize(callback) {\r
-       config.queue.push(callback);\r
-       if(!config.blocking) {\r
-               process();\r
-       }\r
-}\r
-\r
-function process() {\r
-       while(config.queue.length && !config.blocking) {\r
-               config.queue.shift()();\r
-       }\r
-}\r
-\r
-function stop(timeout) {\r
-       config.blocking = true;\r
-       if (timeout)\r
-               config.timeout = setTimeout(function() {\r
-                       QUnit.ok( false, "Test timed out" );\r
-                       start();\r
-               }, timeout);\r
-}\r
-function start() {\r
-       // A slight delay, to avoid any current callbacks\r
-       setTimeout(function() {\r
-               if(config.timeout)\r
-                       clearTimeout(config.timeout);\r
-               config.blocking = false;\r
-               process();\r
-       }, 13);\r
-}\r
-\r
-function validTest( name ) {\r
-       var i = config.filters.length,\r
-               run = false;\r
-\r
-       if( !i )\r
-               return true;\r
-       \r
-       while( i-- ){\r
-               var filter = config.filters[i],\r
-                       not = filter.charAt(0) == '!';\r
-               if( not ) \r
-                       filter = filter.slice(1);\r
-               if( name.indexOf(filter) != -1 )\r
-                       return !not;\r
-               if( not )\r
-                       run = true;\r
-       }\r
-       return run;\r
-}\r
-\r
-function runTest() {\r
-       config.blocking = false;\r
-       var started = +new Date;\r
-       config.fixture = document.getElementById('main').innerHTML;\r
-       config.ajaxSettings = $.ajaxSettings;\r
-       synchronize(function() {\r
-               $('<p id="testresult" class="result"/>').html(['Tests completed in ',\r
-                       +new Date - started, ' milliseconds.<br/>',\r
-                       '<span class="bad">', config.stats.all - config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> passed, ', config.stats.bad,' failed.']\r
-                       .join(''))\r
-                       .appendTo("body");\r
-               $("#banner").addClass(config.stats.bad ? "fail" : "pass");\r
-               QUnit.done( config.stats.bad, config.stats.all );\r
-       });\r
-}\r
-\r
-var pollution;\r
-\r
-function saveGlobal(){\r
-       pollution = [ ];\r
-       \r
-       for( var key in window )\r
-               pollution.push(key);\r
-}\r
-function checkPollution( name ){\r
-       var old = pollution;\r
-       saveGlobal();\r
-       \r
-       if( pollution.length > old.length ){\r
-               ok( false, "Introduced global variable(s): " + diff(old, pollution).join(", ") );\r
-               config.expected++;\r
-       }\r
-}\r
-\r
-function diff( clean, dirty ){\r
-       return $.grep( dirty, function(name){\r
-               return $.inArray( name, clean ) == -1;\r
-       });\r
-}\r
-\r
-function test(name, callback) {\r
-       if(config.currentModule)\r
-               name = config.currentModule + " module: <span>" + name + "</span>";\r
-       var lifecycle = $.extend({\r
-               setup: function() {},\r
-               teardown: function() {}\r
-       }, config.moduleLifecycle);\r
-       \r
-       if ( !validTest(name) )\r
-               return;\r
-               \r
-       var testEnvironment = {};\r
-       \r
-       synchronize(function() {\r
-               config.assertions = [];\r
-               config.expected = null;\r
-               try {\r
-                       if( !pollution )\r
-                               saveGlobal();\r
-                       lifecycle.setup.call(testEnvironment);\r
-               } catch(e) {\r
-                       QUnit.ok( false, "Setup failed on " + name + ": " + e.message );\r
-               }\r
-       });\r
-       synchronize(function() {\r
-               try {\r
-                       callback.call(testEnvironment);\r
-               } catch(e) {\r
-                       fail("Test " + name + " died, exception and test follows", e, callback);\r
-                       QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );\r
-                       // else next test will carry the responsibility\r
-                       saveGlobal();\r
-               }\r
-       });\r
-       synchronize(function() {\r
-               try {\r
-                       lifecycle.teardown.call(testEnvironment);\r
-                       checkPollution();\r
-               } catch(e) {\r
-                       QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );\r
-               }\r
-       });\r
-       synchronize(function() {\r
-               try {\r
-                       reset();\r
-               } catch(e) {\r
-                       fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);\r
-               }\r
-               \r
-               if(config.expected && config.expected != config.assertions.length) {\r
-                       QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );\r
-               }\r
-               \r
-               var good = 0, bad = 0;\r
-               var ol  = $("<ol/>").hide();\r
-               config.stats.all += config.assertions.length;\r
-               for ( var i = 0; i < config.assertions.length; i++ ) {\r
-                       var assertion = config.assertions[i];\r
-                       $("<li/>").addClass(assertion.result ? "pass" : "fail").text(assertion.message || "(no message)").appendTo(ol);\r
-                       assertion.result ? good++ : bad++;\r
-               }\r
-               config.stats.bad += bad;\r
-       \r
-               var b = $("<strong/>").html(name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>")\r
-               .click(function(){\r
-                       $(this).next().toggle();\r
-               })\r
-               .dblclick(function(event) {\r
-                       var target = $(event.target).filter("strong").clone();\r
-                       if ( target.length ) {\r
-                               target.children().remove();\r
-                               location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text()));\r
-                       }\r
-               });\r
-               \r
-               $("<li/>").addClass(bad ? "fail" : "pass").append(b).append(ol).appendTo("#tests");\r
-       \r
-               if(bad) {\r
-                       $("#filter-pass").attr("disabled", null);\r
-                       $("#filter-missing").attr("disabled", null);\r
-               }\r
-       });\r
-}\r
-\r
-function fail(message, exception, callback) {\r
-       if( typeof console != "undefined" && console.error && console.warn ) {\r
-               console.error(message);\r
-               console.error(exception);\r
-               console.warn(callback.toString());\r
-       } else if (window.opera && opera.postError) {\r
-               opera.postError(message, exception, callback.toString);\r
-       }\r
-}\r
-\r
-// call on start of module test to prepend name to all tests\r
-function module(name, lifecycle) {\r
-       config.currentModule = name;\r
-       config.moduleLifecycle = lifecycle;\r
-}\r
-\r
-/**\r
- * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.\r
- */\r
-function expect(asserts) {\r
-       config.expected = asserts;\r
-}\r
-\r
-/**\r
- * Resets the test setup. Useful for tests that modify the DOM.\r
- */\r
-function reset() {\r
-       $("#main").html( config.fixture );\r
-       $.event.global = {};\r
-       $.ajaxSettings = $.extend({}, config.ajaxSettings);\r
-}\r
-\r
-/**\r
- * Asserts true.\r
- * @example ok( $("a").size() > 5, "There must be at least 5 anchors" );\r
- */\r
-function ok(a, msg) {\r
-       QUnit.log(a, msg);\r
-\r
-       config.assertions.push({\r
-               result: !!a,\r
-               message: msg\r
-       });\r
-}\r
-\r
-/**\r
- * Asserts that two arrays are the same\r
- */\r
-function isSet(a, b, msg) {\r
-       function serialArray( a ) {\r
-               var r = [];\r
-               \r
-               if ( a && a.length )\r
-               for ( var i = 0; i < a.length; i++ ) {\r
-                   var str = a[i].nodeName;\r
-                   if ( str ) {\r
-                       str = str.toLowerCase();\r
-                       if ( a[i].id )\r
-                           str += "#" + a[i].id;\r
-                   } else\r
-                       str = a[i];\r
-                   r.push( str );\r
-               }\r
-       \r
-               return "[ " + r.join(", ") + " ]";\r
-       }\r
-       var ret = true;\r
-       if ( a && b && a.length != undefined && a.length == b.length ) {\r
-               for ( var i = 0; i < a.length; i++ )\r
-                       if ( a[i] != b[i] )\r
-                               ret = false;\r
-       } else\r
-               ret = false;\r
-       QUnit.ok( ret, !ret ? (msg + " expected: " + serialArray(b) + " result: " + serialArray(a)) : msg );\r
-}\r
-\r
-/**\r
- * Asserts that two objects are equivalent\r
- */\r
-function isObj(a, b, msg) {\r
-       var ret = true;\r
-       \r
-       if ( a && b ) {\r
-               for ( var i in a )\r
-                       if ( a[i] != b[i] )\r
-                               ret = false;\r
-\r
-               for ( i in b )\r
-                       if ( a[i] != b[i] )\r
-                               ret = false;\r
-       } else\r
-               ret = false;\r
-\r
-    QUnit.ok( ret, msg );\r
-}\r
-\r
-/**\r
- * Returns an array of elements with the given IDs, eg.\r
- * @example q("main", "foo", "bar")\r
- * @result [<div id="main">, <span id="foo">, <input id="bar">]\r
- */\r
-function q() {\r
-       var r = [];\r
-       for ( var i = 0; i < arguments.length; i++ )\r
-               r.push( document.getElementById( arguments[i] ) );\r
-       return r;\r
-}\r
-\r
-/**\r
- * Asserts that a select matches the given IDs\r
- * @example t("Check for something", "//[a]", ["foo", "baar"]);\r
- * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'\r
- */\r
-function t(a,b,c) {\r
-       var f = $(b);\r
-       var s = "";\r
-       for ( var i = 0; i < f.length; i++ )\r
-               s += (s && ",") + '"' + f[i].id + '"';\r
-       isSet(f, q.apply(q,c), a + " (" + b + ")");\r
-}\r
-\r
-/**\r
- * Add random number to url to stop IE from caching\r
- *\r
- * @example url("data/test.html")\r
- * @result "data/test.html?10538358428943"\r
- *\r
- * @example url("data/test.php?foo=bar")\r
- * @result "data/test.php?foo=bar&10538358345554"\r
- */\r
-function url(value) {\r
-       return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);\r
-}\r
-\r
-/**\r
- * Checks that the first two arguments are equal, with an optional message.\r
- * Prints out both actual and expected values.\r
- *\r
- * Prefered to ok( actual == expected, message )\r
- *\r
- * @example equals( $.format("Received {0} bytes.", 2), "Received 2 bytes." );\r
- *\r
- * @param Object actual\r
- * @param Object expected\r
- * @param String message (optional)\r
- */\r
-function equals(actual, expected, message) {\r
-       push(expected == actual, actual, expected, message);\r
-}\r
-\r
-function push(result, actual, expected, message) {\r
-       message = message || (result ? "okay" : "failed");\r
-       QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + jsDump.parse(expected) + " result: " + jsDump.parse(actual) );\r
-}\r
-\r
-/**\r
- * Trigger an event on an element.\r
- *\r
- * @example triggerEvent( document.body, "click" );\r
- *\r
- * @param DOMElement elem\r
- * @param String type\r
- */\r
-function triggerEvent( elem, type, event ) {\r
-       if ( $.browser.mozilla || $.browser.opera ) {\r
-               event = document.createEvent("MouseEvents");\r
-               event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,\r
-                       0, 0, 0, 0, 0, false, false, false, false, 0, null);\r
-               elem.dispatchEvent( event );\r
-       } else if ( $.browser.msie ) {\r
-               elem.fireEvent("on"+type);\r
-       }\r
-}\r
-\r
-})(jQuery);\r
-\r
-/**\r
- * jsDump\r
- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com\r
- * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)\r
- * Date: 5/15/2008\r
- * @projectDescription Advanced and extensible data dumping for Javascript.\r
- * @version 1.0.0\r
- * @author Ariel Flesler\r
- * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}\r
- */\r
-(function(){\r
-       function quote( str ){\r
-               return '"' + str.toString().replace(/"/g, '\\"') + '"';\r
-       };\r
-       function literal( o ){\r
-               return o + '';  \r
-       };\r
-       function join( pre, arr, post ){\r
-               var s = jsDump.separator(),\r
-                       base = jsDump.indent(),\r
-                       inner = jsDump.indent(1);\r
-               if( arr.join )\r
-                       arr = arr.join( ',' + s + inner );\r
-               if( !arr )\r
-                       return pre + post;\r
-               return [ pre, inner + arr, base + post ].join(s);\r
-       };\r
-       function array( arr ){\r
-               var i = arr.length,     ret = Array(i);                                 \r
-               this.up();\r
-               while( i-- )\r
-                       ret[i] = this.parse( arr[i] );                          \r
-               this.down();\r
-               return join( '[', ret, ']' );\r
-       };\r
-       \r
-       var reName = /^function (\w+)/;\r
-       \r
-       var jsDump = window.jsDump = {\r
-               parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance\r
-                       var     parser = this.parsers[ type || this.typeOf(obj) ];\r
-                       type = typeof parser;                   \r
-                       \r
-                       return type == 'function' ? parser.call( this, obj ) :\r
-                                  type == 'string' ? parser :\r
-                                  this.parsers.error;\r
-               },\r
-               typeOf:function( obj ){\r
-                       var type = typeof obj,\r
-                               f = 'function';//we'll use it 3 times, save it\r
-                       return type != 'object' && type != f ? type :\r
-                               !obj ? 'null' :\r
-                               obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions\r
-                               obj.getHours ? 'date' :\r
-                               obj.scrollBy ?  'window' :\r
-                               obj.nodeName == '#document' ? 'document' :\r
-                               obj.nodeName ? 'node' :\r
-                               obj.item ? 'nodelist' : // Safari reports nodelists as functions\r
-                               obj.callee ? 'arguments' :\r
-                               obj.call || obj.constructor != Array && //an array would also fall on this hack\r
-                                       (obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects\r
-                               'length' in obj ? 'array' :\r
-                               type;\r
-               },\r
-               separator:function(){\r
-                       return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';\r
-               },\r
-               indent:function( extra ){// extra can be a number, shortcut for increasing-calling-decreasing\r
-                       if( !this.multiline )\r
-                               return '';\r
-                       var chr = this.indentChar;\r
-                       if( this.HTML )\r
-                               chr = chr.replace(/\t/g,'   ').replace(/ /g,'&nbsp;');\r
-                       return Array( this._depth_ + (extra||0) ).join(chr);\r
-               },\r
-               up:function( a ){\r
-                       this._depth_ += a || 1;\r
-               },\r
-               down:function( a ){\r
-                       this._depth_ -= a || 1;\r
-               },\r
-               setParser:function( name, parser ){\r
-                       this.parsers[name] = parser;\r
-               },\r
-               // The next 3 are exposed so you can use them\r
-               quote:quote, \r
-               literal:literal,\r
-               join:join,\r
-               //\r
-               _depth_: 1,\r
-               // This is the list of parsers, to modify them, use jsDump.setParser\r
-               parsers:{\r
-                       window: '[Window]',\r
-                       document: '[Document]',\r
-                       error:'[ERROR]', //when no parser is found, shouldn't happen\r
-                       unknown: '[Unknown]',\r
-                       'null':'null',\r
-                       undefined:'undefined',\r
-                       'function':function( fn ){\r
-                               var ret = 'function',\r
-                                       name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE\r
-                               if( name )\r
-                                       ret += ' ' + name;\r
-                               ret += '(';\r
-                               \r
-                               ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');\r
-                               return join( ret, this.parse(fn,'functionCode'), '}' );\r
-                       },\r
-                       array: array,\r
-                       nodelist: array,\r
-                       arguments: array,\r
-                       object:function( map ){\r
-                               var ret = [ ];\r
-                               this.up();\r
-                               for( var key in map )\r
-                                       ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );\r
-                               this.down();\r
-                               return join( '{', ret, '}' );\r
-                       },\r
-                       node:function( node ){\r
-                               var open = this.HTML ? '&lt;' : '<',\r
-                                       close = this.HTML ? '&gt;' : '>';\r
-                                       \r
-                               var tag = node.nodeName.toLowerCase(),\r
-                                       ret = open + tag;\r
-                                       \r
-                               for( var a in this.DOMAttrs ){\r
-                                       var val = node[this.DOMAttrs[a]];\r
-                                       if( val )\r
-                                               ret += ' ' + a + '=' + this.parse( val, 'attribute' );\r
-                               }\r
-                               return ret + close + open + '/' + tag + close;\r
-                       },\r
-                       functionArgs:function( fn ){//function calls it internally, it's the arguments part of the function\r
-                               var l = fn.length;\r
-                               if( !l ) return '';                             \r
-                               \r
-                               var args = Array(l);\r
-                               while( l-- )\r
-                                       args[l] = String.fromCharCode(97+l);//97 is 'a'\r
-                               return ' ' + args.join(', ') + ' ';\r
-                       },\r
-                       key:quote, //object calls it internally, the key part of an item in a map\r
-                       functionCode:'[code]', //function calls it internally, it's the content of the function\r
-                       attribute:quote, //node calls it internally, it's an html attribute value\r
-                       string:quote,\r
-                       date:quote,\r
-                       regexp:literal, //regex\r
-                       number:literal,\r
-                       'boolean':literal\r
-               },\r
-               DOMAttrs:{//attributes to dump from nodes, name=>realName\r
-                       id:'id',\r
-                       name:'name',\r
-                       'class':'className'\r
-               },\r
-               HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )\r
-               indentChar:'   ',//indentation unit\r
-               multiline:true //if true, items in a collection, are separated by a \n, else just a space.\r
-       };\r
-\r
-})();\r
diff --git a/external/testrunner-r6588.js b/external/testrunner-r6588.js
new file mode 100644 (file)
index 0000000..1a1b763
--- /dev/null
@@ -0,0 +1,925 @@
+/*\r
+ * QUnit - jQuery unit testrunner\r
+ * \r
+ * http://docs.jquery.com/QUnit\r
+ *\r
+ * Copyright (c) 2009 John Resig, Jörn Zaefferer\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * $Id: testrunner.js 6588 2009-09-29 00:07:51Z jeresig $\r
+ */\r
+\r
+(function() {\r
+\r
+// Test for equality any JavaScript type.\r
+// Discussions and reference: http://philrathe.com/articles/equiv\r
+// Test suites: http://philrathe.com/tests/equiv\r
+// Author: Philippe Rathé <prathe@gmail.com>\r
+var equiv = function () {\r
+\r
+    var innerEquiv; // the real equiv function\r
+    var callers = []; // stack to decide between skip/abort functions\r
+\r
+\r
+    // Determine what is o.\r
+    function hoozit(o) {\r
+        if (o.constructor === String) {\r
+            return "string";\r
+            \r
+        } else if (o.constructor === Boolean) {\r
+            return "boolean";\r
+\r
+        } else if (o.constructor === Number) {\r
+\r
+            if (isNaN(o)) {\r
+                return "nan";\r
+            } else {\r
+                return "number";\r
+            }\r
+\r
+        } else if (typeof o === "undefined") {\r
+            return "undefined";\r
+\r
+        // consider: typeof null === object\r
+        } else if (o === null) {\r
+            return "null";\r
+\r
+        // consider: typeof [] === object\r
+        } else if (o instanceof Array) {\r
+            return "array";\r
+        \r
+        // consider: typeof new Date() === object\r
+        } else if (o instanceof Date) {\r
+            return "date";\r
+\r
+        // consider: /./ instanceof Object;\r
+        //           /./ instanceof RegExp;\r
+        //          typeof /./ === "function"; // => false in IE and Opera,\r
+        //                                          true in FF and Safari\r
+        } else if (o instanceof RegExp) {\r
+            return "regexp";\r
+\r
+        } else if (typeof o === "object") {\r
+            return "object";\r
+\r
+        } else if (o instanceof Function) {\r
+            return "function";\r
+        } else {\r
+            return undefined;\r
+        }\r
+    }\r
+\r
+    // Call the o related callback with the given arguments.\r
+    function bindCallbacks(o, callbacks, args) {\r
+        var prop = hoozit(o);\r
+        if (prop) {\r
+            if (hoozit(callbacks[prop]) === "function") {\r
+                return callbacks[prop].apply(callbacks, args);\r
+            } else {\r
+                return callbacks[prop]; // or undefined\r
+            }\r
+        }\r
+    }\r
+    \r
+    var callbacks = function () {\r
+\r
+        // for string, boolean, number and null\r
+        function useStrictEquality(b, a) {\r
+            if (b instanceof a.constructor || a instanceof b.constructor) {\r
+                // to catch short annotaion VS 'new' annotation of a declaration\r
+                // e.g. var i = 1;\r
+                //      var j = new Number(1);\r
+                return a == b;\r
+            } else {\r
+                return a === b;\r
+            }\r
+        }\r
+\r
+        return {\r
+            "string": useStrictEquality,\r
+            "boolean": useStrictEquality,\r
+            "number": useStrictEquality,\r
+            "null": useStrictEquality,\r
+            "undefined": useStrictEquality,\r
+\r
+            "nan": function (b) {\r
+                return isNaN(b);\r
+            },\r
+\r
+            "date": function (b, a) {\r
+                return hoozit(b) === "date" && a.valueOf() === b.valueOf();\r
+            },\r
+\r
+            "regexp": function (b, a) {\r
+                return hoozit(b) === "regexp" &&\r
+                    a.source === b.source && // the regex itself\r
+                    a.global === b.global && // and its modifers (gmi) ...\r
+                    a.ignoreCase === b.ignoreCase &&\r
+                    a.multiline === b.multiline;\r
+            },\r
+\r
+            // - skip when the property is a method of an instance (OOP)\r
+            // - abort otherwise,\r
+            //   initial === would have catch identical references anyway\r
+            "function": function () {\r
+                var caller = callers[callers.length - 1];\r
+                return caller !== Object &&\r
+                        typeof caller !== "undefined";\r
+            },\r
+\r
+            "array": function (b, a) {\r
+                var i;\r
+                var len;\r
+\r
+                // b could be an object literal here\r
+                if ( ! (hoozit(b) === "array")) {\r
+                    return false;\r
+                }\r
+\r
+                len = a.length;\r
+                if (len !== b.length) { // safe and faster\r
+                    return false;\r
+                }\r
+                for (i = 0; i < len; i++) {\r
+                    if( ! innerEquiv(a[i], b[i])) {\r
+                        return false;\r
+                    }\r
+                }\r
+                return true;\r
+            },\r
+\r
+            "object": function (b, a) {\r
+                var i;\r
+                var eq = true; // unless we can proove it\r
+                var aProperties = [], bProperties = []; // collection of strings\r
+\r
+                // comparing constructors is more strict than using instanceof\r
+                if ( a.constructor !== b.constructor) {\r
+                    return false;\r
+                }\r
+\r
+                // stack constructor before traversing properties\r
+                callers.push(a.constructor);\r
+\r
+                for (i in a) { // be strict: don't ensures hasOwnProperty and go deep\r
+\r
+                    aProperties.push(i); // collect a's properties\r
+\r
+                    if ( ! innerEquiv(a[i], b[i])) {\r
+                        eq = false;\r
+                    }\r
+                }\r
+\r
+                callers.pop(); // unstack, we are done\r
+\r
+                for (i in b) {\r
+                    bProperties.push(i); // collect b's properties\r
+                }\r
+\r
+                // Ensures identical properties name\r
+                return eq && innerEquiv(aProperties.sort(), bProperties.sort());\r
+            }\r
+        };\r
+    }();\r
+\r
+    innerEquiv = function () { // can take multiple arguments\r
+        var args = Array.prototype.slice.apply(arguments);\r
+        if (args.length < 2) {\r
+            return true; // end transition\r
+        }\r
+\r
+        return (function (a, b) {\r
+            if (a === b) {\r
+                return true; // catch the most you can\r
+            } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {\r
+                return false; // don't lose time with error prone cases\r
+            } else {\r
+                return bindCallbacks(a, callbacks, [b, a]);\r
+            }\r
+\r
+        // apply transition with (1..n) arguments\r
+        })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));\r
+    };\r
+\r
+    return innerEquiv;\r
+\r
+}();\r
+\r
+var GETParams = location.search.slice(1).split('&'), ngindex = -1;\r
+\r
+for ( var i = 0; i < GETParams.length; i++ ) {\r
+       GETParams[i] = decodeURIComponent( GETParams[i] );\r
+       if ( GETParams[i] === "noglobals" ) {\r
+               ngindex = i;\r
+       }\r
+}\r
+\r
+var noglobals = ngindex !== -1;\r
+\r
+if ( noglobals ) {\r
+       GETParams.splice( ngindex, 1 );\r
+}\r
+       \r
+var config = {\r
+       stats: {\r
+               all: 0,\r
+               bad: 0\r
+       },\r
+       queue: [],\r
+       // block until document ready\r
+       blocking: true,\r
+       //restrict modules/tests by get parameters\r
+       filters: GETParams,\r
+       isLocal: !!(window.location.protocol == 'file:')\r
+};\r
+\r
+// public API as global methods\r
+extend(window, {\r
+       test: test,\r
+       module: module,\r
+       expect: expect,\r
+       ok: ok,\r
+       equals: equals,\r
+       start: start,\r
+       stop: stop,\r
+       reset: reset,\r
+       isLocal: config.isLocal,\r
+       same: function(a, b, message) {\r
+               push(equiv(a, b), a, b, message);\r
+       },\r
+       QUnit: {\r
+               equiv: equiv,\r
+               ok: ok,\r
+               done: function(failures, total){},\r
+               log: function(result, message){}\r
+       },\r
+       // legacy methods below\r
+       isSet: isSet,\r
+       isObj: isObj,\r
+       compare: function() {\r
+               throw "compare is deprecated - use same() instead";\r
+       },\r
+       compare2: function() {\r
+               throw "compare2 is deprecated - use same() instead";\r
+       },\r
+       serialArray: function() {\r
+               throw "serialArray is deprecated - use jsDump.parse() instead";\r
+       },\r
+       q: q,\r
+       t: t,\r
+       url: url,\r
+       triggerEvent: triggerEvent\r
+});\r
+\r
+addEvent(window, "load", function(){\r
+       \r
+       if ( !document.getElementById("header") ) {\r
+               var header = document.createElement("h1");\r
+               header.id = "header";\r
+               header.innerHTML = document.title;\r
+\r
+               var banner = document.createElement("h2");\r
+               banner.id = "banner";\r
+\r
+               var userAgent = document.createElement("h2");\r
+               userAgent.id = "userAgent";\r
+\r
+               var ol = document.createElement("ol");\r
+               ol.id = "tests";\r
+\r
+               document.body.insertBefore( ol, document.body.firstChild );\r
+               document.body.insertBefore( userAgent, document.body.firstChild );\r
+               document.body.insertBefore( banner, document.body.firstChild );\r
+               document.body.insertBefore( header, document.body.firstChild );\r
+       }\r
+\r
+       var userAgent = document.getElementById("userAgent");\r
+       if ( userAgent ) {\r
+               userAgent.innerHTML = navigator.userAgent;\r
+\r
+               var toolbar = document.createElement("div");\r
+               toolbar.className = "testrunner-toolbar";\r
+               userAgent.parentNode.insertBefore( toolbar, userAgent );\r
+\r
+               var filter = document.createElement("input");\r
+               filter.type = "checkbox";\r
+               filter.id = "filter-pass";\r
+               filter.disabled = true;\r
+               addEvent( filter, "click", function(){\r
+                       var li = document.getElementsByTagName("li");\r
+                       for ( var i = 0; i < li.length; i++ ) {\r
+                               if ( li[i].className.indexOf("pass") > -1 ) {\r
+                                       li[i].style.display = filter.checked ? "none" : "block";\r
+                               }\r
+                       }\r
+               });\r
+               toolbar.appendChild( filter );\r
+\r
+               var label = document.createElement("label");\r
+               label.setAttribute("for", "filter-pass");\r
+               label.innerHTML = "Hide passed tests";\r
+               toolbar.appendChild( label );\r
+\r
+               var missing = document.createElement("input");\r
+               missing.type = "checkbox";\r
+               missing.id = "filter-missing";\r
+               missing.disabled = true;\r
+               addEvent( missing, "click", function(){\r
+                       var li = document.getElementsByTagName("li");\r
+                       for ( var i = 0; i < li.length; i++ ) {\r
+                               if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) {\r
+                                       li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block";\r
+                               }\r
+                       }\r
+               });\r
+               toolbar.appendChild( missing );\r
+\r
+               label = document.createElement("label");\r
+               label.setAttribute("for", "filter-missing");\r
+               label.innerHTML = "Hide missing tests (untested code is broken code)";\r
+               toolbar.appendChild( label );\r
+       }\r
+\r
+       runTest();      \r
+});\r
+\r
+function synchronize(callback) {\r
+       config.queue.push(callback);\r
+       if(!config.blocking) {\r
+               process();\r
+       }\r
+}\r
+\r
+function process() {\r
+       while(config.queue.length && !config.blocking) {\r
+               config.queue.shift()();\r
+       }\r
+}\r
+\r
+function stop(timeout) {\r
+       config.blocking = true;\r
+       if (timeout)\r
+               config.timeout = setTimeout(function() {\r
+                       QUnit.ok( false, "Test timed out" );\r
+                       start();\r
+               }, timeout);\r
+}\r
+function start() {\r
+       // A slight delay, to avoid any current callbacks\r
+       setTimeout(function() {\r
+               if(config.timeout)\r
+                       clearTimeout(config.timeout);\r
+               config.blocking = false;\r
+               process();\r
+       }, 13);\r
+}\r
+\r
+function validTest( name ) {\r
+       var i = config.filters.length,\r
+               run = false;\r
+\r
+       if( !i )\r
+               return true;\r
+       \r
+       while( i-- ){\r
+               var filter = config.filters[i],\r
+                       not = filter.charAt(0) == '!';\r
+               if( not ) \r
+                       filter = filter.slice(1);\r
+               if( name.indexOf(filter) != -1 )\r
+                       return !not;\r
+               if( not )\r
+                       run = true;\r
+       }\r
+       return run;\r
+}\r
+\r
+function runTest() {\r
+       config.blocking = false;\r
+       var started = +new Date;\r
+       config.fixture = document.getElementById('main').innerHTML;\r
+\r
+       if ( window.jQuery ) {\r
+               config.ajaxSettings = window.jQuery.ajaxSettings;\r
+       }\r
+\r
+       synchronize(function() {\r
+               var html = ['Tests completed in ',\r
+                       +new Date - started, ' milliseconds.<br/>',\r
+                       '<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('');\r
+\r
+               var result = document.createElement("p");\r
+               result.id = "testresult";\r
+               result.className = "result";\r
+               result.innerHTML = html;\r
+               document.body.appendChild( result );\r
+\r
+               document.getElementById("banner").className +=\r
+                       " " + (config.stats.bad ? "fail" : "pass");\r
+\r
+               QUnit.done( config.stats.bad, config.stats.all );\r
+       });\r
+}\r
+\r
+var pollution;\r
+\r
+function saveGlobal(){\r
+       pollution = [ ];\r
+       \r
+       if ( noglobals ) {\r
+               for ( var key in window ) {\r
+                       pollution.push(key);\r
+               }\r
+       }\r
+}\r
+\r
+function checkPollution( name ){\r
+       var old = pollution;\r
+       saveGlobal();\r
+       \r
+       if ( pollution.length > old.length ){\r
+               ok( false, "Introduced global variable(s): " + diff(old, pollution).join(", ") );\r
+               config.expected++;\r
+       }\r
+}\r
+\r
+function diff( clean, dirty ){\r
+       var results = [];\r
+\r
+       for ( var i = 0; i < dirty.length; i++ ) {\r
+               for ( var c = 0; c < clean.length; c++ ) {\r
+                       if ( clean[c] === dirty[i] ) {\r
+                               results.push( clean[c] );\r
+                       }\r
+               }\r
+       }\r
+\r
+       return results;\r
+}\r
+\r
+function test(name, callback) {\r
+       if ( config.currentModule ) {\r
+               name = config.currentModule + " module: " + name;\r
+       }\r
+\r
+       var lifecycle = extend({\r
+               setup: function() {},\r
+               teardown: function() {}\r
+       }, config.moduleLifecycle);\r
+       \r
+       if ( !validTest(name) ) {\r
+               return;\r
+       }\r
+               \r
+       var testEnvironment = {};\r
+       \r
+       synchronize(function() {\r
+               config.assertions = [];\r
+               config.expected = null;\r
+               try {\r
+                       if ( !pollution ) {\r
+                               saveGlobal();\r
+                       }\r
+\r
+                       lifecycle.setup.call(testEnvironment);\r
+               } catch(e) {\r
+                       QUnit.ok( false, "Setup failed on " + name + ": " + e.message );\r
+               }\r
+       });\r
+       synchronize(function() {\r
+               try {\r
+                       callback.call(testEnvironment);\r
+               } catch(e) {\r
+                       fail("Test " + name + " died, exception and test follows", e, callback);\r
+                       QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );\r
+                       // else next test will carry the responsibility\r
+                       saveGlobal();\r
+               }\r
+       });\r
+       synchronize(function() {\r
+               try {\r
+                       checkPollution();\r
+                       lifecycle.teardown.call(testEnvironment);\r
+               } catch(e) {\r
+                       QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );\r
+               }\r
+       });\r
+       synchronize(function() {\r
+               try {\r
+                       reset();\r
+               } catch(e) {\r
+                       fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);\r
+               }\r
+               \r
+               if ( config.expected && config.expected != config.assertions.length ) {\r
+                       QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );\r
+               }\r
+               \r
+               var good = 0, bad = 0;\r
+               var ol  = document.createElement("ol");\r
+               ol.style.display = "none";\r
+               config.stats.all += config.assertions.length;\r
+               for ( var i = 0; i < config.assertions.length; i++ ) {\r
+                       var assertion = config.assertions[i];\r
+                       var li = document.createElement("li");\r
+                       li.className = assertion.result ? "pass" : "fail";\r
+                       li.innerHTML = assertion.message || "(no message)";\r
+                       ol.appendChild( li );\r
+                       assertion.result ? good++ : bad++;\r
+               }\r
+               config.stats.bad += bad;\r
+               \r
+               var b = document.createElement("strong");\r
+               b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>";\r
+               addEvent(b, "click", function(){\r
+                       var next = b.nextSibling, display = next.style.display;\r
+                       next.style.display = display === "none" ? "block" : "none";\r
+               });\r
+               addEvent(b, "dblclick", function(e){\r
+                       var target = (e || window.event).target;\r
+                       if ( target.nodeName.toLowerCase() === "strong" ) {\r
+                               var text = "", node = target.firstChild;\r
+\r
+                               while ( node.nodeType === 3 ) {\r
+                                       text += node.nodeValue;\r
+                                       node = node.nextSibling;\r
+                               }\r
+\r
+                               text = text.replace(/(^\s*|\s*$)/g, "");\r
+\r
+                               location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text);\r
+                       }\r
+               });\r
+\r
+               var li = document.createElement("li");\r
+               li.className = bad ? "fail" : "pass";\r
+               li.appendChild( b );\r
+               li.appendChild( ol );\r
+               document.getElementById("tests").appendChild( li );\r
+\r
+               if(bad) {\r
+                       document.getElementById("filter-pass").disabled = null;\r
+                       document.getElementById("filter-missing").disabled = null;\r
+               }\r
+       });\r
+}\r
+\r
+function fail(message, exception, callback) {\r
+       if( typeof console != "undefined" && console.error && console.warn ) {\r
+               console.error(message);\r
+               console.error(exception);\r
+               console.warn(callback.toString());\r
+       } else if (window.opera && opera.postError) {\r
+               opera.postError(message, exception, callback.toString);\r
+       }\r
+}\r
+\r
+// call on start of module test to prepend name to all tests\r
+function module(name, lifecycle) {\r
+       config.currentModule = name;\r
+       config.moduleLifecycle = lifecycle;\r
+}\r
+\r
+/**\r
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.\r
+ */\r
+function expect(asserts) {\r
+       config.expected = asserts;\r
+}\r
+\r
+/**\r
+ * Resets the test setup. Useful for tests that modify the DOM.\r
+ */\r
+function reset() {\r
+       if ( window.jQuery ) {\r
+               jQuery("#main").html( config.fixture );\r
+               jQuery.event.global = {};\r
+               jQuery.ajaxSettings = extend({}, config.ajaxSettings);\r
+       } else {\r
+               document.getElementById("main").innerHTML = config.fixture;\r
+       }\r
+}\r
+\r
+/**\r
+ * Asserts true.\r
+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );\r
+ */\r
+function ok(a, msg) {\r
+       QUnit.log(a, msg);\r
+\r
+       config.assertions.push({\r
+               result: !!a,\r
+               message: msg\r
+       });\r
+}\r
+\r
+/**\r
+ * Asserts that two arrays are the same\r
+ */\r
+function isSet(a, b, msg) {\r
+       function serialArray( a ) {\r
+               var r = [];\r
+               \r
+               if ( a && a.length )\r
+               for ( var i = 0; i < a.length; i++ ) {\r
+                   var str = a[i].nodeName;\r
+                   if ( str ) {\r
+                       str = str.toLowerCase();\r
+                       if ( a[i].id )\r
+                           str += "#" + a[i].id;\r
+                   } else\r
+                       str = a[i];\r
+                   r.push( str );\r
+               }\r
+       \r
+               return "[ " + r.join(", ") + " ]";\r
+       }\r
+       var ret = true;\r
+       if ( a && b && a.length != undefined && a.length == b.length ) {\r
+               for ( var i = 0; i < a.length; i++ )\r
+                       if ( a[i] != b[i] )\r
+                               ret = false;\r
+       } else\r
+               ret = false;\r
+       QUnit.ok( ret, !ret ? (msg + " expected: " + serialArray(b) + " result: " + serialArray(a)) : msg );\r
+}\r
+\r
+/**\r
+ * Asserts that two objects are equivalent\r
+ */\r
+function isObj(a, b, msg) {\r
+       var ret = true;\r
+       \r
+       if ( a && b ) {\r
+               for ( var i in a )\r
+                       if ( a[i] != b[i] )\r
+                               ret = false;\r
+\r
+               for ( i in b )\r
+                       if ( a[i] != b[i] )\r
+                               ret = false;\r
+       } else\r
+               ret = false;\r
+\r
+    QUnit.ok( ret, msg );\r
+}\r
+\r
+/**\r
+ * Returns an array of elements with the given IDs, eg.\r
+ * @example q("main", "foo", "bar")\r
+ * @result [<div id="main">, <span id="foo">, <input id="bar">]\r
+ */\r
+function q() {\r
+       var r = [];\r
+       for ( var i = 0; i < arguments.length; i++ )\r
+               r.push( document.getElementById( arguments[i] ) );\r
+       return r;\r
+}\r
+\r
+/**\r
+ * Asserts that a select matches the given IDs\r
+ * @example t("Check for something", "//[a]", ["foo", "baar"]);\r
+ * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'\r
+ */\r
+function t(a,b,c) {\r
+       var f = jQuery(b);\r
+       var s = "";\r
+       for ( var i = 0; i < f.length; i++ )\r
+               s += (s && ",") + '"' + f[i].id + '"';\r
+       isSet(f, q.apply(q,c), a + " (" + b + ")");\r
+}\r
+\r
+/**\r
+ * Add random number to url to stop IE from caching\r
+ *\r
+ * @example url("data/test.html")\r
+ * @result "data/test.html?10538358428943"\r
+ *\r
+ * @example url("data/test.php?foo=bar")\r
+ * @result "data/test.php?foo=bar&10538358345554"\r
+ */\r
+function url(value) {\r
+       return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);\r
+}\r
+\r
+/**\r
+ * Checks that the first two arguments are equal, with an optional message.\r
+ * Prints out both actual and expected values.\r
+ *\r
+ * Prefered to ok( actual == expected, message )\r
+ *\r
+ * @example equals( format("Received {0} bytes.", 2), "Received 2 bytes." );\r
+ *\r
+ * @param Object actual\r
+ * @param Object expected\r
+ * @param String message (optional)\r
+ */\r
+function equals(actual, expected, message) {\r
+       push(expected == actual, actual, expected, message);\r
+}\r
+\r
+function push(result, actual, expected, message) {\r
+       message = message || (result ? "okay" : "failed");\r
+       QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + jsDump.parse(expected) + " result: " + jsDump.parse(actual) );\r
+}\r
+\r
+/**\r
+ * Trigger an event on an element.\r
+ *\r
+ * @example triggerEvent( document.body, "click" );\r
+ *\r
+ * @param DOMElement elem\r
+ * @param String type\r
+ */\r
+function triggerEvent( elem, type, event ) {\r
+       if ( document.createEvent ) {\r
+               event = document.createEvent("MouseEvents");\r
+               event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,\r
+                       0, 0, 0, 0, 0, false, false, false, false, 0, null);\r
+               elem.dispatchEvent( event );\r
+       } else if ( elem.fireEvent ) {\r
+               elem.fireEvent("on"+type);\r
+       }\r
+}\r
+\r
+function extend(a, b){\r
+       for ( var prop in b ) {\r
+               a[prop] = b[prop];\r
+       }\r
+\r
+       return a;\r
+}\r
+\r
+function addEvent(elem, type, fn){\r
+       if ( elem.addEventListener ) {\r
+               elem.addEventListener( type, fn, false );\r
+       } else if ( elem.attachEvent ) {\r
+               elem.attachEvent( "on" + type, fn );\r
+       }\r
+}\r
+\r
+})();\r
+\r
+/**\r
+ * jsDump\r
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com\r
+ * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)\r
+ * Date: 5/15/2008\r
+ * @projectDescription Advanced and extensible data dumping for Javascript.\r
+ * @version 1.0.0\r
+ * @author Ariel Flesler\r
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}\r
+ */\r
+(function(){\r
+       function quote( str ){\r
+               return '"' + str.toString().replace(/"/g, '\\"') + '"';\r
+       };\r
+       function literal( o ){\r
+               return o + '';  \r
+       };\r
+       function join( pre, arr, post ){\r
+               var s = jsDump.separator(),\r
+                       base = jsDump.indent(),\r
+                       inner = jsDump.indent(1);\r
+               if( arr.join )\r
+                       arr = arr.join( ',' + s + inner );\r
+               if( !arr )\r
+                       return pre + post;\r
+               return [ pre, inner + arr, base + post ].join(s);\r
+       };\r
+       function array( arr ){\r
+               var i = arr.length,     ret = Array(i);                                 \r
+               this.up();\r
+               while( i-- )\r
+                       ret[i] = this.parse( arr[i] );                          \r
+               this.down();\r
+               return join( '[', ret, ']' );\r
+       };\r
+       \r
+       var reName = /^function (\w+)/;\r
+       \r
+       var jsDump = window.jsDump = {\r
+               parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance\r
+                       var     parser = this.parsers[ type || this.typeOf(obj) ];\r
+                       type = typeof parser;                   \r
+                       \r
+                       return type == 'function' ? parser.call( this, obj ) :\r
+                                  type == 'string' ? parser :\r
+                                  this.parsers.error;\r
+               },\r
+               typeOf:function( obj ){\r
+                       var type = typeof obj,\r
+                               f = 'function';//we'll use it 3 times, save it\r
+                       return type != 'object' && type != f ? type :\r
+                               !obj ? 'null' :\r
+                               obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions\r
+                               obj.getHours ? 'date' :\r
+                               obj.scrollBy ?  'window' :\r
+                               obj.nodeName == '#document' ? 'document' :\r
+                               obj.nodeName ? 'node' :\r
+                               obj.item ? 'nodelist' : // Safari reports nodelists as functions\r
+                               obj.callee ? 'arguments' :\r
+                               obj.call || obj.constructor != Array && //an array would also fall on this hack\r
+                                       (obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects\r
+                               'length' in obj ? 'array' :\r
+                               type;\r
+               },\r
+               separator:function(){\r
+                       return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';\r
+               },\r
+               indent:function( extra ){// extra can be a number, shortcut for increasing-calling-decreasing\r
+                       if( !this.multiline )\r
+                               return '';\r
+                       var chr = this.indentChar;\r
+                       if( this.HTML )\r
+                               chr = chr.replace(/\t/g,'   ').replace(/ /g,'&nbsp;');\r
+                       return Array( this._depth_ + (extra||0) ).join(chr);\r
+               },\r
+               up:function( a ){\r
+                       this._depth_ += a || 1;\r
+               },\r
+               down:function( a ){\r
+                       this._depth_ -= a || 1;\r
+               },\r
+               setParser:function( name, parser ){\r
+                       this.parsers[name] = parser;\r
+               },\r
+               // The next 3 are exposed so you can use them\r
+               quote:quote, \r
+               literal:literal,\r
+               join:join,\r
+               //\r
+               _depth_: 1,\r
+               // This is the list of parsers, to modify them, use jsDump.setParser\r
+               parsers:{\r
+                       window: '[Window]',\r
+                       document: '[Document]',\r
+                       error:'[ERROR]', //when no parser is found, shouldn't happen\r
+                       unknown: '[Unknown]',\r
+                       'null':'null',\r
+                       undefined:'undefined',\r
+                       'function':function( fn ){\r
+                               var ret = 'function',\r
+                                       name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE\r
+                               if( name )\r
+                                       ret += ' ' + name;\r
+                               ret += '(';\r
+                               \r
+                               ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');\r
+                               return join( ret, this.parse(fn,'functionCode'), '}' );\r
+                       },\r
+                       array: array,\r
+                       nodelist: array,\r
+                       arguments: array,\r
+                       object:function( map ){\r
+                               var ret = [ ];\r
+                               this.up();\r
+                               for( var key in map )\r
+                                       ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );\r
+                               this.down();\r
+                               return join( '{', ret, '}' );\r
+                       },\r
+                       node:function( node ){\r
+                               var open = this.HTML ? '&lt;' : '<',\r
+                                       close = this.HTML ? '&gt;' : '>';\r
+                                       \r
+                               var tag = node.nodeName.toLowerCase(),\r
+                                       ret = open + tag;\r
+                                       \r
+                               for( var a in this.DOMAttrs ){\r
+                                       var val = node[this.DOMAttrs[a]];\r
+                                       if( val )\r
+                                               ret += ' ' + a + '=' + this.parse( val, 'attribute' );\r
+                               }\r
+                               return ret + close + open + '/' + tag + close;\r
+                       },\r
+                       functionArgs:function( fn ){//function calls it internally, it's the arguments part of the function\r
+                               var l = fn.length;\r
+                               if( !l ) return '';                             \r
+                               \r
+                               var args = Array(l);\r
+                               while( l-- )\r
+                                       args[l] = String.fromCharCode(97+l);//97 is 'a'\r
+                               return ' ' + args.join(', ') + ' ';\r
+                       },\r
+                       key:quote, //object calls it internally, the key part of an item in a map\r
+                       functionCode:'[code]', //function calls it internally, it's the content of the function\r
+                       attribute:quote, //node calls it internally, it's an html attribute value\r
+                       string:quote,\r
+                       date:quote,\r
+                       regexp:literal, //regex\r
+                       number:literal,\r
+                       'boolean':literal\r
+               },\r
+               DOMAttrs:{//attributes to dump from nodes, name=>realName\r
+                       id:'id',\r
+                       name:'name',\r
+                       'class':'className'\r
+               },\r
+               HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )\r
+               indentChar:'   ',//indentation unit\r
+               multiline:true //if true, items in a collection, are separated by a \n, else just a space.\r
+       };\r
+\r
+})();\r
index d2e6c3c2b553a45ccef19770d42e23a9e3dd790a..151595359a482ee4a0c73611a55107da096182bf 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.accordion.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index ec4d56eb789bf122ca3deb15476707c15fbf32d4..4f760a04247a84344d4b10f83bf375471a77550b 100644 (file)
@@ -18,7 +18,7 @@
        <script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
        <script type="text/javascript" src="../../ui/jquery.ui.tabs.js"></script>
 
-       <script type="text/javascript" src="../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../external/jquery.cookie-r6165.js"></script>
        <script type="text/javascript" src="../jquery.simulate.js"></script>
        <script type="text/javascript" src="testsuite.js"></script>
index 70f383b855a64e7a61c388c0e194d190b07e8d59..47afa3b425425883735b32dfb8cc90e457ea262f 100644 (file)
@@ -51,7 +51,7 @@
        <script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
        <script type="text/javascript" src="../../ui/jquery.ui.tabs.js"></script>
 
-       <script type="text/javascript" src="../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../external/jquery.cookie-r6165.js"></script>
        <script type="text/javascript" src="../jquery.simulate.js"></script>
 
index 73d0c382a4891790f109f9b47ef5c3a127aa0dde..e14f4365ecb02020d6674b690edf67cc49f6463c 100644 (file)
@@ -7,7 +7,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 05b266438c6ed4e453741f9ee6d063735c7f893d..a152c8dfa640fdea10a6334351c173db0738d4f6 100644 (file)
@@ -12,7 +12,7 @@
        <script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-he.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 85b9f8265dd939d4e20ff8c8ffcee321acb3d677..670b0bea5b9ab73e2144a49599048f4b31c0c66a 100644 (file)
@@ -19,7 +19,7 @@
 
        <link   type="text/css"       href="testsuite.css" rel="stylesheet" />
        <script type="text/javascript" src="testsuite.js"></script>
-       <script type="text/javascript" src="../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../external/jquery.cookie-r6165.js"></script>
        <script type="text/javascript" src="../jquery.simulate.js"></script>
 
index f21db56c5aa896aa0f12b2b1538aef0d7f79a4a3..14994e111db79a47106a3728519542a83beac4bd 100644 (file)
@@ -12,7 +12,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.dialog.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index da761a10fec3860389eb359ee080543cabbf06b2..17579ca8ad1c0a5b7fda148db9aec77d06691c20 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.draggable.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 916fd460a8619bd90c7ee73089026559d621d5d5..7a4fa238326369190652ade01b618bf54a0345b3 100644 (file)
@@ -9,7 +9,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.droppable.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index ce46f2377f243dadcb68fc05045661baa32fdc25..79df77bd6d5f2bf9f87c2dbebe138c64ee4c1337 100644 (file)
@@ -7,7 +7,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>\r
 \r
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />\r
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>\r
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>\r
        <script type="text/javascript" src="../testsuite.js"></script>\r
 \r
        <script type="text/javascript" src="position_core.js"></script>\r
index 8cf661ed42fd1b36f93954a129be1ecfc25a7d8e..3ed285d284267ea8ae0da66af025cc6bf006b6de 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.progressbar.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 3fb4a4ce8ff897118b255b6d5ef135f92f4da64f..8145c90b97693af434acef2310a298dd8f685fa3 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.resizable.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 7084ac7e5e2afc68acd378e04a18580d6ea25dce..ad6573b696ece32d7415a698ea74c2e12cdbda10 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.selectable.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index ae9e6d0b09c876ed77283d4ca0deb2cf707ad00e..a8034fadd556d1a64374d22e56c1294588809ca4 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.slider.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index 51174e99b95b4e06a84fd91dd0d3e60d726df0bd..53d0163556f5853e4c6e6321a342eee976f14be1 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.sortable.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>
 
index a886d305ee805342b5fb75074b61c6893de8eedf..e64f0f6576f7913f63e77a4392f69f996cc5e213 100644 (file)
@@ -8,7 +8,7 @@
        <script type="text/javascript" src="../../../ui/jquery.ui.tabs.js"></script>
 
        <link   type="text/css"       href="../testsuite.css" rel="stylesheet" />
-       <script type="text/javascript" src="../../../external/testrunner-r6574.js"></script>
+       <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
        <script type="text/javascript" src="../../../external/jquery.cookie-r6165.js"></script>
        <script type="text/javascript" src="../../jquery.simulate.js"></script>
        <script type="text/javascript" src="../testsuite.js"></script>