mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Fixed current instance memory leak and added unit testcases
This commit is contained in:
parent
0c860b0d92
commit
817ce38555
@ -8,8 +8,17 @@ define( [
|
||||
QUnit.module( "datepicker: methods" );
|
||||
|
||||
QUnit.test( "destroy", function( assert ) {
|
||||
assert.expect( 33 );
|
||||
assert.expect( 35 );
|
||||
var inl,
|
||||
inp = testHelper.init( "#inp" ),
|
||||
dp = $( "#ui-datepicker-div" );
|
||||
|
||||
// Destroy and clear active reference
|
||||
inp.datepicker( "show" );
|
||||
assert.equal( dp.css( "display" ), "block", "Datepicker - visible" );
|
||||
inp.datepicker( "hide" ).datepicker( "destroy" );
|
||||
assert.ok( $.datepicker._curInst == null, "Datepicker - destroyed and cleared reference" );
|
||||
|
||||
inp = testHelper.init( "#inp" );
|
||||
assert.ok( inp.is( ".hasDatepicker" ), "Default - marker class set" );
|
||||
assert.ok( $.data( inp[ 0 ], testHelper.PROP_NAME ), "Default - instance present" );
|
||||
|
@ -408,6 +408,7 @@ $.extend( Datepicker.prototype, {
|
||||
|
||||
if ( datepicker_instActive === inst ) {
|
||||
datepicker_instActive = null;
|
||||
this._curInst = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user