r3389 committed - updating dev branch to latest trunk

r3389 committed - updating dev branch to latest trunk

Revision: 3389
Author: joern.zaefferer
Date: Sun Oct 25 03:27:04 2009
Log: updating dev branch to latest trunk
http://code.google.com/p/jquery-ui/source/detail?r=3389
Added:
/branches/dev/external/testrunner-r6588.js
/branches/dev/tests/visual/dialog/dialog_option_buttons_OK_Cancel.html
/branches/dev/ui/i18n/jquery.ui.datepicker-af.js
/branches/dev/ui/i18n/jquery.ui.datepicker-en-GB.js
Deleted:
/branches/dev/external/testrunner-r6574.js
Modified:
/branches/dev
/branches/dev/demos/datepicker/localization.html
/branches/dev/demos/index.html
/branches/dev/demos/sortable/portlets.html
/branches/dev/tests/unit/accordion/accordion.html
/branches/dev/tests/unit/all.html
/branches/dev/tests/unit/all_2.html
/branches/dev/tests/unit/core/core.html
/branches/dev/tests/unit/datepicker/datepicker.html
/branches/dev/tests/unit/defaults.html
/branches/dev/tests/unit/dialog/dialog.html
/branches/dev/tests/unit/draggable/draggable.html
/branches/dev/tests/unit/droppable/droppable.html
/branches/dev/tests/unit/position/position.html
/branches/dev/tests/unit/progressbar/progressbar.html
/branches/dev/tests/unit/resizable/resizable.html
/branches/dev/tests/unit/selectable/selectable.html
/branches/dev/tests/unit/slider/slider.html
/branches/dev/tests/unit/sortable/sortable.html
/branches/dev/tests/unit/tabs/tabs.html
/branches/dev/tests/visual/progressbar/default.html
/branches/dev/tests/visual/slider/slider_option_animate_true.html
/branches/dev/ui/jquery.ui.dialog.js
/branches/dev/ui/jquery.ui.slider.js
/branches/dev/ui/jquery.ui.sortable.js
/branches/dev/ui/jquery.ui.tabs.js
=======================================
--- /dev/null
+++ /branches/dev/external/testrunner-r6588.js    Sun Oct 25 03:27:04 2009
@@ -0,0 +1,925 @@
+/*
+ * QUnit - jQuery unit testrunner
+ *
+ * http://docs.jquery.com/QUnit
+ *
+ * Copyright (c) 2009 John Resig, Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * $Id: testrunner.js 6588 2009-09-29 00:07:51Z jeresig $
+ */
+
+(function() {
+
+// Test for equality any JavaScript type.
+// Discussions and reference: http://philrathe.com/articles/equiv
+// Test suites: http://philrathe.com/tests/equiv
+// Author: Philippe Rathé <prathe@gmail.com>
+var equiv = function () {
+
+ var innerEquiv; // the real equiv function
+ var callers = []; // stack to decide between skip/abort functions
+
+
+ // Determine what is o.
+ function hoozit(o) {
+ if (o.constructor === String) {
+ return "string";
+
+ } else if (o.constructor === Boolean) {
+ return "boolean";
+
+ } else if (o.constructor === Number) {
+
+ if (isNaN(o)) {
+ return "nan";
+ } else {
+ return "number";
+ }
+
+ } else if (typeof o === "undefined") {
+ return "undefined";
+
+ // consider: typeof null === object
+ } else if (o === null) {
+ return "null";
+
+ // consider: typeof [] === object
+ } else if (o instanceof Array) {
+ return "array";
+
+ // consider: typeof new Date() === object
+ } else if (o instanceof Date) {
+ return "date";
+
+ // consider: /./ instanceof Object;
+ // /./ instanceof RegExp;
+ // typeof /./ === "function"; // => false in IE and Opera,
+ // true in FF and Safari
+ } else if (o instanceof RegExp) {
+ return "regexp";
+
+ } else if (typeof o === "object") {
+ return "object";
+
+ } else if (o instanceof Function) {
+ return "function";
+ } else {
+ return undefined;
+ }
+ }
+
+ // Call the o related callback with the given arguments.
+ function bindCallbacks(o, callbacks, args) {
+ var prop = hoozit(o);
+ if (prop) {
+ if (hoozit(callbacks[prop]) === "function") {
+ return callbacks[prop].apply(callbacks, args);
+ } else {
+ return callbacks[prop]; // or undefined
+ }
+ }
+ }
+
+ var callbacks = function () {
+
+ // for string, boolean, number and null
+ function useStrictEquality(b, a) {
+ if (b instanceof a.constructor || a instanceof b.constructor) {
+ // to catch short annotaion VS 'new' annotation of a
declaration
+ // e.g. var i = 1;
+ // var j = new Number(1);
+ return a == b;
+ } else {
+ return a === b;
+ }
+ }
+
+ return {
+ "string": useStrictEquality,
+ "boolean": useStrictEquality,
+ "number": useStrictEquality,
+ "null": useStrictEquality,
+ "undefined": useStrictEquality,
+
+ "nan": function (b) {
+ return isNaN(b);
+ },
+
+ "date": function (b, a) {
+ return hoozit(b) === "date" && a.valueOf() === b.valueOf();
+ },
+
+ "regexp": function (b, a) {
+ return hoozit(b) === "regexp" &&
+ a.source === b.source && // the regex itself
+ a.global === b.global && // and its modifers (gmi) ...
+ a.ignoreCase === b.ignoreCase &&
+ a.multiline === b.multiline;
+ },
+
+ // - skip when the property is a method of an instance (OOP)
+ // - abort otherwise,
+ // initial === would have catch identical references anyway
+ "function": function () {
+ var caller = callers[callers.length - 1];
+ return caller !== Object &&
+ typeof caller !== "undefined";
+ },
+
+ "array": function (b, a) {
+ var i;
+ var len;
+
+ // b could be an object literal here
+ if ( ! (hoozit(b) === "array")) {
+ return false;
+ }
+
+ len = a.length;
+ if (len !== b.length) { // safe and faster
+ return false;
+ }
+ for (i = 0; i < len; i++) {
+ if( ! innerEquiv(a[i], b[i])) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "object": function (b, a) {
+ var i;
+ var eq = true; // unless we can proove it
+ var aProperties = [], bProperties = []; // collection of
strings
+
+ // comparing constructors is more strict than using
instanceof
+ if ( a.constructor !== b.constructor) {
+ return false;
+ }
+
+ // stack constructor before traversing properties
+ callers.push(a.constructor);
+
+ for (i in a) { // be strict: don't ensures hasOwnProperty
and go deep
+
+ aProperties.push(i); // collect a's properties
+
+ if ( ! innerEquiv(a[i], b[i])) {
+ eq = false;
+ }
+ }
+
+ callers.pop(); // unstack, we are done
+
+ for (i in b) {
+ bProperties.push(i); // collect b's properties
+ }
+
+ // Ensures identical properties name
+ return eq && innerEquiv(aProperties.sort(),
bProperties.sort());
+ }
+ };
+ }();
+
+ innerEquiv = function () { // can take multiple arguments
+ var args = Array.prototype.slice.apply(arguments);
+ if (args.length < 2) {
+ return true; // end transition
+ }
+
+ return (function (a, b) {
+ if (a === b) {
+ return true; // catch the most you can
+ } else if (a === null || b === null || typeof a
=== "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {
+ return false; // don't lose time with error prone cases
+ } else {
+ return bindCallbacks(a, callbacks, [b, a]);
+ }
+
+ // apply transition with (1..n) arguments
+ })(args[0], args[1]) && arguments.callee.apply(this,
args.splice(1, args.length -1));
+ };
+
+ return innerEquiv;
+
+}();
+
+var GETParams = location.search.slice(1).split('&'), ngindex = -1;
+
+for ( var i = 0; i < GETParams.length; i++ ) {
+    GETParams[i] = decodeURIComponent( GETParams[i] );
+    if ( GETParams[i] === "noglobals" ) {
+        ngindex = i;
+    }
+}
+
+var noglobals = ngindex !== -1;
+
+if ( noglobals ) {
+    GETParams.splice( ngindex, 1 );
+}
+
+var config = {
+    stats: {
+        all: 0,
+        bad: 0
+    },
+    queue: [],
+    // block until document ready
+    blocking: true,
+    //restrict modules/tests by get parameters
+    filters: GETParams,
+    isLocal: !!(window.location.protocol == 'file:')
+};
+
+// public API as global methods
+extend(window, {
+    test: test,
+    module: module,
+    expect: expect,
+    ok: ok,
+    equals: equals,
+    start: start,
+    stop: stop,
+    reset: reset,
+    isLocal: config.isLocal,
+    same: function(a, b, message) {
+        push(equiv(a, b), a, b, message);
+    },
+    QUnit: {
+        equiv: equiv,
+        ok: ok,
+        done: function(failures, total){},
+        log: function(result, message){}
+    },
+    // legacy methods below
+    isSet: isSet,
+    isObj: isObj,
+    compare: function() {
+        throw "compare is deprecated - use same() instead";
+    },
+    compare2: function() {
+        throw "compare2 is deprecated - use same() instead";
+    },
+    serialArray: function() {
+        throw "serialArray is deprecated - use jsDump.parse() instead";
+    },
+    q: q,
+    t: t,
+    url: url,
+    triggerEvent: triggerEvent
+});
+
+addEvent(window, "load", function(){
+
+    if ( !document.getElementById("header") ) {
+        var header = document.createElement("h1");
+        header.id = "header";
+        header.innerHTML = document.title;
+
+        var banner = document.createElement("h2");
+        banner.id = "banner";
+
+        var userAgent = document.createElement("h2");
+        userAgent.id = "userAgent";
+
+        var ol = document.createElement("ol");
+        ol.id = "tests";
+
+        document.body.insertBefore( ol, document.body.firstChild );
+        document.body.insertBefore( userAgent, document.body.firstChild );
+        document.body.insertBefore( banner, document.body.firstChild );
+        document.body.insertBefore( header, document.body.firstChild );
+    }
+
+    var userAgent = document.getElementById("userAgent");
+    if ( userAgent ) {
+        userAgent.innerHTML = navigator.userAgent;
+
+        var toolbar = document.createElement("div");
+        toolbar.className = "testrunner-toolbar";
+        userAgent.parentNode.insertBefore( toolbar, userAgent );
+
+        var filter = document.createElement("input");
+        filter.type = "checkbox";
+        filter.id = "filter-pass";
+        filter.disabled = true;
+        addEvent( filter, "click", function(){
+            var li = document.getElementsByTagName("li");
+            for ( var i = 0; i < li.length; i++ ) {
+                if ( li[i].className.indexOf("pass") > -1 ) {
+                    li[i].style.display = filter.checked ? "none" : "block";
+                }
+            }
+        });
+        toolbar.appendChild( filter );
+
+        var label = document.createElement("label");
+        label.setAttribute("for", "filter-pass");
+        label.innerHTML = "Hide passed tests";
+        toolbar.appendChild( label );
+
+        var missing = document.createElement("input");
+        missing.type = "checkbox";
+        missing.id = "filter-missing";
+        missing.disabled = true;
+        addEvent( missing, "click", function(){
+            var li = document.getElementsByTagName("li");
+            for ( var i = 0; i < li.length; i++ ) {
+                if ( li[i].className.indexOf("fail") > -1 &&
li[i].innerHTML.indexOf('missing test - untested code is broken code') > -
1 ) {
+                    li[i].parentNode.parentNode.style.display =
missing.checked ? "none" : "block";
+                }
+            }
+        });
+        toolbar.appendChild( missing );
+
+        label = document.createElement("label");
+        label.setAttribute("for", "filter-missing");
+        label.innerHTML = "Hide missing tests (untested code is broken code)";
+        toolbar.appendChild( label );
+    }
+
+    runTest();
+});
+
+function synchronize(callback) {
+    config.queue.push(callback);
+    if(!config.blocking) {
+        process();
+    }
+}
+
+function process() {
+    while(config.queue.length && !config.blocking) {
+        config.queue.shift()();
+    }
+}
+
+function stop(timeout) {
+    config.blocking = true;
+    if (timeout)
+        config.timeout = setTimeout(function() {
+            QUnit.ok( false, "Test timed out" );
+            start();
+        }, timeout);
+}
+function start() {
+    // A slight delay, to avoid any current callbacks
+    setTimeout(function() {
+        if(config.timeout)
+            clearTimeout(config.timeout);
+        config.blocking = false;
+        process();
+    }, 13);
+}
+
+function validTest( name ) {
+    var i = config.filters.length,
+        run = false;
+
+    if( !i )
+        return true;
+
+    while( i-- ){
+        var filter = config.filters[i],
+            not = filter.charAt(0) == '!';
+        if( not )
+            filter = filter.slice(1);
+        if( name.indexOf(filter) != -1 )
+            return !not;
+        if( not )
+            run = true;
+    }
+    return run;
+}
+
+function runTest() {
+    config.blocking = false;
+    var started = +new Date;
+    config.fixture = document.getElementById('main').innerHTML;
+
+    if ( window.jQuery ) {
+        config.ajaxSettings = window.jQuery.ajaxSettings;
+    }
+
+    synchronize(function() {
+        var html = ['Tests completed in ',
+            +new Date - started, ' milliseconds.<br/>',
+            '<span class="bad">', config.stats.all - config.stats.bad, '</span>
tests of <span class="all">', config.stats.all, '</span> passed, ',
config.stats.bad,' failed.'].join('');
+
+        var result = document.createElement("p");
+        result.id = "testresult";
+        result.className = "result";
+        result.innerHTML = html;
+        document.body.appendChild( result );
+
+        document.getElementById("banner").className +=
+            " " + (config.stats.bad ? "fail" : "pass");
+
+        QUnit.done( config.stats.bad, config.stats.all );
+    });
+}
+
+var pollution;
+
+function saveGlobal(){
+    pollution = [ ];
+
+    if ( noglobals ) {
+        for ( var key in window ) {
+            pollution.push(key);
+        }
+    }
+}
+
+function checkPollution( name ){
+    var old = pollution;
+    saveGlobal();
+
+    if ( pollution.length > old.length ){
+        ok( false, "Introduced global variable(s): " + diff(old,
pollution).join(", ") );
+        config.expected++;
+    }
+}
+
+function diff( clean, dirty ){
+    var results = [];
+
+    for ( var i = 0; i < dirty.length; i++ ) {
+        for ( var c = 0; c < clean.length; c++ ) {
+            if ( clean[c] === dirty[i] ) {
+                results.push( clean[c] );
+            }
+        }
+    }
+
+    return results;
+}
+
+function test(name, callback) {
+    if ( config.currentModule ) {
+        name = config.currentModule + " module: " + name;
+    }
+
+    var lifecycle = extend({
+        setup: function() {},
+        teardown: function() {}
+    }, config.moduleLifecycle);
+
+    if ( !validTest(name) ) {
+        return;
+    }
+
+    var testEnvironment = {};
+
+    synchronize(function() {
+        config.assertions = [];
+        config.expected = null;
+        try {
+            if ( !pollution ) {
+                saveGlobal();
+            }
+
+            lifecycle.setup.call(testEnvironment);
+        } catch(e) {
+            QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
+        }
+    });
+    synchronize(function() {
+        try {
+            callback.call(testEnvironment);
+        } catch(e) {
+            fail("Test " + name + " died, exception and test follows", e, callback);
+            QUnit.ok( false, "Died on test #" + (config.assertions.length + 1)
+ ": " + e.message );
+            // else next test will carry the responsibility
+            saveGlobal();
+        }
+    });
+    synchronize(function() {
+        try {
+            checkPollution();
+            lifecycle.teardown.call(testEnvironment);
+        } catch(e) {
+            QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
+        }
+    });
+    synchronize(function() {
+        try {
+            reset();
+        } catch(e) {
+            fail("reset() failed, following Test " + name + ", exception and reset
fn follows", e, reset);
+        }
+
+        if ( config.expected && config.expected != config.assertions.length ) {
+            QUnit.ok( false, "Expected " + config.expected + " assertions, but " +
config.assertions.length + " were run" );
+        }
+
+        var good = 0, bad = 0;
+        var ol = document.createElement("ol");
+        ol.style.display = "none";
+        config.stats.all += config.assertions.length;
+        for ( var i = 0; i < config.assertions.length; i++ ) {
+            var assertion = config.assertions[i];
+            var li = document.createElement("li");
+            li.className = assertion.result ? "pass" : "fail";
+            li.innerHTML = assertion.message || "(no message)";
+            ol.appendChild( li );
+            assertion.result ? good++ : bad++;
+        }
+        config.stats.bad += bad;
+
+        var b = document.createElement("strong");
+        b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad
+ "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length
+ ")</b>";
+        addEvent(b, "click", function(){
+            var next = b.nextSibling, display = next.style.display;
+            next.style.display = display === "none" ? "block" : "none";
+        });
+        addEvent(b, "dblclick", function(e){
+            var target = (e || window.event).target;
+            if ( target.nodeName.toLowerCase() === "strong" ) {
+                var text = "", node = target.firstChild;
+
+                while ( node.nodeType === 3 ) {
+                    text += node.nodeValue;
+                    node = node.nextSibling;
+                }
+
+                text = text.replace(/(^\s*|\s*$)/g, "");
+
+                location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" +
encodeURIComponent(text);
+            }
+        });
+
+        var li = document.createElement("li");
+        li.className = bad ? "fail" : "pass";
+        li.appendChild( b );
+        li.appendChild( ol );
+        document.getElementById("tests").appendChild( li );
+
+        if(bad) {
+            document.getElementById("filter-pass").disabled = null;
+            document.getElementById("filter-missing").disabled = null;
+        }
+    });
+}
+
+function fail(message, exception, callback) {
+    if( typeof console != "undefined" && console.error && console.warn ) {
+        console.error(message);
+        console.error(exception);
+        console.warn(callback.toString());
+    } else if (window.opera && opera.postError) {
+        opera.postError(message, exception, callback.toString);
+    }
+}
+
+// call on start of module test to prepend name to all tests
+function module(name, lifecycle) {
+    config.currentModule = name;
+    config.moduleLifecycle = lifecycle;
+}
+
+/**
+ * Specify the number of expected assertions to gurantee that failed test
(no assertions are run at all) don't slip through.
+ */
+function expect(asserts) {
+    config.expected = asserts;
+}
+
+/**
+ * Resets the test setup. Useful for tests that modify the DOM.
+ */
+function reset() {
+    if ( window.jQuery ) {
+        jQuery("#main").html( config.fixture );
+        jQuery.event.global = {};
+        jQuery.ajaxSettings = extend({}, config.ajaxSettings);
+    } else {
+        document.getElementById("main").innerHTML = config.fixture;
+    }
+}
+
+/**
+ * Asserts true.
+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+ */
+function ok(a, msg) {
+    QUnit.log(a, msg);
+
+    config.assertions.push({
+        result: !!a,
+        message: msg
+    });
+}
+
+/**
+ * Asserts that two arrays are the same
+ */
+function isSet(a, b, msg) {
+    function serialArray( a ) {
+        var r = [];
+
+        if ( a && a.length )
+     for ( var i = 0; i < a.length; i++ ) {
+     var str = a[i].nodeName;
+     if ( str ) {
+     str = str.toLowerCase();
+     if ( a[i].id )
+     str += "#" + a[i].id;
+     } else
+     str = a[i];
+     r.push( str );
+     }
+
+        return "[ " + r.join(", ") + " ]";
+    }
+    var ret = true;
+    if ( a && b && a.length != undefined && a.length == b.length ) {
+        for ( var i = 0; i < a.length; i++ )
+            if ( a[i] != b[i] )
+                ret = false;
+    } else
+        ret = false;
+    QUnit.ok( ret, !ret ? (msg + " expected: " + serialArray(b) + " result: "
+ serialArray(a)) : msg );
+}
+
+/**
+ * Asserts that two objects are equivalent
+ */
+function isObj(a, b, msg) {
+    var ret = true;
+
+    if ( a && b ) {
+        for ( var i in a )
+            if ( a[i] != b[i] )
+                ret = false;
+
+        for ( i in b )
+            if ( a[i] != b[i] )
+                ret = false;
+    } else
+        ret = false;
+
+ QUnit.ok( ret, msg );
+}
+
+/**
+ * Returns an array of elements with the given IDs, eg.
+ * @example q("main", "foo", "bar")
+ * @result [<div id="main">, <span id="foo">, <input id="bar">]
+ */
+function q() {
+    var r = [];
+    for ( var i = 0; i < arguments.length; i++ )
+        r.push( document.getElementById( arguments[i] ) );
+    return r;
+}
+
+/**
+ * Asserts that a select matches the given IDs
+ * @example t("Check for something", "//[a]", ["foo", "baar"]);
+ * @result returns true if "//[a]" return two elements with the IDs 'foo'
and 'baar'
+ */
+function t(a,b,c) {
+    var f = jQuery(b);
+    var s = "";
+    for ( var i = 0; i < f.length; i++ )
+        s += (s && ",") + '"' + f[i].id + '"';
+    isSet(f, q.apply(q,c), a + " (" + b + ")");
+}
+
+/**
+ * Add random number to url to stop IE from caching
+ *
+ * @example url("data/test.html")
+ * @result "data/tes