aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjigar gala <jigar.gala140291@gmail.com>2018-02-01 01:15:58 +0530
committerFelix Nagel <fnagel@users.noreply.github.com>2020-03-23 21:49:23 +0100
commit817ce38555f07981f929fb4b1229fc42574cf85c (patch)
treee65926d4e36371bd577af4b1de166c0fcb6e3cc2 /tests
parent0c860b0d92f9959f6747f8c02e9671eb2fc561aa (diff)
downloadjquery-ui-817ce38555f07981f929fb4b1229fc42574cf85c.tar.gz
jquery-ui-817ce38555f07981f929fb4b1229fc42574cf85c.zip
Datepicker: Fixed current instance memory leak and added unit testcases
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/datepicker/methods.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/unit/datepicker/methods.js b/tests/unit/datepicker/methods.js
index 4fc0c84ec..8729c5606 100644
--- a/tests/unit/datepicker/methods.js
+++ b/tests/unit/datepicker/methods.js
@@ -8,9 +8,18 @@ define( [
QUnit.module( "datepicker: methods" );
QUnit.test( "destroy", function( assert ) {
- assert.expect( 33 );
+ assert.expect( 35 );
var inl,
- inp = testHelper.init( "#inp" );
+ 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" );
assert.ok( inp.next().is( "#alt" ), "Default - button absent" );