]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Moved tests out of _tickets into _core.
authorScott González <scott.gonzalez@gmail.com>
Mon, 28 Mar 2011 16:37:08 +0000 (12:37 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 28 Mar 2011 16:37:08 +0000 (12:37 -0400)
tests/unit/widget/widget.html
tests/unit/widget/widget_core.js
tests/unit/widget/widget_tickets.js [deleted file]

index 910345e4fab30c3980ea705f830f3bcbd3048333..e74abb317035b8bef9a031f0d1a18b877d9afaeb 100644 (file)
@@ -14,7 +14,6 @@
        <script src="../testsuite.js"></script>
 
        <script src="widget_core.js"></script>
-       <script src="widget_tickets.js"></script>
 
        <script src="../swarminject.js"></script>
 </head>
index 34f5ef67f4192826279e31cc9b5d90a61874e868..5a6717560486ff21a10a0e207d8562dc7d05788a 100644 (file)
@@ -288,6 +288,45 @@ test( "re-init", function() {
        same( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
 });
 
+test( "inheritance - options", function() {
+       // #5830 - Widget: Using inheritance overwrites the base classes options
+       $.widget( "ui.testWidgetBase", {
+               options: {
+                       obj: {
+                               key1: "foo",
+                               key2: "bar"
+                       },
+                       arr: [ "testing" ]
+               }
+       });
+
+       $.widget( "ui.testWidgetExtension", $.ui.testWidgetBase, {
+               options: {
+                       obj: {
+                               key1: "baz"
+                       },
+                       arr: [ "alpha", "beta" ]
+               }
+       });
+
+       same( $.ui.testWidgetBase.prototype.options.obj, {
+               key1: "foo",
+               key2: "bar"
+       }, "base class option object not overridden");
+       same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
+               "base class option array not overridden");
+
+       same( $.ui.testWidgetExtension.prototype.options.obj, {
+               key1: "baz",
+               key2: "bar"
+       }, "extension class option object extends base");
+       same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ],
+               "extension class option array overwrites base");
+
+       delete $.ui.testWidgetBase;
+       delete $.ui.testWidgetExtension;
+});
+
 test( "._super()", function() {
        expect( 9 );
        var instance;
@@ -795,6 +834,55 @@ test( "._trigger() - provide event and ui", function() {
        .testWidget( "testEvent" );
 });
 
+test( "._trigger() - array as ui", function() {
+       // #6795 - Widget: handle array arguments to _trigger consistently
+       expect( 4 );
+
+       $.widget( "ui.testWidget", {
+               _create: function() {},
+               testEvent: function() {
+                       var ui = {
+                                       foo: "bar",
+                                       baz: {
+                                               qux: 5,
+                                               quux: 20
+                                       }
+                               };
+                       var extra = {
+                               bar: 5
+                       };
+                       this._trigger( "foo", null, [ ui, extra ] );
+               }
+       });
+       $( "#widget" ).bind( "testwidgetfoo", function( event, ui, extra ) {
+               same( ui, {
+                       foo: "bar",
+                       baz: {
+                               qux: 5,
+                               quux: 20
+                       }
+               }, "event: ui hash passed" );
+               same( extra, {
+                       bar: 5
+               }, "event: extra argument passed" );
+       });
+       $( "#widget" ).testWidget({
+               foo: function( event, ui, extra ) {
+                       same( ui, {
+                               foo: "bar",
+                               baz: {
+                                       qux: 5,
+                                       quux: 20
+                               }
+                       }, "callback: ui hash passed" );
+                       same( extra, {
+                               bar: 5
+                       }, "callback: extra argument passed" );
+               }
+       })
+       .testWidget( "testEvent" );
+});
+
 test( "._trigger() - instance as element", function() {
        expect( 4 );
        $.widget( "ui.testWidget", {
diff --git a/tests/unit/widget/widget_tickets.js b/tests/unit/widget/widget_tickets.js
deleted file mode 100644 (file)
index 9c0bddf..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-(function( $ ) {
-
-module( "widget: tickets" );
-
-test( "#5830 - Widget: Using inheritance overwrites the base classes options", function() {
-       $.widget( "ui.testWidgetBase", {
-               options: {
-                       obj: {
-                               key1: "foo",
-                               key2: "bar"
-                       },
-                       arr: [ "testing" ]
-               }
-       });
-
-       $.widget( "ui.testWidgetExtension", $.ui.testWidgetBase, {
-               options: {
-                       obj: {
-                               key1: "baz"
-                       },
-                       arr: [ "alpha", "beta" ]
-               }
-       });
-
-       same( $.ui.testWidgetBase.prototype.options.obj, {
-               key1: "foo",
-               key2: "bar"
-       }, "base class option object not overridden");
-       same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
-               "base class option array not overridden");
-
-       same( $.ui.testWidgetExtension.prototype.options.obj, {
-               key1: "baz",
-               key2: "bar"
-       }, "extension class option object extends base");
-       same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ],
-               "extension class option array overwrites base");
-
-       delete $.ui.testWidgetBase;
-       delete $.ui.testWidgetExtension;
-});
-
-test( "#6795 - Widget: handle array arguments to _trigger consistently", function() {
-       expect( 4 );
-
-       $.widget( "ui.testWidget", {
-               _create: function() {},
-               testEvent: function() {
-                       var ui = {
-                                       foo: "bar",
-                                       baz: {
-                                               qux: 5,
-                                               quux: 20
-                                       }
-                               };
-                       var extra = {
-                               bar: 5
-                       };
-                       this._trigger( "foo", null, [ ui, extra ] );
-               }
-       });
-       $( "#widget" ).bind( "testwidgetfoo", function( event, ui, extra ) {
-               same( ui, {
-                       foo: "bar",
-                       baz: {
-                               qux: 5,
-                               quux: 20
-                       }
-               }, "event: ui hash passed" );
-               same( extra, {
-                       bar: 5
-               }, "event: extra argument passed" );
-       });
-       $( "#widget" ).testWidget({
-               foo: function( event, ui, extra ) {
-                       same( ui, {
-                               foo: "bar",
-                               baz: {
-                                       qux: 5,
-                                       quux: 20
-                               }
-                       }, "callback: ui hash passed" );
-                       same( extra, {
-                               bar: 5
-                       }, "callback: extra argument passed" );
-               }
-       })
-       .testWidget( "testEvent" );
-});
-
-}( jQuery ) );