From 28310ff55f062199fb2f187ea13d3561a879aea8 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Thu, 12 Dec 2013 22:10:06 -0500 Subject: Slider & Interactions: Add Windows 8 touch support Fixes #9709 Fixes #9710 Closes gh-1152 --- tests/unit/draggable/draggable_core.js | 14 ++++++++++++++ tests/unit/sortable/sortable_core.js | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'tests') diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index c9cdde260..7df0969b1 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -273,4 +273,18 @@ asyncTest( "#4261: active element should blur when mousing down on a draggable", }); }); +test( "ui-draggable-handle assigned to appropriate element", function() { + expect( 4 ); + + var element = $( "

" ).appendTo( "#qunit-fixture" ).draggable(); + ok( element.hasClass( "ui-draggable-handle" ), "handle is element by default" ); + + element.draggable( "option", "handle", "p" ); + ok( !element.hasClass( "ui-draggable-handle" ), "removed from element" ); + ok( element.find( "p" ).hasClass( "ui-draggable-handle" ), "added to handle" ); + + element.draggable( "destroy" ); + ok( !element.find( "p" ).hasClass( "ui-draggable-handle" ), "removed in destroy()" ); +}); + })( jQuery ); diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js index 18e7dae08..54069a9bf 100644 --- a/tests/unit/sortable/sortable_core.js +++ b/tests/unit/sortable/sortable_core.js @@ -16,4 +16,25 @@ test( "#9314: Sortable: Items cannot be dragged directly into bottom position", TestHelpers.sortable.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" ); }); +test( "ui-sortable-handle applied to appropriate element", function() { + expect( 6 ); + var item = "
  • ", + el = $( "" ) + .sortable() + .appendTo( "#qunit-fixture" ); + + ok( el.find( "li:first" ).hasClass( "ui-sortable-handle" ), "defaults to item" ); + ok( el.find( "li:last" ).hasClass( "ui-sortable-handle" ), "both items received class name" ); + + el.sortable( "option", "handle", "p" ); + ok( !el.find( "li" ).hasClass( "ui-sortable-handle" ), "removed on change" ); + ok( el.find( "p" ).hasClass( "ui-sortable-handle" ), "applied to handle" ); + + el.append( item ).sortable( "refresh" ); + ok( el.find( "p:last" ).hasClass( "ui-sortable-handle" ), "class name applied on refresh" ); + + el.sortable( "destroy" ); + equal( el.find( ".ui-sortable-handle" ).length, 0, "class name removed on destroy" ); +}); + })( jQuery ); -- cgit v1.2.3