Permalink
Browse files

fix tests for jquery git which moved the event data (which we shouldn…

…'t be checking)
  • Loading branch information...
1 parent 1230d8a commit a5ad657dcf7bdda26175dfa94467f2a35be192fc @johnbender johnbender committed Aug 7, 2012
Showing with 14 additions and 12 deletions.
  1. +2 −6 js/widgets/forms/textinput.js
  2. +12 −6 tests/unit/textinput/textinput_core.js
@@ -125,24 +125,20 @@ $.widget( "mobile.textinput", $.mobile.widget, {
// binding to pagechange here ensures that for pages loaded via
// ajax the height is recalculated without user input
- $( document ).one( "pagechange", this._keyup );
+ this._on( $(document), {"pagechange": "_keyup" });
// Issue 509: the browser is not providing scrollHeight properly until the styles load
if ( $.trim( input.val() ) ) {
// bind to the window load to make sure the height is calculated based on BOTH
// the DOM and CSS
- $( window ).load( this._keyup );
+ this._on( $(window), {"load": "_keyup"});
}
}
if ( input.attr( "disabled" ) ) {
this.disable();
}
},
- _destroy: function() {
- $( window ).unbind( "load", this._keyup );
- },
-
disable: function() {
var $el;
if ( this.element.attr( "disabled", true ).is( "[type='search'], :jqmData(type='search')" ) ) {
@@ -4,17 +4,23 @@
(function($){
module( "jquery.mobile.forms.textinput.js" );
- test( "input is cleaned up on destroy", function(){
- var input = $( "#destroycorrectly" ),
+ // NOTE this test isn't run because the event data isn't easily accessible
+ // 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/) )){
+ test( "input is cleaned up on destroy", function(){
+ var input = $( "#destroycorrectly" ),
win = $( window ),
loadLen;
- loadLen = win.data("events").load.length;
+ loadLen = win.data("events").load.length;
- input.remove();
+ input.remove();
- equal(win.data("events").load.length, (loadLen-1), "window load event was not removed");
- });
+ equal(win.data("events").load.length, (loadLen-1), "window load event was not removed");
+ });
+ }
test( "inputs without type specified are enhanced", function(){
ok( $( "#typeless-input" ).hasClass( "ui-input-text" ) );

0 comments on commit a5ad657

Please sign in to comment.