Skip to content

Commit

Permalink
Revert "Event: Add radio click triggering tests"
Browse files Browse the repository at this point in the history
This reverts commit 5f35b5b.
  • Loading branch information
timmywil committed Mar 20, 2017
1 parent 4d6b453 commit 35785a3
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions test/unit/event.js
Expand Up @@ -2364,48 +2364,33 @@ QUnit.test( "clone() delegated events (#11076)", function( assert ) {
clone.remove(); clone.remove();
} ); } );


QUnit.test( "checkbox state (#3827, gh-3423)", function( assert ) { QUnit.test( "checkbox state (#3827)", function( assert ) {
assert.expect( 17 ); assert.expect( 9 );


var cbParent = jQuery( "<div><input type=checkbox><div>" ).appendTo( "#qunit-fixture" ), var markup = jQuery( "<div><input type=checkbox><div>" ).appendTo( "#qunit-fixture" ),
cb = cbParent.find( "input" )[ 0 ], cb = markup.find( "input" )[ 0 ];
radioParent = jQuery(
"<div><input type=radio name=gh3423><input type=radio name=gh3423><div>"
).appendTo( "#qunit-fixture" ),
radio = radioParent.find( "input" )[ 0 ],
radio2 = radioParent.find( "input" )[ 1 ];


jQuery( cb ).on( "click", function() { jQuery( cb ).on( "click", function() {
assert.equal( this.checked, false, "just-clicked checkbox is not checked" ); assert.equal( this.checked, false, "just-clicked checkbox is not checked" );
} ); } );
cbParent.on( "click", function() { markup.on( "click", function() {
assert.equal( cb.checked, false, "checkbox is not checked in bubbled event" ); assert.equal( cb.checked, false, "checkbox is not checked in bubbled event" );
} ); } );
radioParent.on( "click", function() {
assert.equal( radio.checked, false, "radio is not checked in bubbled event" );
} );


// Native click // Native click
cb.checked = radio.checked = true; cb.checked = true;
assert.equal( cb.checked, true, "native - checkbox is initially checked" ); assert.equal( cb.checked, true, "native - checkbox is initially checked" );
assert.equal( radio.checked, true, "native - radio is initially checked" );
cb.click(); cb.click();
radio2.click();
assert.equal( cb.checked, false, "native - checkbox is no longer checked" ); assert.equal( cb.checked, false, "native - checkbox is no longer checked" );
assert.equal( radio.checked, false, "native - radio is no longer checked" );


// jQuery click // jQuery click
cb.checked = radio.checked = true; cb.checked = true;
assert.equal( cb.checked, true, ".trigger - checkbox is initially checked" ); assert.equal( cb.checked, true, "jQuery - checkbox is initially checked" );
assert.equal( radio.checked, true, ".trigger - radio is initially checked" ); jQuery( cb ).trigger( "click" );
jQuery( [ cb, radio2 ] ).trigger( "click" ); assert.equal( cb.checked, false, "jQuery - checkbox is no longer checked" );
assert.equal( cb.checked, false, ".trigger - checkbox is no longer checked" );
assert.equal( radio.checked, false, ".trigger - radio is no longer checked" );


// Handlers only; checkbox state remains false // Handlers only; checkbox state remains false
jQuery( [ cb, radio2 ] ).triggerHandler( "click" ); jQuery( cb ).triggerHandler( "click" );
assert.equal( cb.checked, false, ".triggerHandler - checkbox is still unchecked" );
assert.equal( radio.checked, false, ".triggerHandler - radio is still unchecked" );
} ); } );


QUnit.test( "hover event no longer special since 1.9", function( assert ) { QUnit.test( "hover event no longer special since 1.9", function( assert ) {
Expand Down

0 comments on commit 35785a3

Please sign in to comment.