Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Unit tests for issue #1526

  • Loading branch information...
commit 584e3070ae0c79b54db68d0552f670fffb7e38a7 1 parent 3062d38
@gseguin gseguin authored
Showing with 18 additions and 0 deletions.
  1. +4 −0 tests/unit/slider/index.html
  2. +14 −0 tests/unit/slider/slider_events.js
View
4 tests/unit/slider/index.html
@@ -53,5 +53,9 @@ <h2 id="qunit-userAgent"></h2>
<option value="on">On</option>
</select>
</div>
+
+ <div data-nstest-role="fieldcontain">
+ <input type="range" name="onchange" id="onchange" value="25" min="0" max="100" step="10" onchange="onChangeCounter()" data-nstest-theme="b" data-nstest-track-theme="a" />
+ </div>
</div>
</html>
View
14 tests/unit/slider/slider_events.js
@@ -3,6 +3,10 @@
*/
(function($){
+ var onChangeCnt = 0;
+ window.onChangeCounter = function() {
+ onChangeCnt++;
+ }
module('jquery.mobile.slider.js');
var keypressTest = function(opts){
@@ -137,4 +141,14 @@
keyCodes: ['DOWN', 'LEFT', 'PAGE_DOWN', 'HOME']
});
});
+
+ test( "onchange should not be called on create", function(){
+ equals(onChangeCnt, 0, "onChange should not have been called");
+ });
+
+ test( "onchange should be called onchange", function(){
+ onChangeCnt = 0;
+ $( "#onchange" ).slider( "refresh", 50 );
+ equals(onChangeCnt, 1, "onChange should have been called once");
+ });
})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.