mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
a856dd9b7e
commit
31e36e6ae4
@ -4,33 +4,8 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Sortable Test Suite</title>
|
<title>jQuery UI Sortable Test Suite</title>
|
||||||
|
|
||||||
<script src="../../jquery.js"></script>
|
<script src="../../lib/css.js" data-modules="core"></script>
|
||||||
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
|
<script src="../../lib/bootstrap.js" data-widget="sortable"></script>
|
||||||
<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>
|
|
||||||
<style>
|
<style>
|
||||||
#sortable, #sortable2 {
|
#sortable, #sortable2 {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
TestHelpers.commonWidgetTests( "sortable", {
|
define( [
|
||||||
|
"lib/common",
|
||||||
|
"ui/sortable"
|
||||||
|
], function( common ) {
|
||||||
|
|
||||||
|
common.testWidget( "sortable", {
|
||||||
defaults: {
|
defaults: {
|
||||||
appendTo: "parent",
|
appendTo: "parent",
|
||||||
axis: false,
|
axis: false,
|
||||||
@ -44,3 +49,5 @@ TestHelpers.commonWidgetTests( "sortable", {
|
|||||||
update: null
|
update: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
} );
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
define( [
|
||||||
* sortable_core.js
|
"jquery",
|
||||||
*/
|
"./sortable_test_helpers",
|
||||||
|
"ui/sortable"
|
||||||
(function( $ ) {
|
], function( $, sortableTestHelpers ) {
|
||||||
|
|
||||||
module( "sortable: core" );
|
module( "sortable: core" );
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ test( "#9314: Sortable: Items cannot be dragged directly into bottom position",
|
|||||||
connectWith: ".connectWith"
|
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 ) {
|
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" );
|
equal( el.find( ".ui-sortable-handle" ).length, 0, "class name removed on destroy" );
|
||||||
});
|
});
|
||||||
|
|
||||||
})( jQuery );
|
} );
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
/*
|
define( [
|
||||||
* sortable_events.js
|
"jquery",
|
||||||
*/
|
"./sortable_test_helpers",
|
||||||
(function($) {
|
"ui/sortable",
|
||||||
|
"ui/draggable"
|
||||||
|
], function( $, sortableTestHelpers ) {
|
||||||
|
|
||||||
module("sortable: events");
|
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");
|
equal(helper, null, "helper should be false");
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -373,4 +375,4 @@ test("deactivate", function() {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
})(jQuery);
|
} );
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/*
|
define( [
|
||||||
* sortable_methods.js
|
"jquery",
|
||||||
*/
|
"./sortable_test_helpers",
|
||||||
(function($) {
|
"ui/sortable"
|
||||||
|
], function( $, sortableTestHelpers ) {
|
||||||
|
|
||||||
module("sortable: methods");
|
module("sortable: methods");
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ test("enable", function() {
|
|||||||
|
|
||||||
el = $("#sortable").sortable({ disabled: true });
|
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");
|
el.sortable("enable");
|
||||||
equal(el.sortable("option", "disabled"), false, "disabled option getter");
|
equal(el.sortable("option", "disabled"), false, "disabled option getter");
|
||||||
@ -57,7 +58,7 @@ test("enable", function() {
|
|||||||
el.sortable("option", "disabled", false);
|
el.sortable("option", "disabled", false);
|
||||||
equal(el.sortable("option", "disabled"), false, "disabled option setter");
|
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(),
|
expected = $("<div></div>").sortable(),
|
||||||
actual = expected.sortable("enable");
|
actual = expected.sortable("enable");
|
||||||
@ -70,15 +71,15 @@ test( "disable", function( assert ) {
|
|||||||
var chainable,
|
var chainable,
|
||||||
element = $( "#sortable" ).sortable({ disabled: false });
|
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" );
|
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( "destroy" );
|
||||||
|
|
||||||
element.sortable({ disabled: false });
|
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);
|
element.sortable( "option", "disabled", true);
|
||||||
equal( element.sortable( "option", "disabled" ), true, "disabled option setter" );
|
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" );
|
ok( !element.sortable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
|
||||||
assert.hasClasses( element.sortable( "widget" ), "ui-sortable-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" );
|
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 );
|
equal( changeCount, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
} );
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
define( [
|
||||||
* sortable_options.js
|
"jquery",
|
||||||
*/
|
"ui/sortable"
|
||||||
(function($) {
|
], function( $ ) {
|
||||||
|
|
||||||
module("sortable: options");
|
module("sortable: options");
|
||||||
|
|
||||||
@ -493,4 +493,4 @@ test("{ zIndex: false }", function() {
|
|||||||
ok(false, "missing test - untested code is broken code.");
|
ok(false, "missing test - untested code is broken code.");
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
})(jQuery);
|
} );
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
TestHelpers.sortable = {
|
define( function() {
|
||||||
|
|
||||||
|
return {
|
||||||
sort: function( handle, dx, dy, index, msg ) {
|
sort: function( handle, dx, dy, index, msg ) {
|
||||||
$( handle ).simulate( "drag", {
|
$( handle ).simulate( "drag", {
|
||||||
dx: dx,
|
dx: dx,
|
||||||
@ -7,3 +9,5 @@ TestHelpers.sortable = {
|
|||||||
equal( $( handle ).parent().children().index( handle ), index, msg );
|
equal( $( handle ).parent().children().index( handle ), index, msg );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user