diff options
author | Patrick McKay <patrick.mckay@vumc.org> | 2020-03-01 08:09:21 -0600 |
---|---|---|
committer | Felix Nagel <fnagel@users.noreply.github.com> | 2021-05-21 17:58:10 +0200 |
commit | a12c98574d07f002fd59d166f9fc1fd391581b91 (patch) | |
tree | 3bfe21c02d161f8219701aa037a47838bb5cafd1 | |
parent | 17d115b8298b935ab0d26b881d4f6f3e83984868 (diff) | |
download | jquery-ui-a12c98574d07f002fd59d166f9fc1fd391581b91.tar.gz jquery-ui-a12c98574d07f002fd59d166f9fc1fd391581b91.zip |
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.
-rw-r--r-- | tests/unit/datepicker/options.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index 0ce771c5e..51ed93b71 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -839,7 +839,7 @@ function onUpdateDatepicker( inst ) { } QUnit.test( "callbacks", function( assert ) { - assert.expect( 16 ); + assert.expect( 18 ); // Before show var dp, day20, day21, @@ -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 ) { |