From efe3b225179f8f2f3f2c05484f7757f90bc5a27b Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Mon, 8 Nov 2021 18:21:03 +0100 Subject: Sortable: Allow 0-height containers to be sortable as in 1.12.1 Note that container specific events will not fire when the dragged element is interacting with zero height containers. Fixes gh-1998 Closes gh-2008 Co-authored-by: A. Wells --- tests/unit/sortable/core.js | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'tests') diff --git a/tests/unit/sortable/core.js b/tests/unit/sortable/core.js index 90ec1bd76..2224f04ec 100644 --- a/tests/unit/sortable/core.js +++ b/tests/unit/sortable/core.js @@ -42,4 +42,57 @@ QUnit.test( "ui-sortable-handle applied to appropriate element", function( asser assert.equal( el.find( ".ui-sortable-handle" ).length, 0, "class name removed on destroy" ); } ); +// gh-1998 +QUnit.test( "drag & drop works with a zero-height container", function( assert ) { + var ready = assert.async(); + assert.expect( 3 ); + + var el = $( "" ) + .sortable() + .appendTo( "#qunit-fixture" ); + + function step1() { + el.find( "li" ).eq( 0 ).simulate( "drag", { + dx: 100, + dy: 3, + moves: 3 + } ); + setTimeout( step2 ); + } + + function step2() { + el.find( "li" ).eq( 2 ).simulate( "drag", { + dx: -200, + dy: -3, + moves: 3 + } ); + setTimeout( step3 ); + } + + function step3() { + assert.equal( el.find( "li" ).eq( 0 ).text(), "Item 3" ); + assert.equal( el.find( "li" ).eq( 1 ).text(), "Item 2" ); + assert.equal( el.find( "li" ).eq( 2 ).text(), "Item 1" ); + ready(); + } + + step1(); +} ); + } ); -- cgit v1.2.3