diff options
author | Felix Nagel <info@felixnagel.com> | 2012-11-23 13:49:12 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-11-23 13:49:12 +0100 |
commit | e25cdd88e7f2558311492957e379e11f987a1080 (patch) | |
tree | a0353f8f3ef49537618721d0bbd7cfab2b432759 /tests/unit/slider/slider_events.js | |
parent | 0d4a8dca55562131212f2638af4bf05052a41b2a (diff) | |
parent | 421aeaa08135e747ff9f2a59974c26b350cdcda7 (diff) | |
download | jquery-ui-e25cdd88e7f2558311492957e379e11f987a1080.tar.gz jquery-ui-e25cdd88e7f2558311492957e379e11f987a1080.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/unit/slider/slider_events.js')
-rw-r--r-- | tests/unit/slider/slider_events.js | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js index 2fb9b37b6..d5e7dff45 100644 --- a/tests/unit/slider/slider_events.js +++ b/tests/unit/slider/slider_events.js @@ -70,7 +70,6 @@ test( "programmatic event triggers", function() { }) .slider( "value", 0 ); - QUnit.reset(); // Test values method el = $( "<div></div>" ) .slider({ @@ -81,7 +80,6 @@ test( "programmatic event triggers", function() { }) .slider( "values", [80, 90] ); - QUnit.reset(); // Test value option el = $( "<div></div>" ) .slider({ @@ -91,7 +89,6 @@ test( "programmatic event triggers", function() { }) .slider( "option", "value", 0 ); - QUnit.reset(); // Test values option el = $( "<div></div>" ) .slider({ @@ -104,4 +101,55 @@ test( "programmatic event triggers", function() { }); +test( "mouse based interaction part two: when handles overlap", function() { + expect(4); + + var el = $( "#slider1" ) + .slider({ + values: [ 0, 0, 0 ], + start: function( event, ui ) { + equal(handles.index(ui.handle), 2, "rightmost handle activated when overlapping at minimum (#3736)"); + } + }), + handles = el.find( ".ui-slider-handle" ); + handles.eq(0).simulate( "drag", { dx: 10 } ); + el.slider( "destroy" ); + + el = $( "#slider1" ) + .slider({ + values: [ 10, 10, 10 ], + max: 10, + start: function( event, ui ) { + equal(handles.index(ui.handle), 0, "leftmost handle activated when overlapping at maximum"); + } + }), + handles = el.find( ".ui-slider-handle" ); + handles.eq(0).simulate( "drag", { dx: -10 } ); + el.slider( "destroy" ); + + el = $( "#slider1" ) + .slider({ + values: [ 19, 20 ] + }), + handles = el.find( ".ui-slider-handle" ); + handles.eq(0).simulate( "drag", { dx: 10 } ); + el.one("slidestart", function(event, ui) { + equal(handles.index(ui.handle), 0, "left handle activated if left was moved last"); + }); + handles.eq(0).simulate( "drag", { dx: 10 } ); + el.slider( "destroy" ); + + el = $( "#slider1" ) + .slider({ + values: [ 19, 20 ] + }), + handles = el.find( ".ui-slider-handle" ); + handles.eq(1).simulate( "drag", { dx: -10 } ); + el.one("slidestart", function(event, ui) { + equal(handles.index(ui.handle), 1, "right handle activated if right was moved last (#3467)"); + }); + handles.eq(0).simulate( "drag", { dx: 10 } ); + +}); + }( jQuery ) ); |