aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/sortable
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-04-07 10:30:07 -0400
committerScott González <scott.gonzalez@gmail.com>2015-04-09 09:26:58 -0400
commitdc4b015a8b9acdb5bff2d5dd89737b3d8b64097f (patch)
treef2dc9ecccc32b33622aef1e597992e5a668efe56 /tests/unit/sortable
parent42566bdd037ac57cf7d6d7a5d059db2ba42518d9 (diff)
downloadjquery-ui-dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f.tar.gz
jquery-ui-dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f.zip
Tests: Widget test helpers extend the main helper
Ref #10119 Ref gh-1528
Diffstat (limited to 'tests/unit/sortable')
-rw-r--r--tests/unit/sortable/sortable_core.js4
-rw-r--r--tests/unit/sortable/sortable_events.js4
-rw-r--r--tests/unit/sortable/sortable_methods.js14
-rw-r--r--tests/unit/sortable/sortable_test_helpers.js9
4 files changed, 17 insertions, 14 deletions
diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js
index 0a7506184..64bdb661e 100644
--- a/tests/unit/sortable/sortable_core.js
+++ b/tests/unit/sortable/sortable_core.js
@@ -2,7 +2,7 @@ define( [
"jquery",
"./sortable_test_helpers",
"ui/sortable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module( "sortable: core" );
@@ -13,7 +13,7 @@ test( "#9314: Sortable: Items cannot be dragged directly into bottom position",
connectWith: ".connectWith"
});
- sortableTestHelpers.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
+ testHelper.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
});
test( "ui-sortable-handle applied to appropriate element", function( assert ) {
diff --git a/tests/unit/sortable/sortable_events.js b/tests/unit/sortable/sortable_events.js
index 2bf9efe30..453b8b7b6 100644
--- a/tests/unit/sortable/sortable_events.js
+++ b/tests/unit/sortable/sortable_events.js
@@ -3,7 +3,7 @@ define( [
"./sortable_test_helpers",
"ui/sortable",
"ui/draggable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module("sortable: events");
@@ -172,7 +172,7 @@ test("#3019: Stop fires too early", function() {
}
});
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
+ testHelper.sort($("li", el)[0], 0, 44, 2, "Dragging the sortable");
equal(helper, null, "helper should be false");
});
diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js
index b1057fc8e..d3bb23d6e 100644
--- a/tests/unit/sortable/sortable_methods.js
+++ b/tests/unit/sortable/sortable_methods.js
@@ -2,7 +2,7 @@ define( [
"jquery",
"./sortable_test_helpers",
"ui/sortable"
-], function( $, sortableTestHelpers ) {
+], function( $, testHelper ) {
module("sortable: methods");
@@ -48,7 +48,7 @@ test("enable", function() {
el = $("#sortable").sortable({ disabled: true });
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
+ testHelper.sort($("li", el)[0], 0, 44, 0, ".sortable({ disabled: true })");
el.sortable("enable");
equal(el.sortable("option", "disabled"), false, "disabled option getter");
@@ -58,7 +58,7 @@ test("enable", function() {
el.sortable("option", "disabled", false);
equal(el.sortable("option", "disabled"), false, "disabled option setter");
- sortableTestHelpers.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
+ testHelper.sort($("li", el)[0], 0, 44, 2, ".sortable('option', 'disabled', false)");
expected = $("<div></div>").sortable(),
actual = expected.sortable("enable");
@@ -71,15 +71,15 @@ test( "disable", function( assert ) {
var chainable,
element = $( "#sortable" ).sortable({ disabled: false });
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
chainable = element.sortable( "disable" );
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
element.sortable( "destroy" );
element.sortable({ disabled: false });
- sortableTestHelpers.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ testHelper.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
element.sortable( "option", "disabled", true);
equal( element.sortable( "option", "disabled" ), true, "disabled option setter" );
@@ -87,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" );
- sortableTestHelpers.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
+ testHelper.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
equal( chainable, element, "disable is chainable" );
});
diff --git a/tests/unit/sortable/sortable_test_helpers.js b/tests/unit/sortable/sortable_test_helpers.js
index 5f4f8aca6..76545022e 100644
--- a/tests/unit/sortable/sortable_test_helpers.js
+++ b/tests/unit/sortable/sortable_test_helpers.js
@@ -1,6 +1,9 @@
-define( function() {
+define( [
+ "jquery",
+ "lib/helper"
+], function( $, helper ) {
-return {
+return $.extend( helper, {
sort: function( handle, dx, dy, index, msg ) {
$( handle ).simulate( "drag", {
dx: dx,
@@ -8,6 +11,6 @@ return {
});
equal( $( handle ).parent().children().index( handle ), index, msg );
}
-};
+} );
} );