r3599 committed - Common unit tests: Removed tests for defaults after init; plugins are ...
Revision: 3599
Author: scott.gonzalez
Date: Sun Jan 3 09:33:17 2010
Log: Common unit tests: Removed tests for defaults after init; plugins are
allowed to modify options to represent current state.
http://code.google.com/p/jquery-ui/source/detail?r=3599
Modified:
/branches/dev/tests/unit/testsuite.js
=======================================
--- /branches/dev/tests/unit/testsuite.js Tue Dec 22 20:30:15 2009
+++ /branches/dev/tests/unit/testsuite.js Sun Jan 3 09:33:17 2010
@@ -6,11 +6,11 @@
$.ui[widget].prototype.options
);
- // ensure that all defualts have the correct value
+ // ensure that all defaults have the correct value
test('defined defaults', function() {
$.each(defaults, function(key, val) {
if ($.isFunction(val)) {
- ok(val !== undefined);
+ ok(val !== undefined, key);
return;
}
same(pluginDefaults[key], val, key);
@@ -23,72 +23,21 @@
ok(key in defaults, key);
});
});
-
- // defaults after init
- test('defaults on init', function() {
- var el = $('<div/>')[widget](),
- instance = el.data(widget);
-
- $.each(defaults, function(key, val) {
- if ($.isFunction(val)) {
- ok(val !== undefined);
- return;
- }
- same(instance.options[key], val, key);
- });
- el.remove();
- });
-}
-
-//function testSettingOptions(widget, options) {
-// test('option values', function() {
-// var el = $('<div/>')[widget](),
-// instance = el.data(widget);
-//
-// $.each(options, function(i, option) {
-// $.each({
-// 'null': null,
-// 'false': false,
-// 'true': true,
-// zero: 0,
-// number: 1,
-// 'empty string': '',
-// string: 'string',
-// 'empty array': [],
-// array: ['array'],
-// 'empty object': {},
-// object: {obj: 'ect'},
-// date: new Date(),
-// regexp: /regexp/,
-// 'function': function() {}
-// }, function(type, val) {
-// el[widget]('option', option, val);
-// same(instance.options[option], val, option + ': ' + type);
-// });
-// });
-//
-// el.remove();
-// });
-//}
+}
function testWidgetOverrides(widget) {
test('$.widget overrides', function() {
- $.each(['option', '_getData', '_trigger'], function(i, method) {
+ $.each(['_widgetInit', 'option', '_trigger'], function(i, method) {
ok($.Widget.prototype[method] == $.ui[widget].prototype[method],
'should not override ' + method);
});
});
}
+
function commonWidgetTests(widget, settings) {
- var options = [];
- $.each(settings.defaults, function(option) {
- options.push(option);
- });
-
module(widget + ": common widget");
testWidgetDefaults(widget, settings.defaults);
-// testSettingOptions(widget, options);
testWidgetOverrides(widget);
}
--