aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/sortable
diff options
context:
space:
mode:
authorTJ VanToll <tj.vantoll@gmail.com>2014-10-31 09:46:41 -0400
committerTJ VanToll <tj.vantoll@gmail.com>2014-11-04 08:15:26 -0500
commitf656aebe3f99356b7eb91ffdafe6689ecc8fb4ae (patch)
treee8999481ef698721b4146f651583721a7b5d2cde /tests/unit/sortable
parentfb4124b7af4e87712eca9893f7aefb5fee7905de (diff)
downloadjquery-ui-f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae.tar.gz
jquery-ui-f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae.zip
Sortable: Redetermine floating flag when recalculating positions
This addresses a bug where users initialize empty sortable lists are add items dynamically. In this situation refresh() should recognize the position and orientation of the new items. Fixes #7498 Closes gh-1381
Diffstat (limited to 'tests/unit/sortable')
-rw-r--r--tests/unit/sortable/sortable_methods.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js
index f3fe240e7..9c0a86a35 100644
--- a/tests/unit/sortable/sortable_methods.js
+++ b/tests/unit/sortable/sortable_methods.js
@@ -90,4 +90,39 @@ test( "disable", function() {
equal( chainable, element, "disable is chainable" );
});
+test( "refresh() should update the positions of initially empty lists (see #7498)", function() {
+ expect( 1 );
+
+ var changeCount = 0,
+ element = $( "#qunit-fixture" ).html( "<ul></ul>" ).find( "ul" );
+
+ element
+ .css({
+ "float": "left",
+ width: "100px"
+ })
+ .sortable({
+ change: function() {
+ changeCount++;
+ }
+ })
+ .append( "<li>a</li><li>a</li>" )
+ .find( "li" )
+ .css({
+ "float": "left",
+ width: "50px",
+ height: "50px"
+ });
+
+ element.sortable( "refresh" );
+
+ // Switch the order of the two li elements
+ element.find( "li" ).eq( 0 ).simulate( "drag", {
+ dx: 55,
+ moves: 15
+ });
+
+ equal( changeCount, 1 );
+});
+
})(jQuery);