Permalink
Browse files

Unit tests: Slider: Allow both 0 and 1 for event.which test.

  • Loading branch information...
1 parent cd2e2c0 commit 12c07c1714d1822d72a4e6883bfc5ba838544209 @gabrielschulhof gabrielschulhof committed Mar 14, 2013
Showing with 17 additions and 5 deletions.
  1. +17 −5 tests/unit/slider/slider_events.js
@@ -375,38 +375,50 @@
});
asyncTest( "drag should start only when clicked with left button", function(){
- expect( 3 );
+ expect( 4 );
var control = $( "#mousedown-which-events" ),
widget = control.data( "mobile-slider" ),
slider = widget.slider,
handle = widget.handle,
eventNs = ".dragShouldStartOnlyWhenClickedWithLeftButton",
- event = $.Event( "mousedown", { target: handle[ 0 ] } );
+ event;
$.testHelper.detailedEventCascade( [
function() {
- event.which = 1;
+ event = $.Event( "mousedown", { target: handle[ 0 ] } );
+ event.which = 0;
slider.trigger( event );
},
{
slidestart: { src: control, event: "slidestart" + eventNs + "0" }
},
function( result ) {
+ deepEqual( result.slidestart.timedOut, false, "slider did emit 'slidestart' event upon 0 button press" );
+ event = $.Event( "mousedown", { target: handle[ 0 ] } );
+ event.which = 1;
+ slider.trigger( event );
+ },
+ {
+ slidestart: { src: control, event: "slidestart" + eventNs + "1" }
+ },
+ function( result ) {
deepEqual( result.slidestart.timedOut, false, "slider did emit 'slidestart' event upon left button press" );
+ event = $.Event( "mousedown", { target: handle[ 0 ] } );
event.which = 2;
slider.trigger( event );
},
{
- slidestart: { src: control, event: "slidestart" + eventNs + "1" }
+ slidestart: { src: control, event: "slidestart" + eventNs + "2" }
},
function( result ) {
deepEqual( result.slidestart.timedOut, true, "slider did not emit 'slidestart' event upon middle button press" );
+ event = $.Event( "mousedown", { target: handle[ 0 ] } );
event.which = 3;
slider.trigger( event );
},
{
- slidestart: { src: control, event: "slidestart" + eventNs + "2" }
+ slidestart: { src: control, event: "slidestart" + eventNs + "3" }
},
function( result ) {
deepEqual( result.slidestart.timedOut, true, "slider did not emit 'slidestart' event upon right button press" );

0 comments on commit 12c07c1

Please sign in to comment.