Showing with 33 additions and 3 deletions.
  1. +30 −0 tests/jquery.testHelper.js
  2. +1 −1 tests/unit/slider/slider_events.js
  3. +2 −2 tests/unit/textinput/textinput_core.js
@@ -372,6 +372,36 @@
}
},

// Convert a pair of version strings into a pair of integers and pass the
// resulting integers to a comparison function
versionTest: function( l, t, r ) {
var lAr = l.split( "." ), lLength = lAr.length,
rAr = r.split( "." ), rLength = rAr.length,
lVal, rVal, lRes = "", rRes = "", min, max, str, idx1, diff;
for ( idx = 0 ; idx < lLength || idx < rLength ; idx++ ) {
str = {};
lVal = ( idx < lLength ? parseInt( lAr[ idx ] ) : 0 );
rVal = ( idx < rLength ? parseInt( rAr[ idx ] ) : 0 );

// This ignores things like 10a vs. 10b for now
str.l = String( lVal );
str.r = String( rVal );
min = ( str.l.length < str.r.length ) ? "l" : "r";
max = ( str.l.length < str.r.length ) ? "r" : "l";
diff = str[ max ].length - str[ min ].length;

// Make sure orders of magnitude align
for ( idx1 = 0; idx1 < diff ; idx1++ ) {
str[ min ] = "0" + str[ min ];
}
lRes = lRes + str.l;
rRes = rRes + str.r;
}

// trim initial 0s and return the result of the comparison
return t( parseInt( lRes.replace( /^0*/, "" ) ), parseInt( rRes.replace( /^0*/, "" ) ) );
},

navReset: function( url ) {
var pageReset = function( hash ) {
var timeout;
@@ -401,7 +401,7 @@
// and with the advent of the widget _on method we are actually testing the
// widget from UI which has it's own test suite for these sorts of things
// ie, don't test your dependencies / framework
if( !( $.fn.jquery.match(/^1.8/) )){
if( $.testHelper.versionTest( $.fn.jquery, function( l, r ) { return ( l < r ); }, "1.8" ) ){
test( "slider should detach event", function() {
var slider = $( "#remove-events-slider" ),
doc = $( document ),
@@ -8,7 +8,7 @@
// and with the advent of the widget _on method we are actually testing the
// widget from UI which has it's own test suite for these sorts of things
// ie, don't test your dependencies / framework
if( !( $.fn.jquery.match(/^1.8/) )){
if( $.testHelper.versionTest( $.fn.jquery, function( l, r ) { return ( l < r ); }, "1.8" ) ){
test( "input is cleaned up on destroy", function(){
var input = $( "#destroycorrectly" ),
win = $( window ),
@@ -81,4 +81,4 @@
test( "'clear text' button for search inputs should use configured text", function(){
strictEqual( $( "#search-input" ).closest( ".ui-input-search" ).find( ".ui-input-clear" ).attr( "title" ), "custom value" );
});
})(jQuery);
})(jQuery);