]> source.dussan.org Git - jquery-ui.git/commitdiff
Droppable: Convert tests to new infrastructure
authorScott González <scott.gonzalez@gmail.com>
Tue, 7 Apr 2015 00:35:27 +0000 (20:35 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 9 Apr 2015 13:26:28 +0000 (09:26 -0400)
Ref #10119
Ref gh-1528

tests/unit/droppable/droppable.html
tests/unit/droppable/droppable_common.js
tests/unit/droppable/droppable_common_deprecated.js
tests/unit/droppable/droppable_core.js
tests/unit/droppable/droppable_deprecated.html
tests/unit/droppable/droppable_deprecated.js [new file with mode: 0644]
tests/unit/droppable/droppable_events.js
tests/unit/droppable/droppable_methods.js
tests/unit/droppable/droppable_options.js
tests/unit/droppable/droppable_test_helpers.js

index 4fc712a009a05701c75d745650604f94f70377c1..9021f8c78065da5cdddcf6f52203d70bccaf037f 100644 (file)
@@ -4,36 +4,9 @@
        <meta charset="utf-8">
        <title>jQuery UI Droppable Test Suite</title>
 
-       <script src="../../jquery.js"></script>
-       <script>
-       $.uiBackCompat = false;
-       </script>
-       <link rel="stylesheet" href="../../../external/qunit/qunit.css">
-       <script src="../../../external/qunit/qunit.js"></script>
-       <script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
-       <script src="../testsuite.js"></script>
-       <script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
-       <script>
-       TestHelpers.loadResources({
-               css: [ "core" ],
-               js: [
-                       "ui/core.js",
-                       "ui/widget.js",
-                       "ui/mouse.js",
-                       "ui/draggable.js",
-                       "ui/droppable.js"
-               ]
-       });
-       </script>
-
-       <script src="droppable_common.js"></script>
-       <script src="droppable_core.js"></script>
-       <script src="droppable_events.js"></script>
-       <script src="droppable_methods.js"></script>
-       <script src="droppable_options.js"></script>
-       <script src="droppable_test_helpers.js"></script>
-
-       <script src="../swarminject.js"></script>
+       <script src="../../lib/css.js" data-modules="core"></script>
+       <script src="../../lib/bootstrap.js" data-widget="droppable"
+               data-no-back-compat="true"></script>
 </head>
 <body>
 
index 87d3ca1dba512550483d1968d263d085db9500b4..ef8e116922c8dceafa4567c775375b0886c87939 100644 (file)
@@ -1,4 +1,9 @@
-TestHelpers.commonWidgetTests( "droppable", {
+define( [
+       "lib/common",
+       "ui/droppable"
+], function( common ) {
+
+common.testWidget( "droppable", {
        defaults: {
                accept: "*",
                addClasses: true,
@@ -17,3 +22,5 @@ TestHelpers.commonWidgetTests( "droppable", {
                over: null
        }
 });
+
+} );
index bd56aa35f9b3867b3953c8da13fb029cc6ba0af9..9d2f6c6b66c13294add361cb9357f12875a49816 100644 (file)
@@ -1,4 +1,9 @@
-TestHelpers.commonWidgetTests( "droppable", {
+define( [
+       "lib/common",
+       "ui/droppable"
+], function( common ) {
+
+common.testWidget( "droppable", {
        defaults: {
                accept: "*",
                activeClass: false,
@@ -19,3 +24,5 @@ TestHelpers.commonWidgetTests( "droppable", {
                over: null
        }
 });
+
+} );
index 53b08fd85655ea35396b9fc75f272bdbff689cc6..9ea789544e0ba9753e14fcd42011bdd62edffc24 100644 (file)
@@ -1,8 +1,8 @@
-/*
- * droppable_core.js
- */
-
-(function($) {
+define( [
+       "jquery",
+       "./droppable_test_helpers",
+       "ui/droppable"
+], function( $, droppableTestHelpers ) {
 
 module("droppable: core");
 
@@ -20,10 +20,10 @@ test("element types", function() {
 
                (typeName === "table" && el.append("<tr><td>content</td></tr>"));
                el.droppable();
-               TestHelpers.droppable.shouldDrop();
+               droppableTestHelpers.shouldDrop();
                el.droppable("destroy");
                el.remove();
        });
 });
 
-})(jQuery);
+} );
index 5af53a2f7b50e59da46a62a5fa3b2fddedb19579..e47b41c6bf698f492a81603150f5a21853e337d0 100644 (file)
@@ -4,33 +4,8 @@
        <meta charset="utf-8">
        <title>jQuery UI Droppable Test Suite</title>
 
-       <script src="../../jquery.js"></script>
-       <link rel="stylesheet" href="../../../external/qunit/qunit.css">
-       <script src="../../../external/qunit/qunit.js"></script>
-       <script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
-       <script src="../testsuite.js"></script>
-       <script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
-       <script>
-       TestHelpers.loadResources({
-               css: [ "core" ],
-               js: [
-                       "ui/core.js",
-                       "ui/widget.js",
-                       "ui/mouse.js",
-                       "ui/draggable.js",
-                       "ui/droppable.js"
-               ]
-       });
-       </script>
-
-       <script src="droppable_common_deprecated.js"></script>
-       <script src="droppable_core.js"></script>
-       <script src="droppable_events.js"></script>
-       <script src="droppable_methods.js"></script>
-       <script src="droppable_options.js"></script>
-       <script src="droppable_test_helpers.js"></script>
-
-       <script src="../swarminject.js"></script>
+       <script src="../../lib/css.js" data-modules="core"></script>
+       <script src="../../lib/bootstrap.js" data-widget="droppable" data-deprecated="true"></script>
 </head>
 <body>
 
diff --git a/tests/unit/droppable/droppable_deprecated.js b/tests/unit/droppable/droppable_deprecated.js
new file mode 100644 (file)
index 0000000..3931f5f
--- /dev/null
@@ -0,0 +1 @@
+define( function() {} );
index 1b205bc973674804566b3a07c48c5a41d20f9366..a60d9292ee37af80260c38bd5a1eb4d29b65b0a4 100644 (file)
@@ -1,4 +1,7 @@
-(function( $ ) {
+define( [
+       "jquery",
+       "ui/droppable"
+], function( $ ) {
 
 module( "droppable: events" );
 
@@ -58,4 +61,4 @@ test("drop", function() {
 });
 */
 
-})( jQuery );
+} );
index aebaf490c71889453bc511f0de7606e701c7e319..70a60d2cbc29f7adaf373bede7e65fcde1a1647a 100644 (file)
@@ -1,7 +1,8 @@
-/*
- * droppable_methods.js
- */
-(function($) {
+define( [
+       "jquery",
+       "./droppable_test_helpers",
+       "ui/droppable"
+], function( $, droppableTestHelpers ) {
 
 module("droppable: methods");
 
@@ -47,16 +48,16 @@ test("enable", function() {
        var el, expected, actual;
 
        el = $("#droppable1").droppable({ disabled: true });
-       TestHelpers.droppable.shouldNotDrop();
+       droppableTestHelpers.shouldNotDrop();
        el.droppable("enable");
-       TestHelpers.droppable.shouldDrop();
+       droppableTestHelpers.shouldDrop();
        equal(el.droppable("option", "disabled"), false, "disabled option getter");
        el.droppable("destroy");
        el.droppable({ disabled: true });
-       TestHelpers.droppable.shouldNotDrop();
+       droppableTestHelpers.shouldNotDrop();
        el.droppable("option", "disabled", false);
        equal(el.droppable("option", "disabled"), false, "disabled option setter");
-       TestHelpers.droppable.shouldDrop();
+       droppableTestHelpers.shouldDrop();
 
        expected = $("<div></div>").droppable(),
        actual = expected.droppable("enable");
@@ -69,23 +70,23 @@ test( "disable", function( assert ) {
        var actual, expected,
                element = $( "#droppable1" ).droppable({ disabled: false });
 
-       TestHelpers.droppable.shouldDrop();
+       droppableTestHelpers.shouldDrop();
        element.droppable( "disable" );
-       TestHelpers.droppable.shouldNotDrop();
+       droppableTestHelpers.shouldNotDrop();
        equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
        element.droppable( "destroy" );
        element.droppable({ disabled: false });
-       TestHelpers.droppable.shouldDrop();
+       droppableTestHelpers.shouldDrop();
        element.droppable( "option", "disabled", true );
        assert.lacksClasses( element.droppable( "widget" ), "ui-state-disabled" );
        ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
        assert.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
        equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
-       TestHelpers.droppable.shouldNotDrop();
+       droppableTestHelpers.shouldNotDrop();
 
        expected = $( "<div></div>" ).droppable();
        actual = expected.droppable( "disable" );
        equal( actual, expected, "disable is chainable" );
 });
 
-})( jQuery );
+} );
index 9a4be076d17f08a1c2688b408fb421c0f0191e19..24a1a788eaec1015ee0e14f837c5bd9e2d05dd6a 100644 (file)
@@ -1,7 +1,8 @@
-/*
- * droppable_options.js
- */
-(function($) {
+define( [
+       "jquery",
+       "./droppable_test_helpers",
+       "ui/droppable"
+], function( $ ) {
 
 module( "droppable: options" );
 
@@ -202,4 +203,4 @@ test( "tolerance, touch", function() {
        ok(false, 'missing test - untested code is broken code');
 });
 */
-})(jQuery);
+} );
index ce972be634680eb0a61fe769601bd39c0488c755..5ffb32f4c610aa590733beba993e37301438c2e7 100644 (file)
@@ -1,4 +1,6 @@
-TestHelpers.droppable = {
+define( function() {
+
+return {
        shouldDrop: function() {
                // todo: actually implement this
                ok(true, "missing test - untested code is broken code");
@@ -8,3 +10,5 @@ TestHelpers.droppable = {
                ok(true, "missing test - untested code is broken code");
        }
 };
+
+} );