diff options
author | Richard Worth <rdworth@gmail.com> | 2009-04-17 21:28:37 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2009-04-17 21:28:37 +0000 |
commit | 8fac95cea31704ed0d38e391887f390ece9a2c60 (patch) | |
tree | 772edc183ace915ec0c23b225143795485753c0b /tests/unit/testsuite.js | |
parent | bfb127f2d2b15e3576faeeac08533f49121da654 (diff) | |
download | jquery-ui-8fac95cea31704ed0d38e391887f390ece9a2c60.tar.gz jquery-ui-8fac95cea31704ed0d38e391887f390ece9a2c60.zip |
whitespace
Diffstat (limited to 'tests/unit/testsuite.js')
-rw-r--r-- | tests/unit/testsuite.js | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 05dfcbe1e..fda323af5 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -11,83 +11,83 @@ $('body').prepend( }); function testWidgetDefaults(widget, defaults) { - var pluginDefaults = $.extend({}, - $.widget.defaults, - $.ui[widget].defaults - ); - - // ensure that all defualts have the correct value - test('defined defaults', function() { - $.each(defaults, function(key, val) { - same(pluginDefaults[key], val, key); - }); - }); - - // ensure that all defaults were tested - test('tested defaults', function() { - $.each(pluginDefaults, function(key) { - 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) { - same(instance.options[key], val, key); - }); - el.remove(); - }); + var pluginDefaults = $.extend({}, + $.widget.defaults, + $.ui[widget].defaults + ); + + // ensure that all defualts have the correct value + test('defined defaults', function() { + $.each(defaults, function(key, val) { + same(pluginDefaults[key], val, key); + }); + }); + + // ensure that all defaults were tested + test('tested defaults', function() { + $.each(pluginDefaults, function(key) { + 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) { + 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); - }); - }); - }); + 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); + }); + }); + }); } function testWidgetOverrides(widget) { - test('$.widget overrides', function() { - $.each(['option', '_getData', '_trigger'], function(i, method) { - ok($.widget.prototype[method] == $.ui[widget].prototype[method], - 'should not override ' + method); - }); - }); + test('$.widget overrides', function() { + $.each(['option', '_getData', '_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); - }); - + var options = []; + $.each(settings.defaults, function(option) { + options.push(option); + }); + module(widget + ": common widget"); - testWidgetDefaults(widget, settings.defaults); - testSettingOptions(widget, options); - testWidgetOverrides(widget); + testWidgetDefaults(widget, settings.defaults); + testSettingOptions(widget, options); + testWidgetOverrides(widget); } |