Unit tests for issue #1526

This commit is contained in:
Ghislain Seguin 2011-07-12 23:25:54 -07:00
parent 3062d385b8
commit 584e3070ae
2 changed files with 18 additions and 0 deletions

View file

@ -53,5 +53,9 @@
<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 file

@ -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);