});
});
+test( "{ placholder: String } tbody", function() {
+ expect( 6 );
+
+ var originalWidths,
+ element = $( "#sortable-table" ).sortable({
+ placeholder: "test",
+ start: function( event, ui ) {
+ var currentWidths = otherBody.children().map(function() {
+ return $( this ).width();
+ }).get();
+ ok( ui.placeholder.hasClass( "test" ), "placeholder has class" );
+ deepEqual( currentWidths, originalWidths, "table cells maintain size" );
+ equal( ui.placeholder.children().length, 1,
+ "placeholder has one child" );
+ equal( ui.placeholder.children( "tr" ).length, 1,
+ "placeholder's child is tr" );
+ equal( ui.placeholder.find( "> tr" ).children().length,
+ dragBody.find( "> tr:first" ).children().length,
+ "placeholder's tr has correct number of cells" );
+ equal( ui.placeholder.find( "> tr" ).children().html(),
+ $( "<span> </span>" ).html(),
+ "placeholder td has content for forced dimensions" );
+ }
+ }),
+ bodies = element.children( "tbody" ),
+ dragBody = bodies.eq( 0 ),
+ otherBody = bodies.eq( 1 );
+
+ originalWidths = otherBody.children().map(function() {
+ return $( this ).width();
+ }).get();
+ dragBody.simulate( "drag", {
+ dy: 1
+ });
+});
+
/*
test("{ revert: false }, default", function() {
ok(false, "missing test - untested code is broken code.");
.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
.removeClass("ui-sortable-helper");
- if ( nodeName === "tr" ) {
- that.currentItem.children().each(function() {
- $( "<td> </td>", that.document[0] )
- .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
- .appendTo( element );
- });
+ if ( nodeName === "tbody" ) {
+ that._createTrPlaceholder(
+ that.currentItem.find( "tr" ).eq( 0 ),
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
+ );
+ } else if ( nodeName === "tr" ) {
+ that._createTrPlaceholder( that.currentItem, element );
} else if ( nodeName === "img" ) {
element.attr( "src", that.currentItem.attr( "src" ) );
}
},
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
+ var that = this;
+
+ sourceTr.children().each(function() {
+ $( "<td> </td>", that.document[ 0 ] )
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+ .appendTo( targetTr );
+ });
+ },
+
_contactContainers: function(event) {
var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
innermostContainer = null,