Permalink
Browse files

test slidestart and slidestop events

  • Loading branch information...
1 parent 98dfce2 commit 2fc47df7d96868a061c0f86eff595ee34e9250a2 @johnbender johnbender committed Jul 27, 2012
Showing with 31 additions and 0 deletions.
  1. +7 −0 tests/unit/slider/index.html
  2. +24 −0 tests/unit/slider/slider_events.js
@@ -96,9 +96,16 @@ <h2 id="qunit-userAgent"></h2>
<label id="label-id" for="label-id-slider">Input slider:</label>
<input type="range" name="slider" id="label-id-slider" value="25" min="0" max="100"/>
</div>
+
+ <div data-role="fieldcontain">
+ <label for="start-stop-events">Input slider:</label>
+ <input type="range" name="slider" id="start-stop-events" value="25" min="0" max="100"/>
+ </div>
</div>
<div id="enhancetest">
<input type="range" name="slider-enhancetest" id="range-slider-enhancetest" value="75" min="0" max="100" data-nstest-theme="b" data-nstest-track-theme="a" />
</div>
+
+
</html>
@@ -373,4 +373,28 @@
}
], 500);
});
+
+ asyncTest( "moving the slider triggers 'slidestart' and 'slidestop' events", function() {
+ var control = $( "#start-stop-events" ),
+ widget = control.data( "slider" ),
+ slider = widget.slider;
+
+ $.testHelper.eventCascade([
+ function() {
+ // trigger the slider grab event
+ slider.trigger( "mousedown" );
+ },
+
+ "slidestart", function( timeout ) {
+ ok( !timeout, "slidermovestart fired" );
+ slider.trigger( "mouseup" );
+ },
+
+ "slidestop", function( timeout ) {
+ ok( !timeout, "slidermovestop fired" );
+ start();
+ }
+ ], 500);
+ });
+
})(jQuery);

0 comments on commit 2fc47df

Please sign in to comment.