<!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px;">
+ <div id="donor-outer">
+ <form id="donor-form">
+ <input id="donor-input" type="radio" />
+ </form>
+ </div>
<div id="qunit-fixture">
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
<p id="ap">
}
});
+test( "preventDefault() on focusin does not throw exception", function( assert ) {
+ expect( 1 );
+
+ var done = assert.async(),
+ input = jQuery( "<input/>" ).appendTo( "#form" );
+ input
+ .on( "focusin", function( event ) {
+ var exceptionCaught;
+
+ try {
+ event.preventDefault();
+ } catch ( theException ) {
+ exceptionCaught = theException;
+ }
+
+ assert.strictEqual( exceptionCaught, undefined,
+ "Preventing default on focusin throws no exception" );
+
+ done();
+ } )
+ .focus();
+} );
+
+test( "jQuery.event.simulate() event has no originalEvent", function( assert ) {
+ expect( 1 );
+
+ var done = assert.async(),
+ input = jQuery( "<input>" )
+ .on( "click", function( event ) {
+ assert.strictEqual( "originalEvent" in event, false,
+ "originalEvent not present on simulated event" );
+ done();
+ } );
+
+ jQuery.event.simulate( "click", input[ 0 ], new jQuery.Event(), true );
+} );
+
+test( "Donor event interference", function( assert ) {
+ assert.expect( 4 );
+
+ jQuery( "#donor-outer" ).on( "click", function() {
+ assert.ok( true, "click bubbled to outer div" );
+ } );
+ jQuery( "#donor-input" ).on( "click", function( event ) {
+ assert.ok( true, "got a click event from the input" );
+ assert.ok( !event.isPropagationStopped(), "propagation says it's not stopped" );
+ } );
+ jQuery( "#donor-input" ).on( "change", function( event ) {
+ assert.ok( true, "got a change event from the input" );
+ event.stopPropagation();
+ } );
+ jQuery( "#donor-input" )[0].click();
+} );
+
// This tests are unreliable in Firefox
if ( !(/firefox/i.test( window.navigator.userAgent )) ) {
test( "Check order of focusin/focusout events", 2, function() {