Skip to content

Commit d6885b8

Browse files
committed
Datepicker: Improve callbacks test for onUpdateDatepicker
Make sure the custom element added by the onUpdateDatepicker callback still exists and is not duplicated after calling refresh and setDate.
1 parent 9a02bb3 commit d6885b8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/unit/datepicker/options.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ function onUpdateDatepicker( inst ) {
819819
}
820820

821821
QUnit.test( "callbacks", function( assert ) {
822-
assert.expect( 16 );
822+
assert.expect( 18 );
823823

824824
// Before show
825825
var dp, day20, day21,
@@ -855,7 +855,12 @@ QUnit.test( "callbacks", function( assert ) {
855855
inp.val( "02/04/2008" ).datepicker( "show" );
856856
assert.ok( onUpdateDatepickerThis.id === inp[ 0 ].id, "On update datepicker - this OK" );
857857
assert.deepEqual( onUpdateDatepickerInst, inst, "On update datepicker - inst OK" );
858-
assert.ok( dp.find( "div.on-update-datepicker-test" ).length > 0, "On update datepicker - custom element" );
858+
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element" );
859+
inp.datepicker( "setDate", "02/05/2008" );
860+
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element after setDate" );
861+
inp.datepicker( "refresh" );
862+
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element after refresh" );
863+
inp.datepicker( "hide" ).datepicker( "destroy" );
859864
} );
860865

861866
QUnit.test( "beforeShowDay - tooltips with quotes", function( assert ) {

0 commit comments

Comments
 (0)