Skip to content

Commit

Permalink
Datepicker: Improve callbacks test for onUpdateDatepicker
Browse files Browse the repository at this point in the history
Make sure the custom element added by the onUpdateDatepicker callback still exists and is not duplicated after calling refresh and setDate.
  • Loading branch information
patrick-vandy authored and fnagel committed May 21, 2021
1 parent 17d115b commit a12c985
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/unit/datepicker/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ function onUpdateDatepicker( inst ) {
}

QUnit.test( "callbacks", function( assert ) {
assert.expect( 16 );
assert.expect( 18 );

// Before show
var dp, day20, day21,
Expand Down Expand Up @@ -875,7 +875,12 @@ QUnit.test( "callbacks", function( assert ) {
inp.val( "02/04/2008" ).datepicker( "show" );
assert.ok( onUpdateDatepickerThis.id === inp[ 0 ].id, "On update datepicker - this OK" );
assert.deepEqual( onUpdateDatepickerInst, inst, "On update datepicker - inst OK" );
assert.ok( dp.find( "div.on-update-datepicker-test" ).length > 0, "On update datepicker - custom element" );
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element" );
inp.datepicker( "setDate", "02/05/2008" );
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element after setDate" );
inp.datepicker( "refresh" );
assert.ok( dp.find( "div.on-update-datepicker-test" ).length === 1, "On update datepicker - custom element after refresh" );
inp.datepicker( "hide" ).datepicker( "destroy" );
} );

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

0 comments on commit a12c985

Please sign in to comment.