diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-06 20:35:27 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:26:28 -0400 |
commit | 669e62d61b52a31efc7666bf95d0bfe2df2f839d (patch) | |
tree | 2a4836523ac048029499e130fa667da9c163f574 | |
parent | a2da340e0d1b02d243c71b86382e5e624e7211d6 (diff) | |
download | jquery-ui-669e62d61b52a31efc7666bf95d0bfe2df2f839d.tar.gz jquery-ui-669e62d61b52a31efc7666bf95d0bfe2df2f839d.zip |
Droppable: Convert tests to new infrastructure
Ref #10119
Ref gh-1528
-rw-r--r-- | tests/unit/droppable/droppable.html | 33 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_common.js | 9 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_common_deprecated.js | 9 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_core.js | 14 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_deprecated.html | 29 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_deprecated.js | 1 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_events.js | 7 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_methods.js | 27 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_options.js | 11 | ||||
-rw-r--r-- | tests/unit/droppable/droppable_test_helpers.js | 6 |
10 files changed, 59 insertions, 87 deletions
diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index 4fc712a00..9021f8c78 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -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> diff --git a/tests/unit/droppable/droppable_common.js b/tests/unit/droppable/droppable_common.js index 87d3ca1db..ef8e11692 100644 --- a/tests/unit/droppable/droppable_common.js +++ b/tests/unit/droppable/droppable_common.js @@ -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 } }); + +} ); diff --git a/tests/unit/droppable/droppable_common_deprecated.js b/tests/unit/droppable/droppable_common_deprecated.js index bd56aa35f..9d2f6c6b6 100644 --- a/tests/unit/droppable/droppable_common_deprecated.js +++ b/tests/unit/droppable/droppable_common_deprecated.js @@ -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 } }); + +} ); diff --git a/tests/unit/droppable/droppable_core.js b/tests/unit/droppable/droppable_core.js index 53b08fd85..9ea789544 100644 --- a/tests/unit/droppable/droppable_core.js +++ b/tests/unit/droppable/droppable_core.js @@ -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); +} ); diff --git a/tests/unit/droppable/droppable_deprecated.html b/tests/unit/droppable/droppable_deprecated.html index 5af53a2f7..e47b41c6b 100644 --- a/tests/unit/droppable/droppable_deprecated.html +++ b/tests/unit/droppable/droppable_deprecated.html @@ -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 index 000000000..3931f5f06 --- /dev/null +++ b/tests/unit/droppable/droppable_deprecated.js @@ -0,0 +1 @@ +define( function() {} ); diff --git a/tests/unit/droppable/droppable_events.js b/tests/unit/droppable/droppable_events.js index 1b205bc97..a60d9292e 100644 --- a/tests/unit/droppable/droppable_events.js +++ b/tests/unit/droppable/droppable_events.js @@ -1,4 +1,7 @@ -(function( $ ) { +define( [ + "jquery", + "ui/droppable" +], function( $ ) { module( "droppable: events" ); @@ -58,4 +61,4 @@ test("drop", function() { }); */ -})( jQuery ); +} ); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index aebaf490c..70a60d2cb 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -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 ); +} ); diff --git a/tests/unit/droppable/droppable_options.js b/tests/unit/droppable/droppable_options.js index 9a4be076d..24a1a788e 100644 --- a/tests/unit/droppable/droppable_options.js +++ b/tests/unit/droppable/droppable_options.js @@ -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); +} ); diff --git a/tests/unit/droppable/droppable_test_helpers.js b/tests/unit/droppable/droppable_test_helpers.js index ce972be63..5ffb32f4c 100644 --- a/tests/unit/droppable/droppable_test_helpers.js +++ b/tests/unit/droppable/droppable_test_helpers.js @@ -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"); } }; + +} ); |