source: main/trunk/greenstone3/web/interfaces/oran/js/jquery-ui-1.8rc1/tests/unit/testsuite.js@ 24245

Last change on this file since 24245 was 24245, checked in by sjb48, 13 years ago

Oran code for supporting format changes to document.

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1// FIXME remove this once updated to jQuery core 1.3.3
2var hasDuplicate = false;
3
4function testWidgetDefaults(widget, defaults) {
5 var pluginDefaults = $.extend({},
6 $.ui[widget].prototype.options
7 );
8
9 // ensure that all defaults have the correct value
10 test('defined defaults', function() {
11 $.each(defaults, function(key, val) {
12 if ($.isFunction(val)) {
13 ok(val !== undefined, key);
14 return;
15 }
16 same(pluginDefaults[key], val, key);
17 });
18 });
19
20 // ensure that all defaults were tested
21 test('tested defaults', function() {
22 $.each(pluginDefaults, function(key, val) {
23 ok(key in defaults, key);
24 });
25 });
26}
27
28function testWidgetOverrides(widget) {
29 test('$.widget overrides', function() {
30 $.each(['_widgetInit', 'option', '_trigger'], function(i, method) {
31 ok($.Widget.prototype[method] == $.ui[widget].prototype[method],
32 'should not override ' + method);
33 });
34 });
35}
36
37function commonWidgetTests(widget, settings) {
38 module(widget + ": common widget");
39
40 testWidgetDefaults(widget, settings.defaults);
41 testWidgetOverrides(widget);
42}
43
44// load testswarm agent
45(function() {
46 var url = window.location.search;
47 url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
48 if ( !url || url.indexOf("http") !== 0 ) {
49 return;
50 }
51 document.write("<scr" + "ipt src='http://testswarm.com/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
52})();
Note: See TracBrowser for help on using the repository browser.