Skip to content

Commit

Permalink
Unit tests for issue jquery-archive#1526
Browse files Browse the repository at this point in the history
  • Loading branch information
gseguin committed Jul 13, 2011
1 parent 3062d38 commit 584e307
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/unit/slider/index.html
Expand Up @@ -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>
14 changes: 14 additions & 0 deletions tests/unit/slider/slider_events.js
Expand Up @@ -3,6 +3,10 @@
*/

(function($){
var onChangeCnt = 0;
window.onChangeCounter = function() {
onChangeCnt++;
}
module('jquery.mobile.slider.js');

var keypressTest = function(opts){
Expand Down Expand Up @@ -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);

0 comments on commit 584e307

Please sign in to comment.