diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2021-05-04 13:30:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 13:30:06 +0200 |
commit | 32850869d308d5e7c9bf3e3b4d483ea886d373ce (patch) | |
tree | a4b4a35554fd84c0c65f5a6d972d3bc12f32725d /tests | |
parent | 9380d2734e9f3674ca1fcf1ba5981c3c5a858576 (diff) | |
download | jquery-ui-32850869d308d5e7c9bf3e3b4d483ea886d373ce.tar.gz jquery-ui-32850869d308d5e7c9bf3e3b4d483ea886d373ce.zip |
Datepicker: Make sure altField is treated as a CSS selector
Closes gh-1954
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/datepicker/options.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index d70220955..e5e938a0f 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -623,8 +623,10 @@ QUnit.test( "setDate", function( assert ) { } ); QUnit.test( "altField", function( assert ) { - assert.expect( 10 ); - var inp = testHelper.init( "#inp" ), + assert.expect( 11 ); + + var done = assert.async(), + inp = testHelper.init( "#inp" ), alt = $( "#alt" ); // No alternate field set @@ -664,6 +666,22 @@ QUnit.test( "altField", function( assert ) { inp.simulate( "keydown", { ctrlKey: true, keyCode: $.ui.keyCode.END } ); assert.equal( inp.val(), "", "Alt field - dp - ctrl+end" ); assert.equal( alt.val(), "", "Alt field - alt - ctrl+end" ); + + // HTML instead of selector + alt.val( "" ); + try { + inp.datepicker( "option", { + altField: "<img onerror='window.globalAltField=true' src='/404' />", + altFormat: "yy-mm-dd" + } ).val( "06/04/2008" ).datepicker( "show" ); + inp.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); + } catch ( e ) {} + + setTimeout( function() { + assert.equal( window.globalAltField, undefined, "altField treated as a selector" ); + delete window.globalAltField; + done(); + }, 500 ); } ); QUnit.test( "autoSize", function( assert ) { |