Skip to content

Commit ddb2c06

Browse files
Alexander Lisianoitimmywil
authored andcommitted
Tests: limit selection to #qunit-fixture in attributes.js
Ref gh-2880 Close gh-2921
1 parent 12038c7 commit ddb2c06

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/unit/attributes.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ QUnit.test( "attr(String, Function)", function( assert ) {
220220
QUnit.test( "attr(Hash)", function( assert ) {
221221
assert.expect( 3 );
222222
var pass = true;
223-
jQuery( "div" ).attr( {
223+
224+
jQuery( "#qunit-fixture div" ).attr( {
224225
"foo": "baz",
225226
"zoo": "ping"
226227
} ).each( function() {
@@ -258,7 +259,7 @@ QUnit.test( "attr(String, Object)", function( assert ) {
258259
attributeNode, commentNode, textNode, obj,
259260
table, td, j, type,
260261
check, thrown, button, $radio, $radios, $svg,
261-
div = jQuery( "div" ).attr( "foo", "bar" ),
262+
div = jQuery( "#qunit-fixture div" ).attr( "foo", "bar" ),
262263
i = 0,
263264
fail = false;
264265

@@ -491,9 +492,9 @@ QUnit.test( "attr - extending the boolean attrHandle", function( assert ) {
491492
called = true;
492493
_handle.apply( this, arguments );
493494
};
494-
jQuery( "input" ).attr( "checked" );
495+
jQuery( "#qunit-fixture input" ).attr( "checked" );
495496
called = false;
496-
jQuery( "input" ).attr( "checked" );
497+
jQuery( "#qunit-fixture input" ).attr( "checked" );
497498
assert.ok( called, "The boolean attrHandle does not drop custom attrHandles" );
498499
} );
499500

@@ -1027,7 +1028,7 @@ QUnit.test( "val(Function)", function( assert ) {
10271028
QUnit.test( "val(Array of Numbers) (Bug #7123)", function( assert ) {
10281029
assert.expect( 4 );
10291030
jQuery( "#form" ).append( "<input type='checkbox' name='arrayTest' value='1' /><input type='checkbox' name='arrayTest' value='2' /><input type='checkbox' name='arrayTest' value='3' checked='checked' /><input type='checkbox' name='arrayTest' value='4' />" );
1030-
var elements = jQuery( "input[name=arrayTest]" ).val( [ 1, 2 ] );
1031+
var elements = jQuery( "#form input[name=arrayTest]" ).val( [ 1, 2 ] );
10311032
assert.ok( elements[ 0 ].checked, "First element was checked" );
10321033
assert.ok( elements[ 1 ].checked, "Second element was checked" );
10331034
assert.ok( !elements[ 2 ].checked, "Third element was unchecked" );

0 commit comments

Comments
 (0)