From a282bba6cdb63f2565562e358c93b9643ff09b54 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 15 Sep 2009 08:26:59 +0000 Subject: common widget tests: improve handling of functions (even same() can't compare two functions by their "content") --- tests/unit/testsuite.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index ca1463e47..1efb8b287 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -8,13 +8,17 @@ function testWidgetDefaults(widget, defaults) { // 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 @@ function testWidgetDefaults(widget, defaults) { instance = el.data(widget); $.each(defaults, function(key, val) { + if ($.isFunction(val)) { + ok(val !== undefined); + return; + } same(instance.options[key], val, key); }); el.remove(); -- cgit v1.2.3