mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Tests: Remove side-effects of one attributes test
One test in the attribute module was overwriting jQuery.expr.attrHandle.checked and wasn't restoring the original state after it finished. It started causing issues for another checked-related test.
This commit is contained in:
parent
2df590e4ec
commit
f9ea869ab5
@ -487,7 +487,9 @@ QUnit.test( "attr(non-ASCII)", function( assert ) {
|
||||
QUnit.test( "attr - extending the boolean attrHandle", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var called = false,
|
||||
_handle = jQuery.expr.attrHandle.checked || $.noop;
|
||||
origAttrHandleHadChecked = "checked" in jQuery.expr.attrHandle,
|
||||
origAttrHandleChecked = jQuery.expr.attrHandle.checked,
|
||||
_handle = origAttrHandleChecked || $.noop;
|
||||
jQuery.expr.attrHandle.checked = function() {
|
||||
called = true;
|
||||
_handle.apply( this, arguments );
|
||||
@ -496,6 +498,13 @@ QUnit.test( "attr - extending the boolean attrHandle", function( assert ) {
|
||||
called = false;
|
||||
jQuery( "#qunit-fixture input" ).attr( "checked" );
|
||||
assert.ok( called, "The boolean attrHandle does not drop custom attrHandles" );
|
||||
|
||||
if ( origAttrHandleHadChecked ) {
|
||||
jQuery.expr.attrHandle.checked = origAttrHandleChecked;
|
||||
} else {
|
||||
delete jQuery.expr.attrHandle.checked;
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
QUnit.test( "attr(String, Object) - Loaded via XML document", function( assert ) {
|
||||
|
Loading…
Reference in New Issue
Block a user