r3216 committed - common widget tests: improve handling of functions (even same() can't ...

r3216 committed - common widget tests: improve handling of functions (even same() can't ...


Revision: 3216
Author: joern.zaefferer
Date: Tue Sep 15 01:26:59 2009
Log: common widget tests: improve handling of functions (even same() can't
compare two functions by their "content")
http://code.google.com/p/jquery-ui/source/detail?r=3216
Modified:
/trunk/tests/unit/testsuite.js
=======================================
--- /trunk/tests/unit/testsuite.js    Fri Sep 11 11:31:15 2009
+++ /trunk/tests/unit/testsuite.js    Tue Sep 15 01:26:59 2009
@@ -8,13 +8,17 @@
    // ensure that all defualts have the correct value
    test('defined defaults', function() {
        $.each(defaults, function(key, val) {
+            if ($.isFunction(val)) {
+                ok(val !== undefined);
+                return;
+            }
            same(pluginDefaults[key], val, key);
        });
    });
    // ensure that all defaults were tested
    test('tested defaults', function() {
-        $.each(pluginDefaults, function(key) {
+        $.each(pluginDefaults, function(key, val) {
            ok(key in defaults, key);
        });
    });
@@ -25,6 +29,10 @@
            instance = el.data(widget);
        $.each(defaults, function(key, val) {
+            if ($.isFunction(val)) {
+                ok(val !== undefined);
+                return;
+            }
            same(instance.options[key], val, key);
        });
        el.remove();