aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-04-06 14:50:39 -0400
committerScott González <scott.gonzalez@gmail.com>2015-04-09 09:26:26 -0400
commit31e36e6ae4e1552b9a79595695c13dce4f416d0b (patch)
treecd14ab3e7d255500ccb00046d508d03135b1ef1e /tests
parenta856dd9b7e00982cbe4dc9a2dce8ca940728126d (diff)
downloadjquery-ui-31e36e6ae4e1552b9a79595695c13dce4f416d0b.tar.gz
jquery-ui-31e36e6ae4e1552b9a79595695c13dce4f416d0b.zip
Sortable: Convert tests to new infrastructure
Ref #10119 Ref gh-1528
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/sortable/sortable.html29
-rw-r--r--tests/unit/sortable/sortable_common.js9
-rw-r--r--tests/unit/sortable/sortable_core.js14
-rw-r--r--tests/unit/sortable/sortable_events.js14
-rw-r--r--tests/unit/sortable/sortable_methods.js23
-rw-r--r--tests/unit/sortable/sortable_options.js10
-rw-r--r--tests/unit/sortable/sortable_test_helpers.js6
7 files changed, 47 insertions, 58 deletions
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html
index 49b347582..a4c94ba0d 100644
--- a/tests/unit/sortable/sortable.html
+++ b/tests/unit/sortable/sortable.html
@@ -4,33 +4,8 @@
<meta charset="utf-8">
<title>jQuery UI Sortable 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/sortable.js",
- "ui/draggable.js"
- ]
- });
- </script>
-
- <script src="sortable_common.js"></script>
- <script src="sortable_core.js"></script>
- <script src="sortable_events.js"></script>
- <script src="sortable_methods.js"></script>
- <script src="sortable_options.js"></script>
- <script src="sortable_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="sortable"></script>
<style>
#sortable, #sortable2 {
position:relative;
diff --git a/tests/unit/sortable/sortable_common.js b/tests/unit/sortable/sortable_common.js
index dca26c75c..ab43251ab 100644
--- a/tests/unit/sortable/sortable_common.js
+++ b/tests/unit/sortable/sortable_common.js
@@ -1,4 +1,9 @@
-TestHelpers.commonWidgetTests( "sortable", {
+define( [
+ "lib/common",
+ "ui/sortable"
+], function( common ) {
+
+common.testWidget( "sortable", {
defaults: {
appendTo: "parent",
axis: false,
@@ -44,3 +49,5 @@ TestHelpers.commonWidgetTests( "sortable", {
update: null
}
});
+
+} );
diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js
index ac027486b..0a7506184 100644
--- a/tests/unit/sortable/sortable_core.js
+++ b/tests/unit/sortable/sortable_core.js
@@ -1,8 +1,8 @@
-/*
- * sortable_core.js
- */
-
-(function( $ ) {
+define( [
+ "jquery",
+ "./sortable_test_helpers",
+ "ui/sortable"
+], function( $, sortableTestHelpers ) {
module( "sortable: core" );
@@ -13,7 +13,7 @@ test( "#9314: Sortable: Items cannot be dragged directly into bottom position",
connectWith: ".connectWith"
});
- TestHelpers.sortable.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
+ sortableTestHelpers.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
});
test( "ui-sortable-handle applied to appropriate element", function( assert ) {
@@ -39,4 +39,4 @@ test( "ui-sortable-handle applied to appropriate element", function( assert ) {
equal( el.find( ".ui-sortable-handle" ).length, 0, "class name removed on destroy" );
});
-})( jQuery );
+} );
diff --git a/tests/unit/sortable/sortable_events.js b/tests/unit/sortable/sortable_events.js
index 46e86c906..2bf9efe30 100644
--- a/tests/unit/sortable/sortable_events.js
+++ b/tests/unit/sortable/sortable_events.js
@@ -1,7 +1,9 @@
-/*
- * sortable_events.js
- */
-(function($) {
+define( [
+ "jquery",
+ "./sortable_test_helpers",
+ "ui/sortable",
+ "ui/draggable"
+], function( $, sortableTestHelpers ) {
module("sortable: events");
@@ -170,7 +172,7 @@ test("#3019: Stop fires too early", function() {
}
});
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
+ sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
equal(helper, null, "helper should be false");
});
@@ -373,4 +375,4 @@ test("deactivate", function() {
});
*/
-})(jQuery);
+} );
diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js
index 822bc082e..b1057fc8e 100644
--- a/tests/unit/sortable/sortable_methods.js
+++ b/tests/unit/sortable/sortable_methods.js
@@ -1,7 +1,8 @@
-/*
- * sortable_methods.js
- */
-(function($) {
+define( [
+ "jquery",
+ "./sortable_test_helpers",
+ "ui/sortable"
+], function( $, sortableTestHelpers ) {
module("sortable: methods");
@@ -47,7 +48,7 @@ test("enable", function() {
el = $("#sortable").sortable({ disabled: true });
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
+ sortableTestHelpers.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
el.sortable("enable");
equal(el.sortable("option", "disabled"), false, "disabled option getter");
@@ -57,7 +58,7 @@ test("enable", function() {
el.sortable("option", "disabled", false);
equal(el.sortable("option", "disabled"), false, "disabled option setter");
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
+ sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
expected = $("<div></div>").sortable(),
actual = expected.sortable("enable");
@@ -70,15 +71,15 @@ test( "disable", function( assert ) {
var chainable,
element = $( "#sortable" ).sortable({ disabled: false });
- TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
chainable = element.sortable( "disable" );
- TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
+ sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
element.sortable( "destroy" );
element.sortable({ disabled: false });
- TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
element.sortable( "option", "disabled", true);
equal( element.sortable( "option", "disabled" ), true, "disabled option setter" );
@@ -86,7 +87,7 @@ test( "disable", function( assert ) {
ok( !element.sortable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
assert.hasClasses( element.sortable( "widget" ), "ui-sortable-disabled" );
- TestHelpers.sortable.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
+ sortableTestHelpers.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
equal( chainable, element, "disable is chainable" );
});
@@ -125,4 +126,4 @@ test( "refresh() should update the positions of initially empty lists (see #7498
equal( changeCount, 1 );
});
-})(jQuery);
+} );
diff --git a/tests/unit/sortable/sortable_options.js b/tests/unit/sortable/sortable_options.js
index 03308cb18..930f339e6 100644
--- a/tests/unit/sortable/sortable_options.js
+++ b/tests/unit/sortable/sortable_options.js
@@ -1,7 +1,7 @@
-/*
- * sortable_options.js
- */
-(function($) {
+define( [
+ "jquery",
+ "ui/sortable"
+], function( $ ) {
module("sortable: options");
@@ -493,4 +493,4 @@ test("{ zIndex: false }", function() {
ok(false, "missing test - untested code is broken code.");
});
*/
-})(jQuery);
+} );
diff --git a/tests/unit/sortable/sortable_test_helpers.js b/tests/unit/sortable/sortable_test_helpers.js
index 3cda43b8f..5f4f8aca6 100644
--- a/tests/unit/sortable/sortable_test_helpers.js
+++ b/tests/unit/sortable/sortable_test_helpers.js
@@ -1,4 +1,6 @@
-TestHelpers.sortable = {
+define( function() {
+
+return {
sort: function( handle, dx, dy, index, msg ) {
$( handle ).simulate( "drag", {
dx: dx,
@@ -7,3 +9,5 @@ TestHelpers.sortable = {
equal( $( handle ).parent().children().index( handle ), index, msg );
}
};
+
+} );