Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable: update placeholder when axis is x or y for connected lists #941

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/unit/sortable/sortable_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,35 @@ test( "#8792: issues with floated items in connected lists", function() {
equal( changeCount, 3, "change fired once for each expected change when dragging a floated sortable to a connected container" );
});

test( "#8301: single axis with connected list", function() {
expect( 1 );

var element = $( "#sortable" ).sortable({
axis: "y",
tolerance: "pointer",
connectWith: ".connected"
});

$( "<ul class='connected'><li>Item 7</li><li>Item 8</li></ul>" )
.sortable({
axis: "y",
tolerance: "pointer",
connectWith: "#sortable",
receive: function() {
ok( true, "connected list received item" );
}
})
.insertAfter(element);

element.find( "li" ).eq( 0 ).simulate( "drag", {
handle: "corner",
dx: -1,
dy: 114,
moves: 1
});

});

/*
test("{ connectWith: false }, default", function() {
ok(false, "missing test - untested code is broken code.");
Expand Down
4 changes: 3 additions & 1 deletion ui/jquery.ui.sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,9 @@ $.widget("ui.sortable", $.ui.mouse, {
b = t + item.height,
dyClick = this.offset.click.top,
dxClick = this.offset.click.left,
isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && (y1 + dyClick) < b),
isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && (x1 + dxClick) < r),
isOverElement = isOverElementHeight && isOverElementWidth;

if ( this.options.tolerance === "pointer" ||
this.options.forcePointerForContainers ||
Expand Down