aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-04-06 12:42:49 -0400
committerScott González <scott.gonzalez@gmail.com>2015-04-09 09:26:26 -0400
commitfbc55446fbc397f7f176fd907fd5da5ff3d3abad (patch)
tree201fc1d4cd7db849aad4ebc57e19072f55556021
parent9fb04e42a24263a88dc3adf1b9ce6a199309b24c (diff)
downloadjquery-ui-fbc55446fbc397f7f176fd907fd5da5ff3d3abad.tar.gz
jquery-ui-fbc55446fbc397f7f176fd907fd5da5ff3d3abad.zip
Draggable: Convert tests to new infrastructure
Ref #10119 Ref gh-1528
-rw-r--r--tests/unit/draggable/draggable.html143
-rw-r--r--tests/unit/draggable/draggable_common.js9
-rw-r--r--tests/unit/draggable/draggable_core.js41
-rw-r--r--tests/unit/draggable/draggable_events.js10
-rw-r--r--tests/unit/draggable/draggable_methods.js27
-rw-r--r--tests/unit/draggable/draggable_options.js244
-rw-r--r--tests/unit/draggable/draggable_test_helpers.js23
7 files changed, 245 insertions, 252 deletions
diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html
index 81fbd8986..7ac6db388 100644
--- a/tests/unit/draggable/draggable.html
+++ b/tests/unit/draggable/draggable.html
@@ -4,94 +4,65 @@
<meta charset="utf-8">
<title>jQuery UI Draggable Test Suite</title>
- <script src="../../jquery.js"></script>
- <link rel="stylesheet" href="../../../external/qunit/qunit.css">
-
+ <script src="../../lib/css.js" data-modules="core"></script>
+ <script src="../../lib/bootstrap.js" data-widget="draggable"></script>
<style>
- #main {
- width: 1000px;
- height: 1000px;
- overflow: scroll;
- overflow-x: scroll;
- overflow-y: scroll;
- position: relative;
- left: 0;
- top: 0;
- }
- #main-forceScrollable {
- position: absolute;
- left: 0;
- top: 0;
- width: 1100px;
- height: 1100px;
- }
- #scrollParent {
- width: 1200px;
- height: 1200px;
- position: relative;
- left: 0;
- top: 0;
- overflow: hidden;
- overflow-x: hidden;
- overflow-y: hidden;
- }
- #scrollParent-forceScrollable {
- position: absolute;
- left: 0;
- top: 0;
- width: 1300px;
- height: 1300px;
- }
- /* See #9077 */
- #draggable3, #draggable4 {
- z-index: 100;
- }
- .sortable {
- position: relative;
- top: 8000px;
- left: 10px;
- width: 300px;
- padding: 0;
- margin: 0;
- border: 0;
- }
- .sortable li {
- height: 100px;
- padding: 0;
- margin: 0;
- border: 0;
- list-style: none;
- display: inline-block;
- }
+ #main {
+ width: 1000px;
+ height: 1000px;
+ overflow: scroll;
+ overflow-x: scroll;
+ overflow-y: scroll;
+ position: relative;
+ left: 0;
+ top: 0;
+ }
+ #main-forceScrollable {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 1100px;
+ height: 1100px;
+ }
+ #scrollParent {
+ width: 1200px;
+ height: 1200px;
+ position: relative;
+ left: 0;
+ top: 0;
+ overflow: hidden;
+ overflow-x: hidden;
+ overflow-y: hidden;
+ }
+ #scrollParent-forceScrollable {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 1300px;
+ height: 1300px;
+ }
+ /* See #9077 */
+ #draggable3, #draggable4 {
+ z-index: 100;
+ }
+ .sortable {
+ position: relative;
+ top: 8000px;
+ left: 10px;
+ width: 300px;
+ padding: 0;
+ margin: 0;
+ border: 0;
+ }
+ .sortable li {
+ height: 100px;
+ padding: 0;
+ margin: 0;
+ border: 0;
+ list-style: none;
+ display: inline-block;
+ }
</style>
-
- <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/resizable.js",
- "ui/draggable.js",
- "ui/droppable.js",
- "ui/sortable.js"
- ]
- });
- </script>
-
- <script src="draggable_common.js"></script>
- <script src="draggable_core.js"></script>
- <script src="draggable_events.js"></script>
- <script src="draggable_methods.js"></script>
- <script src="draggable_options.js"></script>
- <script src="draggable_test_helpers.js"></script>
-
- <script src="../swarminject.js"></script>
</head>
<body>
diff --git a/tests/unit/draggable/draggable_common.js b/tests/unit/draggable/draggable_common.js
index 6a70cd7d4..7ae032c0f 100644
--- a/tests/unit/draggable/draggable_common.js
+++ b/tests/unit/draggable/draggable_common.js
@@ -1,4 +1,9 @@
-TestHelpers.commonWidgetTests( "draggable", {
+define( [
+ "lib/common",
+ "ui/draggable"
+], function( common ) {
+
+common.testWidget( "draggable", {
defaults: {
appendTo: "parent",
axis: false,
@@ -39,3 +44,5 @@ TestHelpers.commonWidgetTests( "draggable", {
stop: null
}
});
+
+} );
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js
index b3a7e7ef3..30d75b880 100644
--- a/tests/unit/draggable/draggable_core.js
+++ b/tests/unit/draggable/draggable_core.js
@@ -1,8 +1,11 @@
-/*
- * draggable_core.js
- */
-
-(function( $ ) {
+define( [
+ "jquery",
+ "lib/helper",
+ "./draggable_test_helpers",
+ "ui/draggable",
+ "ui/droppable",
+ "ui/resizable"
+], function( $, testHelpers, draggableTestHelpers ) {
module( "draggable: core" );
@@ -44,12 +47,12 @@ test( "element types", function( assert ) {
test( "No options, relative", function() {
expect( 2 );
- TestHelpers.draggable.shouldMove( $( "#draggable1" ).draggable(), "no options, relative" );
+ draggableTestHelpers.shouldMove( $( "#draggable1" ).draggable(), "no options, relative" );
});
test( "No options, absolute", function() {
expect( 2 );
- TestHelpers.draggable.shouldMove( $( "#draggable2" ).draggable(), "no options, absolute" );
+ draggableTestHelpers.shouldMove( $( "#draggable2" ).draggable(), "no options, absolute" );
});
test( "resizable handle with complex markup (#8756 / #8757)", function() {
@@ -92,7 +95,7 @@ test( "#8269: Removing draggable element on drop", function() {
});
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
- if ( TestHelpers.draggable.unreliableContains ) {
+ if ( draggableTestHelpers.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
@@ -118,7 +121,7 @@ test( "Stray mousemove after mousedown still drags", function() {
$( document ).simulate( "mousemove", { button: -1 });
});
- TestHelpers.draggable.shouldMove( element, "element is draggable" );
+ draggableTestHelpers.shouldMove( element, "element is draggable" );
});
test( "#6258: not following mouse when scrolled and using overflow-y: scroll", function() {
@@ -138,7 +141,7 @@ test( "#6258: not following mouse when scrolled and using overflow-y: scroll", f
oldOverflowY = $( "html" ).css( "overflow-y" ),
oldOverflowX = $( "html" ).css( "overflow-x" );
- TestHelpers.forceScrollableWindow();
+ testHelpers.forceScrollableWindow();
$( "html" )
.css( "overflow-y", "scroll" )
@@ -164,7 +167,7 @@ test( "#9315: jumps down with offset of scrollbar", function() {
}
});
- TestHelpers.forceScrollableWindow();
+ testHelpers.forceScrollableWindow();
$( "html" ).scrollTop( 300 ).scrollLeft( 300 );
@@ -198,7 +201,7 @@ test( "scroll offset with fixed ancestors", function() {
}
});
- TestHelpers.forceScrollableWindow();
+ testHelpers.forceScrollableWindow();
$( "#wrapper" ).css( "position", "fixed" );
$( "#wrapper2" ).css( "position", "absolute" );
@@ -269,8 +272,8 @@ test( "#5727: draggable from iframe", function() {
equal( draggable1.closest( iframeBody ).length, 1 );
// TODO: fix draggable within an IFRAME to fire events on the element properly
- // and these TestHelpers.draggable.shouldMove relies on events for testing
- //TestHelpers.draggable.shouldMove( draggable1, "draggable from an iframe" );
+ // and these draggableTestHelpers.shouldMove relies on events for testing
+ //draggableTestHelpers.shouldMove( draggable1, "draggable from an iframe" );
});
test( "#8399: A draggable should become the active element after you are finished interacting with it, but not before.", function() {
@@ -282,7 +285,7 @@ test( "#8399: A draggable should become the active element after you are finishe
notStrictEqual( document.activeElement, element.get( 0 ), "moving a draggable anchor did not make it the active element" );
});
- TestHelpers.draggable.move( element, 50, 50 );
+ draggableTestHelpers.move( element, 50, 50 );
strictEqual( document.activeElement, element.get( 0 ), "finishing moving a draggable anchor made it the active element" );
});
@@ -293,16 +296,16 @@ asyncTest( "blur behavior", function() {
var element = $( "#draggable1" ).draggable(),
focusElement = $( "<div tabindex='1'></div>" ).appendTo( element );
- TestHelpers.onFocus( focusElement, function() {
+ testHelpers.onFocus( focusElement, function() {
strictEqual( document.activeElement, focusElement.get( 0 ), "test element is focused before mousing down on a draggable" );
- TestHelpers.draggable.move( focusElement, 1, 1 );
+ draggableTestHelpers.move( focusElement, 1, 1 );
// http://bugs.jqueryui.com/ticket/10527
// Draggable: Can't select option in modal dialog (IE8)
strictEqual( document.activeElement, focusElement.get( 0 ), "test element is focused after mousing down on itself" );
- TestHelpers.draggable.move( element, 50, 50 );
+ draggableTestHelpers.move( element, 50, 50 );
// http://bugs.jqueryui.com/ticket/4261
// active element should blur when mousing down on a draggable
@@ -341,4 +344,4 @@ test( "ui-draggable-handle managed correctly in nested draggables", function( as
assert.hasClasses( child, "ui-draggable-handle", "child retains class name on destroy" );
});
-})( jQuery );
+} );
diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js
index dd5c315b0..ebbf606ef 100644
--- a/tests/unit/draggable/draggable_events.js
+++ b/tests/unit/draggable/draggable_events.js
@@ -1,7 +1,7 @@
-/*
- * draggable_events.js
- */
-(function( $ ) {
+define( [
+ "jquery",
+ "ui/draggable"
+], function( $ ) {
var element;
@@ -161,4 +161,4 @@ test( "position and offset in hash is consistent between start, drag, and stop",
deepEqual( dragOffset, stopOffset, "drag offset equals stop offset" );
});
-})( jQuery );
+} );
diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js
index 210f48964..44e5feb43 100644
--- a/tests/unit/draggable/draggable_methods.js
+++ b/tests/unit/draggable/draggable_methods.js
@@ -1,7 +1,8 @@
-/*
- * draggable_methods.js
- */
-(function( $ ) {
+define( [
+ "jquery",
+ "./draggable_test_helpers",
+ "ui/draggable"
+], function( $, draggableTestHelpers ) {
var element;
@@ -54,19 +55,19 @@ test( "enable", function() {
expect( 11 );
element.draggable({ disabled: true });
- TestHelpers.draggable.shouldNotDrag( element, ".draggable({ disabled: true })" );
+ draggableTestHelpers.shouldNotDrag( element, ".draggable({ disabled: true })" );
element.draggable("enable");
- TestHelpers.draggable.shouldMove( element, ".draggable('enable')" );
+ draggableTestHelpers.shouldMove( element, ".draggable('enable')" );
equal( element.draggable( "option", "disabled" ), false, "disabled option getter" );
element.draggable("destroy");
element.draggable({ disabled: true });
- TestHelpers.draggable.shouldNotDrag( element, ".draggable({ disabled: true })" );
+ draggableTestHelpers.shouldNotDrag( element, ".draggable({ disabled: true })" );
element.draggable( "option", "disabled", false );
equal(element.draggable( "option", "disabled" ), false, "disabled option setter" );
- TestHelpers.draggable.shouldMove( element, ".draggable('option', 'disabled', false)" );
+ draggableTestHelpers.shouldMove( element, ".draggable('option', 'disabled', false)" );
var expected = element.draggable(),
actual = expected.draggable("enable");
@@ -77,19 +78,19 @@ test( "disable", function( assert ) {
expect( 14 );
element = $( "#draggable2" ).draggable({ disabled: false });
- TestHelpers.draggable.shouldMove( element, ".draggable({ disabled: false })" );
+ draggableTestHelpers.shouldMove( element, ".draggable({ disabled: false })" );
element.draggable( "disable" );
- TestHelpers.draggable.shouldNotDrag( element, ".draggable('disable')" );
+ draggableTestHelpers.shouldNotDrag( element, ".draggable('disable')" );
equal( element.draggable( "option", "disabled" ), true, "disabled option getter" );
element.draggable( "destroy" );
element.draggable({ disabled: false });
- TestHelpers.draggable.shouldMove( element, ".draggable({ disabled: false })" );
+ draggableTestHelpers.shouldMove( element, ".draggable({ disabled: false })" );
element.draggable( "option", "disabled", true );
equal( element.draggable( "option", "disabled" ), true, "disabled option setter" );
- TestHelpers.draggable.shouldNotDrag( element, ".draggable('option', 'disabled', true)" );
+ draggableTestHelpers.shouldNotDrag( element, ".draggable('option', 'disabled', true)" );
assert.lacksClasses( element.draggable( "widget" ), "ui-state-disabled" );
ok( !element.draggable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
@@ -100,4 +101,4 @@ test( "disable", function( assert ) {
equal( actual, expected, "disable is chainable" );
});
-})( jQuery );
+} );
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index 0d4957136..a67854e96 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -1,15 +1,19 @@
-(function( $ ) {
-
-module( "draggable: options" );
+define( [
+ "jquery",
+ "./draggable_test_helpers",
+ "ui/draggable",
+ "ui/droppable",
+ "ui/sortable"
+], function( $, draggableTestHelpers ) {
// TODO: This doesn't actually test whether append happened, possibly remove
test( "{ appendTo: 'parent' }, default, no clone", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: "parent" });
- TestHelpers.draggable.shouldMove( element, "absolute appendTo: parent" );
+ draggableTestHelpers.shouldMove( element, "absolute appendTo: parent" );
element = $( "#draggable1" ).draggable({ appendTo: "parent" });
- TestHelpers.draggable.shouldMove( element, "relative appendTo: parent" );
+ draggableTestHelpers.shouldMove( element, "relative appendTo: parent" );
});
// TODO: This doesn't actually test whether append happened, possibly remove
@@ -17,20 +21,20 @@ test( "{ appendTo: Element }, no clone", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: $( "#draggable2" ).parent()[ 0 ] });
- TestHelpers.draggable.shouldMove( element, "absolute appendTo: Element" );
+ draggableTestHelpers.shouldMove( element, "absolute appendTo: Element" );
element = $( "#draggable1" ).draggable({ appendTo: $( "#draggable2" ).parent()[ 0 ] });
- TestHelpers.draggable.shouldMove( element, "relative appendTo: Element" );
+ draggableTestHelpers.shouldMove( element, "relative appendTo: Element" );
});
// TODO: This doesn't actually test whether append happened, possibly remove
test( "{ appendTo: Selector }, no clone", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ appendTo: "#main" });
- TestHelpers.draggable.shouldMove( element, "absolute appendTo: Selector" );
+ draggableTestHelpers.shouldMove( element, "absolute appendTo: Selector" );
element = $( "#draggable1" ).draggable({ appendTo: "#main" });
- TestHelpers.draggable.shouldMove( element, "relative appendTo: Selector" );
+ draggableTestHelpers.shouldMove( element, "relative appendTo: Selector" );
});
test( "{ appendTo: 'parent' }, default", function() {
@@ -38,11 +42,11 @@ test( "{ appendTo: 'parent' }, default", function() {
var element = $( "#draggable1" ).draggable();
- TestHelpers.draggable.trackAppendedParent( element );
+ draggableTestHelpers.trackAppendedParent( element );
equal( element.draggable( "option", "appendTo" ), "parent" );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $( "#main" )[ 0 ] );
});
@@ -52,9 +56,9 @@ test( "{ appendTo: Element }", function() {
var appendTo = $( "#draggable2" ).parent()[ 0 ],
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- TestHelpers.draggable.trackAppendedParent( element );
+ draggableTestHelpers.trackAppendedParent( element );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), appendTo );
});
@@ -64,9 +68,9 @@ test( "{ appendTo: jQuery }", function() {
var appendTo = $( "#draggable2" ).parent(),
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- TestHelpers.draggable.trackAppendedParent( element );
+ draggableTestHelpers.trackAppendedParent( element );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), appendTo[ 0 ] );
});
@@ -76,9 +80,9 @@ test( "{ appendTo: Selector }", function() {
var appendTo = "#main",
element = $( "#draggable1" ).draggable({ appendTo: appendTo });
- TestHelpers.draggable.trackAppendedParent( element );
+ draggableTestHelpers.trackAppendedParent( element );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $(appendTo)[ 0 ] );
});
@@ -87,34 +91,34 @@ test( "appendTo, default, switching after initialization", function() {
var element = $( "#draggable1" ).draggable({ helper: "clone" });
- TestHelpers.draggable.trackAppendedParent( element );
+ draggableTestHelpers.trackAppendedParent( element );
// Move and make sure element was appended to fixture
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_parent" ), $( "#main" )[ 0 ] );
// Move and make sure element was appended to main
element.draggable( "option", "appendTo", $( "#qunit-fixture" ) );
- TestHelpers.draggable.move( element, 2, 2 );
+ draggableTestHelpers.move( element, 2, 2 );
equal( element.data( "last_dragged_parent" ), $( "#qunit-fixture" )[ 0 ] );
});
test( "{ axis: false }, default", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: false });
- TestHelpers.draggable.shouldMove( element, "axis: false" );
+ draggableTestHelpers.shouldMove( element, "axis: false" );
});
test( "{ axis: 'x' }", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: "x" });
- TestHelpers.draggable.testDrag( element, element, 50, 50, 50, 0, "axis: x" );
+ draggableTestHelpers.testDrag( element, element, 50, 50, 50, 0, "axis: x" );
});
test( "{ axis: 'y' }", function() {
expect( 2 );
var element = $( "#draggable2" ).draggable({ axis: "y" });
- TestHelpers.draggable.testDrag( element, element, 50, 50, 0, 50, "axis: y" );
+ draggableTestHelpers.testDrag( element, element, 50, 50, 0, 50, "axis: y" );
});
test( "{ axis: ? }, unexpected", function() {
@@ -132,7 +136,7 @@ test( "{ axis: ? }, unexpected", function() {
$.each(unexpected, function(key, val) {
element = $( "#draggable2" ).draggable({ axis: val });
- TestHelpers.draggable.shouldMove( element, "axis: " + key );
+ draggableTestHelpers.shouldMove( element, "axis: " + key );
element.draggable( "destroy" );
});
});
@@ -143,15 +147,15 @@ test( "axis, default, switching after initialization", function() {
var element = $( "#draggable1" ).draggable({ axis: false });
// Any Direction
- TestHelpers.draggable.shouldMove( element, "axis: default" );
+ draggableTestHelpers.shouldMove( element, "axis: default" );
// Only horizontal
element.draggable( "option", "axis", "x" );
- TestHelpers.draggable.testDrag( element, element, 50, 50, 50, 0, "axis: x as option" );
+ draggableTestHelpers.testDrag( element, element, 50, 50, 50, 0, "axis: x as option" );
// Vertical only
element.draggable( "option", "axis", "y" );
- TestHelpers.draggable.testDrag( element, element, 50, 50, 0, 50, "axis: y as option" );
+ draggableTestHelpers.testDrag( element, element, 50, 50, 0, 50, "axis: y as option" );
});
@@ -161,12 +165,12 @@ test( "{ cancel: 'input,textarea,button,select,option' }, default", function() {
$( "<div id='draggable-option-cancel-default'><input type='text'></div>" ).appendTo( "#qunit-fixture" );
var element = $( "#draggable-option-cancel-default" ).draggable({ cancel: "input,textarea,button,select,option" });
- TestHelpers.draggable.shouldMove( element, "cancel: default, element dragged" );
+ draggableTestHelpers.shouldMove( element, "cancel: default, element dragged" );
element.draggable( "destroy" );
element = $( "#draggable-option-cancel-default" ).draggable({ cancel: "input,textarea,button,select,option" });
- TestHelpers.draggable.shouldNotDrag( element, "cancel: default, input dragged", "#draggable-option-cancel-default input" );
+ draggableTestHelpers.shouldNotDrag( element, "cancel: default, input dragged", "#draggable-option-cancel-default input" );
element.draggable( "destroy" );
});
@@ -174,12 +178,12 @@ test( "{ cancel: 'span' }", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable();
- TestHelpers.draggable.shouldMove( element, "cancel: default, span dragged", "#draggable2 span" );
+ draggableTestHelpers.shouldMove( element, "cancel: default, span dragged", "#draggable2 span" );
element.draggable( "destroy" );
element = $( "#draggable2" ).draggable({ cancel: "span" });
- TestHelpers.draggable.shouldNotDrag( element, "cancel: span, span dragged", "#draggable2 span" );
+ draggableTestHelpers.shouldNotDrag( element, "cancel: span, span dragged", "#draggable2 span" );
});
test( "{ cancel: ? }, unexpected", function() {
@@ -197,7 +201,7 @@ test( "{ cancel: ? }, unexpected", function() {
$.each( unexpected, function( key, val ) {
element = $( "#draggable2" ).draggable({ cancel: val });
- TestHelpers.draggable.shouldMove( element, "cancel: " + key );
+ draggableTestHelpers.shouldMove( element, "cancel: " + key );
element.draggable( "destroy" );
});
});
@@ -215,15 +219,15 @@ test( "{ cancel: Selectors }, matching parent selector", function() {
$( "#wrapping a" ).append( element );
- TestHelpers.draggable.shouldMove( element, "drag span child", "#draggable2 span" );
- TestHelpers.draggable.shouldNotDrag( $( "#draggable2 span a" ), "drag span a" );
- TestHelpers.draggable.shouldNotDrag( $( "#wrapping a" ), "drag wrapping a" );
+ draggableTestHelpers.shouldMove( element, "drag span child", "#draggable2 span" );
+ draggableTestHelpers.shouldNotDrag( $( "#draggable2 span a" ), "drag span a" );
+ draggableTestHelpers.shouldNotDrag( $( "#wrapping a" ), "drag wrapping a" );
$( "#draggable2" ).draggable( "option", "cancel", "span > a" );
$( "#draggable2" ).find( "a" ).append( "<a>" );
- TestHelpers.draggable.shouldMove( element, "drag span child", $( "#draggable2 span a" ).last() );
- TestHelpers.draggable.shouldNotDrag( $( "#draggable2 span a" ).first(), "drag span a first child" );
+ draggableTestHelpers.shouldMove( element, "drag span child", $( "#draggable2 span a" ).last() );
+ draggableTestHelpers.shouldNotDrag( $( "#draggable2 span a" ).first(), "drag span a first child" );
});
*/
@@ -235,13 +239,13 @@ test( "cancelement, default, switching after initialization", function() {
var input = $( "#draggable-option-cancel-default input" ),
element = $( "#draggable-option-cancel-default" ).draggable();
- TestHelpers.draggable.shouldNotDrag( element, "cancel: default, input dragged", input );
+ draggableTestHelpers.shouldNotDrag( element, "cancel: default, input dragged", input );
element.draggable( "option", "cancel", "textarea" );
- TestHelpers.draggable.shouldMove( element, "cancel: textarea, input dragged", input );
+ draggableTestHelpers.shouldMove( element, "cancel: textarea, input dragged", input );
element.draggable( "option", "cancel", "input" );
- TestHelpers.draggable.shouldNotDrag( element, "cancel: input, input dragged", input );
+ draggableTestHelpers.shouldNotDrag( element, "cancel: input, input dragged", input );
});
test( "connectToSortable, dragging out of a sortable", function() {
@@ -436,8 +440,8 @@ test( "{ containment: Element }", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + TestHelpers.draggable.border( p, "left" ) + TestHelpers.draggable.margin( element, "left" ),
- top: po.top + TestHelpers.draggable.border( p, "top" ) + TestHelpers.draggable.margin( element, "top" )
+ left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
+ top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
};
element.simulate( "drag", {
@@ -456,8 +460,8 @@ test( "{ containment: Selector }", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + TestHelpers.draggable.border( p, "left" ) + TestHelpers.draggable.margin( element, "left" ),
- top: po.top + TestHelpers.draggable.border( p, "top" ) + TestHelpers.draggable.margin( element, "top" )
+ left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
+ top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
};
element.simulate( "drag", {
@@ -476,7 +480,7 @@ test( "{ containment: [x1, y1, x2, y2] }", function() {
element.draggable( "option", "containment", [ eo.left, eo.top, eo.left + element.width() + 5, eo.top + element.height() + 5 ] );
- TestHelpers.draggable.testDrag( element, element, -100, -100, 0, 0, "containment: [x1, y1, x2, y2]" );
+ draggableTestHelpers.testDrag( element, element, -100, -100, 0, 0, "containment: [x1, y1, x2, y2]" );
});
test( "{ containment: 'parent' }, relative", function() {
@@ -487,8 +491,8 @@ test( "{ containment: 'parent' }, relative", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + TestHelpers.draggable.border( p, "left" ) + TestHelpers.draggable.margin( element, "left" ),
- top: po.top + TestHelpers.draggable.border( p, "top" ) + TestHelpers.draggable.margin( element, "top" )
+ left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
+ top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
};
element.simulate( "drag", {
@@ -507,8 +511,8 @@ test( "{ containment: 'parent' }, absolute", function() {
p = element.parent(),
po = p.offset(),
expected = {
- left: po.left + TestHelpers.draggable.border( p, "left" ) + TestHelpers.draggable.margin( element, "left" ),
- top: po.top + TestHelpers.draggable.border( p, "top" ) + TestHelpers.draggable.margin( element, "top" )
+ left: po.left + draggableTestHelpers.border( p, "left" ) + draggableTestHelpers.margin( element, "left" ),
+ top: po.top + draggableTestHelpers.border( p, "top" ) + draggableTestHelpers.margin( element, "top" )
};
element.simulate( "drag", {
@@ -531,8 +535,8 @@ test( "containment, account for border", function( assert ) {
}),
parentBottom = parent.offset().top + parent.outerHeight(),
parentRight = parent.offset().left + parent.outerWidth(),
- parentBorderBottom = TestHelpers.draggable.border( parent, "bottom" ),
- parentBorderRight = TestHelpers.draggable.border( parent, "right" );
+ parentBorderBottom = draggableTestHelpers.border( parent, "bottom" ),
+ parentBorderRight = draggableTestHelpers.border( parent, "right" );
el.css({
height: "5px",
@@ -587,16 +591,16 @@ test( "containment, default, switching after initialization", function() {
po = element.parent().offset(),
containment = [ po.left - 100, po.top - 100, po.left + 500, po.top + 500 ];
- TestHelpers.draggable.testDrag( element, element, -100, -100, -100, -100, "containment: default" );
+ draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: default" );
element.draggable( "option", "containment", "parent" ).css({ top: 0, left: 0 });
- TestHelpers.draggable.testDrag( element, element, -100, -100, 0, 0, "containment: parent as option" );
+ draggableTestHelpers.testDrag( element, element, -100, -100, 0, 0, "containment: parent as option" );
element.draggable( "option", "containment", containment ).css({ top: 0, left: 0 });
- TestHelpers.draggable.testDrag( element, element, -100, -100, -100, -100, "containment: array as option" );
+ draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: array as option" );
element.draggable( "option", "containment", false );
- TestHelpers.draggable.testDrag( element, element, -100, -100, -100, -100, "containment: false as option" );
+ draggableTestHelpers.testDrag( element, element, -100, -100, -100, -100, "containment: false as option" );
});
test( "{ cursor: 'auto' }, default", function() {
@@ -674,7 +678,7 @@ test( "#6889: Cursor doesn't revert to pre-dragging state after revert action wh
}),
expected = getCursor();
- if ( TestHelpers.draggable.unreliableContains ) {
+ if ( draggableTestHelpers.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
@@ -690,17 +694,17 @@ test( "cursor, default, switching after initialization", function() {
var element = $( "#draggable1" ).draggable();
- TestHelpers.draggable.trackMouseCss( element );
+ draggableTestHelpers.trackMouseCss( element );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "auto" );
element.draggable( "option", "cursor", "move" );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "move" );
element.draggable( "option", "cursor", "ns-resize" );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.data( "last_dragged_cursor" ), "ns-resize" );
});
@@ -727,11 +731,11 @@ test( "cursorAt", function() {
equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" );
} else if ( testData.cursorAt.right ) {
- equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
- equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
+ equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
+ equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
} else {
- equal( event.clientX - ui.offset.left, testData.x + TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
- equal( event.clientY - ui.offset.top, testData.y + TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
+ equal( event.clientX - ui.offset.left, testData.x + draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
+ equal( event.clientY - ui.offset.top, testData.y + draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
}
}
});
@@ -769,11 +773,11 @@ test( "cursorAt, switching after initialization", function() {
equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" );
} else if ( testData.cursorAt.right ) {
- equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
- equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
+ equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
+ equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
} else {
- equal( event.clientX - ui.offset.left, testData.x + TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
- equal( event.clientY - ui.offset.top, testData.y + TestHelpers.draggable.unreliableOffset, testName + " " + position + " top" );
+ equal( event.clientX - ui.offset.left, testData.x + draggableTestHelpers.unreliableOffset, testName + " " + position + " left" );
+ equal( event.clientY - ui.offset.top, testData.y + draggableTestHelpers.unreliableOffset, testName + " " + position + " top" );
}
}
});
@@ -795,29 +799,29 @@ test( "disabled", function() {
var element = $( "#draggable1" ).draggable();
- TestHelpers.draggable.shouldMove( element, "disabled: default" );
+ draggableTestHelpers.shouldMove( element, "disabled: default" );
element.draggable( "option", "disabled", true );
- TestHelpers.draggable.shouldNotDrag( element, "option: disabled true" );
+ draggableTestHelpers.shouldNotDrag( element, "option: disabled true" );
element.draggable( "option", "disabled", false );
- TestHelpers.draggable.shouldMove( element, "option: disabled false" );
+ draggableTestHelpers.shouldMove( element, "option: disabled false" );
});
test( "{ grid: [50, 50] }, relative", function() {
expect( 4 );
var element = $( "#draggable1" ).draggable({ grid: [ 50, 50 ] });
- TestHelpers.draggable.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] relative" );
- TestHelpers.draggable.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] relative" );
+ draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] relative" );
+ draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] relative" );
});
test( "{ grid: [50, 50] }, absolute", function() {
expect( 4 );
var element = $( "#draggable2" ).draggable({ grid: [ 50, 50 ] });
- TestHelpers.draggable.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] absolute" );
- TestHelpers.draggable.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] absolute" );
+ draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] absolute" );
+ draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] absolute" );
});
test( "grid, switching after initialization", function() {
@@ -826,13 +830,13 @@ test( "grid, switching after initialization", function() {
var element = $( "#draggable1" ).draggable();
// Forward
- TestHelpers.draggable.testDrag( element, element, 24, 24, 24, 24, "grid: default" );
- TestHelpers.draggable.testDrag( element, element, 0, 0, 0, 0, "grid: default" );
+ draggableTestHelpers.testDrag( element, element, 24, 24, 24, 24, "grid: default" );
+ draggableTestHelpers.testDrag( element, element, 0, 0, 0, 0, "grid: default" );
element.draggable( "option", "grid", [ 50, 50 ] );
- TestHelpers.draggable.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] as option" );
- TestHelpers.draggable.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] as option" );
+ draggableTestHelpers.testDrag( element, element, 24, 24, 0, 0, "grid: [50, 50] as option" );
+ draggableTestHelpers.testDrag( element, element, 26, 25, 50, 50, "grid: [50, 50] as option" );
});
test( "{ handle: 'span' }", function() {
@@ -840,9 +844,9 @@ test( "{ handle: 'span' }", function() {
var element = $( "#draggable2" ).draggable({ handle: "span" });
- TestHelpers.draggable.shouldMove( element, "handle: span", "#draggable2 span");
- TestHelpers.draggable.shouldMove( element, "handle: span child", "#draggable2 span em" );
- TestHelpers.draggable.shouldNotDrag( element, "handle: span element" );
+ draggableTestHelpers.shouldMove( element, "handle: span", "#draggable2 span");
+ draggableTestHelpers.shouldMove( element, "handle: span child", "#draggable2 span em" );
+ draggableTestHelpers.shouldNotDrag( element, "handle: span element" );
});
test( "handle, default, switching after initialization", function() {
@@ -850,31 +854,31 @@ test( "handle, default, switching after initialization", function() {
var element = $( "#draggable2" ).draggable();
- TestHelpers.draggable.shouldMove( element, "handle: default, element dragged" );
- TestHelpers.draggable.shouldMove( element, "handle: default, span dragged", "#draggable2 span" );
+ draggableTestHelpers.shouldMove( element, "handle: default, element dragged" );
+ draggableTestHelpers.shouldMove( element, "handle: default, span dragged", "#draggable2 span" );
// Switch
element.draggable( "option", "handle", "span" );
- TestHelpers.draggable.shouldNotDrag( element, "handle: span as option, element dragged" );
- TestHelpers.draggable.shouldMove( element, "handle: span as option, span dragged", "#draggable2 span" );
+ draggableTestHelpers.shouldNotDrag( element, "handle: span as option, element dragged" );
+ draggableTestHelpers.shouldMove( element, "handle: span as option, span dragged", "#draggable2 span" );
// And back
element.draggable( "option", "handle", false );
- TestHelpers.draggable.shouldMove( element, "handle: false as option, element dragged" );
- TestHelpers.draggable.shouldMove( element, "handle: false as option, span dragged", "#draggable2 span" );
+ draggableTestHelpers.shouldMove( element, "handle: false as option, element dragged" );
+ draggableTestHelpers.shouldMove( element, "handle: false as option, span dragged", "#draggable2 span" );
});
test( "helper, default, switching after initialization", function() {
expect( 6 );
var element = $( "#draggable1" ).draggable();
- TestHelpers.draggable.shouldMove( element, "helper: default" );
+ draggableTestHelpers.shouldMove( element, "helper: default" );
element.draggable( "option", "helper", "clone" );
- TestHelpers.draggable.shouldMove( element, "helper: clone" );
+ draggableTestHelpers.shouldMove( element, "helper: clone" );
element.draggable( "option", "helper", "original" );
- TestHelpers.draggable.shouldMove( element, "helper: original" );
+ draggableTestHelpers.shouldMove( element, "helper: original" );
});
// http://bugs.jqueryui.com/ticket/9446
@@ -888,7 +892,7 @@ test( "helper, function returning original element", function() {
}
});
- TestHelpers.draggable.testDragHelperOffset( element, 100, 100, 100, 100, "original element is draggable" );
+ draggableTestHelpers.testDragHelperOffset( element, 100, 100, 100, 100, "original element is draggable" );
element.simulate( "drag", {
dx: 100,
@@ -907,25 +911,25 @@ function testHelperPosition( scrollPositions, position, helper, scrollElements,
});
if ( scrollElements.length === 1 && scrollElements[ 0 ] === "#scrollParent" ) {
- TestHelpers.draggable.setScrollable( "#main", false );
- TestHelpers.draggable.setScrollable( "#scrollParent", true );
+ draggableTestHelpers.setScrollable( "#main", false );
+ draggableTestHelpers.setScrollable( "#scrollParent", true );
}
for ( j = 0; j < scrollPositions.length; j++ ) {
for ( i = 0; i < scrollElements.length; i++ ) {
- TestHelpers.draggable.setScroll( scrollElements[ i ] );
+ draggableTestHelpers.setScroll( scrollElements[ i ] );
}
- TestHelpers.draggable.testScroll( element, scrollPositions[ j ] );
+ draggableTestHelpers.testScroll( element, scrollPositions[ j ] );
for ( i = 0; i < scrollElements.length; i++ ) {
- TestHelpers.draggable.restoreScroll( scrollElements[ i ] );
+ draggableTestHelpers.restoreScroll( scrollElements[ i ] );
}
}
if ( scrollElements.length === 1 && scrollElements[ 1 ] === "#scrollParent" ) {
- TestHelpers.draggable.setScrollable( "#main", true );
- TestHelpers.draggable.setScrollable( "#scrollParent", false );
+ draggableTestHelpers.setScrollable( "#main", true );
+ draggableTestHelpers.setScrollable( "#scrollParent", false );
}
});
}
@@ -983,15 +987,15 @@ test( "opacity, default, switching after initialization", function() {
}
});
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( opacity, 1 );
element.draggable( "option", "opacity", 0.5 );
- TestHelpers.draggable.move( element, 2, 1 );
+ draggableTestHelpers.move( element, 2, 1 );
equal( opacity, 0.5 );
element.draggable( "option", "opacity", false );
- TestHelpers.draggable.move( element, 3, 1 );
+ draggableTestHelpers.move( element, 3, 1 );
equal( opacity, 1 );
});
@@ -1002,13 +1006,13 @@ asyncTest( "revert and revertDuration", function() {
revert: true,
revertDuration: 0
});
- TestHelpers.draggable.shouldMovePositionButNotOffset( element, "revert: true, revertDuration: 0 should revert immediately" );
+ draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: true, revertDuration: 0 should revert immediately" );
$( "#draggable2" ).draggable( "option", "revert", "invalid" );
- TestHelpers.draggable.shouldMovePositionButNotOffset( element, "revert: invalid, revertDuration: 0 should revert immediately" );
+ draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: invalid, revertDuration: 0 should revert immediately" );
$( "#draggable2" ).draggable( "option", "revert", false );
- TestHelpers.draggable.shouldMove( element, "revert: false should allow movement" );
+ draggableTestHelpers.shouldMove( element, "revert: false should allow movement" );
$( "#draggable2" ).draggable( "option", {
revert: true,
@@ -1019,7 +1023,7 @@ asyncTest( "revert and revertDuration", function() {
});
// animation are async, so test for it asynchronously
- TestHelpers.draggable.move( element, 50, 50 );
+ draggableTestHelpers.move( element, 50, 50 );
setTimeout( function() {
ok( $( "#draggable2" ).is( ":animated" ), "revert: true with revertDuration should animate" );
});
@@ -1035,7 +1039,7 @@ test( "revert: valid", function() {
$( "#droppable" ).droppable();
- TestHelpers.draggable.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable" );
+ draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable" );
});
test( "scope", function() {
@@ -1049,17 +1053,17 @@ test( "scope", function() {
$( "#droppable" ).droppable({ scope: "tasks" });
- TestHelpers.draggable.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable in scope" );
+ draggableTestHelpers.shouldMovePositionButNotOffset( element, "revert: valid reverts when dropped on a droppable in scope" );
$( "#droppable" ).droppable( "destroy" ).droppable({ scope: "nottasks" });
- TestHelpers.draggable.shouldMove( element, "revert: valid reverts when dropped on a droppable out of scope" );
+ draggableTestHelpers.shouldMove( element, "revert: valid reverts when dropped on a droppable out of scope" );
});
test( "scroll, scrollSensitivity, and scrollSpeed", function() {
expect( 2 );
- TestHelpers.draggable.setScrollable( "#main", false );
+ draggableTestHelpers.setScrollable( "#main", false );
var currentScrollTop,
viewportHeight = $( window ).height(),
@@ -1101,7 +1105,7 @@ test( "scroll, scrollSensitivity, and scrollSpeed", function() {
moves: 1
});
- TestHelpers.draggable.restoreScroll( document );
+ draggableTestHelpers.restoreScroll( document );
});
test( "scroll ignores containers that are overflow: hidden", function() {
@@ -1140,7 +1144,7 @@ test( "scroll ignores containers that are overflow: hidden", function() {
test( "#6817: auto scroll goes double distance when dragging", function( assert ) {
expect( 2 );
- TestHelpers.draggable.restoreScroll( document );
+ draggableTestHelpers.restoreScroll( document );
var offsetBefore,
distance = 10,
@@ -1171,7 +1175,7 @@ test( "#6817: auto scroll goes double distance when dragging", function( assert
moves: 1
});
- TestHelpers.draggable.restoreScroll( document );
+ draggableTestHelpers.restoreScroll( document );
});
test( "snap, snapMode, and snapTolerance", function( assert ) {
@@ -1333,7 +1337,7 @@ test( "#8459: element can snap to an element that was removed during drag", func
});
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
- if ( TestHelpers.draggable.unreliableContains ) {
+ if ( draggableTestHelpers.unreliableContains ) {
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
ok( true, "Opera <12.14 and Safari <6.0 report wrong values for $.contains in jQuery < 1.8" );
} else {
@@ -1390,10 +1394,10 @@ test( "stack", function() {
stack: "#draggable1, #draggable2"
});
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( element.css( "zIndex" ), "2", "stack increments zIndex correctly" );
- TestHelpers.draggable.move( element2, 1, 1 );
+ draggableTestHelpers.move( element2, 1, 1 );
equal( element2.css( "zIndex" ), "3", "stack increments zIndex correctly" );
});
@@ -1431,15 +1435,15 @@ test( "zIndex, default, switching after initialization", function() {
element.css( "z-index", 1 );
- TestHelpers.draggable.move( element, 1, 1 );
+ draggableTestHelpers.move( element, 1, 1 );
equal( zindex, 1 );
element.draggable( "option", "zIndex", 5 );
- TestHelpers.draggable.move( element, 2, 1 );
+ draggableTestHelpers.move( element, 2, 1 );
equal( zindex, 5 );
element.draggable( "option", "zIndex", false );
- TestHelpers.draggable.move( element, 3, 1 );
+ draggableTestHelpers.move( element, 3, 1 );
equal( zindex, 1 );
});
@@ -1486,4 +1490,4 @@ test( "iframeFix", function() {
});
});
-})( jQuery );
+} );
diff --git a/tests/unit/draggable/draggable_test_helpers.js b/tests/unit/draggable/draggable_test_helpers.js
index 1b004e7cf..dcf2d6297 100644
--- a/tests/unit/draggable/draggable_test_helpers.js
+++ b/tests/unit/draggable/draggable_test_helpers.js
@@ -1,4 +1,7 @@
-TestHelpers.draggable = {
+define( function() {
+
+var draggableTestHelpers = {
+
// TODO: remove the unreliable offset hacks
unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0,
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
@@ -35,8 +38,8 @@ TestHelpers.draggable = {
});
},
testDrag: function( el, handle, dx, dy, expectedDX, expectedDY, msg ) {
- TestHelpers.draggable.testDragPosition( el, dx, dy, expectedDX, expectedDY, msg );
- TestHelpers.draggable.testDragOffset( el, dx, dy, expectedDX, expectedDY, msg );
+ draggableTestHelpers.testDragPosition( el, dx, dy, expectedDX, expectedDY, msg );
+ draggableTestHelpers.testDragOffset( el, dx, dy, expectedDX, expectedDY, msg );
$( handle ).simulate( "drag", {
dx: dx,
@@ -45,8 +48,8 @@ TestHelpers.draggable = {
},
shouldMovePositionButNotOffset: function( el, msg, handle ) {
handle = handle || el;
- TestHelpers.draggable.testDragPosition( el, 100, 100, 100, 100, msg );
- TestHelpers.draggable.testDragHelperOffset( el, 100, 100, 0, 0, msg );
+ draggableTestHelpers.testDragPosition( el, 100, 100, 100, 100, msg );
+ draggableTestHelpers.testDragHelperOffset( el, 100, 100, 0, 0, msg );
$( handle ).simulate( "drag", {
dx: 100,
@@ -55,11 +58,11 @@ TestHelpers.draggable = {
},
shouldMove: function( el, msg, handle ) {
handle = handle || el;
- TestHelpers.draggable.testDrag( el, handle, 100, 100, 100, 100, msg );
+ draggableTestHelpers.testDrag( el, handle, 100, 100, 100, 100, msg );
},
shouldNotMove: function( el, msg, handle ) {
handle = handle || el;
- TestHelpers.draggable.testDrag( el, handle, 100, 100, 0, 0, msg );
+ draggableTestHelpers.testDrag( el, handle, 100, 100, 0, 0, msg );
},
shouldNotDrag: function( el, msg, handle ) {
handle = handle || el;
@@ -93,7 +96,7 @@ TestHelpers.draggable = {
testScroll: function( el, position ) {
var oldPosition = $( "#main" ).css( "position" );
$( "#main" ).css({ position: position, top: "0px", left: "0px" });
- TestHelpers.draggable.shouldMove( el, position + " parent" );
+ draggableTestHelpers.shouldMove( el, position + " parent" );
$( "#main" ).css( "position", oldPosition );
},
restoreScroll: function( what ) {
@@ -129,3 +132,7 @@ TestHelpers.draggable = {
});
}
};
+
+return draggableTestHelpers;
+
+} );