Skip to content
Permalink
Browse files

common widget tests: improve handling of functions (even same() can't…

… compare two functions by their "content")
  • Loading branch information
jzaefferer committed Sep 15, 2009
1 parent 526f6c5 commit a282bba6cdb63f2565562e358c93b9643ff09b54
Showing with 9 additions and 1 deletion.
  1. +9 −1 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();

0 comments on commit a282bba

Please sign in to comment.
You can’t perform that action at this time.