From c8d15a2f9f108e90d3651c31e4abf45415a30fde Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Tue, 8 Sep 2015 03:26:29 +0300 Subject: [PATCH] Tests: further improvements QUnit 2.0 migration * Remove QUnit jshint globals * Extend QUnit.assert methods * Use assert.async instead of start/stop/done Ref b930d14ce64937e9478405eee2828d4da091d2cb --- test/.jshintrc | 13 --- test/data/testinit.js | 6 +- test/data/testrunner.js | 16 +-- test/unit/ajax.js | 74 +++++++------ test/unit/attributes.js | 4 +- test/unit/core.js | 20 ++-- test/unit/css.js | 161 +++++++++++++++-------------- test/unit/data.js | 4 +- test/unit/deferred.js | 6 +- test/unit/dimensions.js | 12 +-- test/unit/effects.js | 8 +- test/unit/event.js | 14 ++- test/unit/manipulation.js | 8 +- test/unit/selector.js | 212 +++++++++++++++++++------------------- test/unit/support.js | 6 +- test/unit/traversing.js | 2 +- 16 files changed, 294 insertions(+), 272 deletions(-) diff --git a/test/.jshintrc b/test/.jshintrc index 6b380d6ba..5516f8404 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -27,17 +27,6 @@ "Promise": false, "Symbol": false, "QUnit": false, - "ok": false, - "equal": false, - "asyncTest": false, - "notEqual": false, - "deepEqual": false, - "strictEqual": false, - "notStrictEqual": false, - "start": false, - "stop": false, - "expect": false, - "throws": false, "ajaxTest": false, "testIframe": false, "testIframeWithCallback": false, @@ -52,8 +41,6 @@ "jQuery": true, "sinon": true, - "module": true, - "test": true, "amdDefined": true, "fireNative": true, "Globals": true, diff --git a/test/data/testinit.js b/test/data/testinit.js index 491440e19..341e39413 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -38,7 +38,7 @@ this.q = function() { * @example t("Check for something", "//[a]", ["foo", "baar"]); * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar' */ -this.t = function( a, b, c ) { +QUnit.assert.t = function( a, b, c ) { var f = jQuery( b ).get(), s = "", i = 0; @@ -47,7 +47,7 @@ this.t = function( a, b, c ) { s += ( s && "," ) + '"' + f[ i ].id + '"'; } - deepEqual( f, q.apply( q, c ), a + " (" + b + ")" ); + this.deepEqual( f, q.apply( q, c ), a + " (" + b + ")" ); }; this.createDashboardXML = function() { @@ -199,7 +199,7 @@ this.ajaxTest = function( title, expect, options ) { if ( !completed ) { completed = true; delete ajaxTest.abort; - ok( false, "aborted " + reason ); + assert.ok( false, "aborted " + reason ); jQuery.each( requests, function( i, request ) { request.abort(); } ); diff --git a/test/data/testrunner.js b/test/data/testrunner.js index 454e8035e..e5ca01389 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -24,7 +24,7 @@ QUnit.config.requireExpects = true; * @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data. * @param {string} key */ -QUnit.expectJqData = function( env, elems, key ) { +QUnit.assert.expectJqData = function( env, elems, key ) { var i, elem, expando; // As of jQuery 2.0, there will be no "cache"-data is @@ -64,7 +64,7 @@ QUnit.expectJqData = function( env, elems, key ) { // Since this method was called it means some data was // expected to be found, but since there is nothing, fail early // (instead of in teardown). - notStrictEqual( + this.notStrictEqual( expando, undefined, "Target for expectJqData must have an expando, " + @@ -92,7 +92,7 @@ QUnit.config.urlConfig.push( { * Ensures that tests have cleaned up properly after themselves. Should be passed as the * teardown function on all modules' lifecycle object. */ -window.moduleTeardown = function() { +window.moduleTeardown = function( assert ) { var i, expectedKeys, actualKeys, cacheLength = 0; @@ -103,7 +103,7 @@ window.moduleTeardown = function() { expectedKeys = expectedDataKeys[ i ]; actualKeys = jQuery.cache[ i ] ? Object.keys( jQuery.cache[ i ] ) : jQuery.cache[ i ]; if ( !QUnit.equiv( expectedKeys, actualKeys ) ) { - deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" ); + assert.deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" ); } delete jQuery.cache[ i ]; delete expectedDataKeys[ i ]; @@ -111,7 +111,7 @@ window.moduleTeardown = function() { // In case it was removed from cache before (or never there in the first place) for ( i in expectedDataKeys ) { - deepEqual( + assert.deepEqual( expectedDataKeys[ i ], undefined, "No unexpected keys were left in jQuery.cache (#" + i + ")" @@ -125,12 +125,12 @@ window.moduleTeardown = function() { // Check for (and clean up, if possible) incomplete animations/requests/etc. if ( jQuery.timers && jQuery.timers.length !== 0 ) { - equal( jQuery.timers.length, 0, "No timers are still running" ); + assert.equal( jQuery.timers.length, 0, "No timers are still running" ); splice.call( jQuery.timers, 0, jQuery.timers.length ); jQuery.fx.stop(); } if ( jQuery.active !== undefined && jQuery.active !== oldActive ) { - equal( jQuery.active, oldActive, "No AJAX requests are still active" ); + assert.equal( jQuery.active, oldActive, "No AJAX requests are still active" ); if ( ajaxTest.abort ) { ajaxTest.abort( "active requests" ); } @@ -148,7 +148,7 @@ window.moduleTeardown = function() { // if we unconditionally assert any of these, // the test will fail with too many assertions :| if ( cacheLength !== oldCacheLength ) { - equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); + assert.equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); oldCacheLength = cacheLength; } }; diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 0cc799800..14fe0bed6 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -172,7 +172,7 @@ QUnit.module( "ajax", { firstTime = false; jQuery.ajax( this ); } else { - ok ( true, "Test retrying with jQuery.ajax(this) works" ); + assert.ok( true, "Test retrying with jQuery.ajax(this) works" ); jQuery.ajax( { url: url( "data/errorWithText.php" ), data: { @@ -1848,20 +1848,28 @@ QUnit.module( "ajax", { jQuery( document ).off( "ajaxStart ajaxStop" ); } ); - QUnit.asyncTest( "jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)", 1, function( assert ) { - jQuery.ajaxSetup( { - type: "POST" - } ); + QUnit.test( + "jQuery#load() - always use GET method even if it overrided through ajaxSetup (#11264)", 1, + function( assert ) { + var done = assert.async(); - jQuery( "#qunit-fixture" ).load( "data/ajax/method.php", function( method ) { - assert.equal( method, "GET" ); - QUnit.start(); - } ); - } ); + jQuery.ajaxSetup( { + type: "POST" + } ); - QUnit.asyncTest( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function() { - jQuery( "#qunit-fixture" ).load( "data/cleanScript.html", start ); - } ); + jQuery( "#qunit-fixture" ).load( "data/ajax/method.php", function( method ) { + assert.equal( method, "GET" ); + done(); + } ); + } + ); + + QUnit.test( + "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, + function( assert ) { + jQuery( "#qunit-fixture" ).load( "data/cleanScript.html", assert.async() ); + } + ); //----------- jQuery.get() @@ -1926,37 +1934,43 @@ QUnit.module( "ajax", { //----------- jQuery.getScript() - QUnit.asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function( assert ) { - Globals.register( "testBar" ); - jQuery.getScript( url( "data/testbar.php" ), function() { - assert.strictEqual( window[ "testBar" ], "bar", "Check if script was evaluated" ); - QUnit.start(); - } ); - } ); + QUnit.test( "jQuery.getScript( String, Function ) - with callback", 2, + function( assert ) { + var done = assert.async(); + + Globals.register( "testBar" ); + jQuery.getScript( url( "data/testbar.php" ), function() { + assert.strictEqual( window[ "testBar" ], "bar", "Check if script was evaluated" ); + done(); + } ); + } + ); - QUnit.asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() { + QUnit.test( "jQuery.getScript( String, Function ) - no callback", 1, function( assert ) { Globals.register( "testBar" ); - jQuery.getScript( url( "data/testbar.php" ) ).done( start ); + jQuery.getScript( url( "data/testbar.php" ) ).done( assert.async() ); } ); - QUnit.asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function( assert ) { + QUnit.test( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function( assert ) { + var done = assert.async(); + Globals.register( "testBar" ); jQuery.getScript( url( "data/testbar.php" ), function( data, _, jqXHR ) { assert.strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" ); - QUnit.start(); + done(); } ); } ); // //----------- jQuery.fn.load() // check if load can be called with only url - QUnit.asyncTest( "jQuery.fn.load( String )", 2, function( assert ) { + QUnit.test( "jQuery.fn.load( String )", 2, function( assert ) { jQuery.ajaxSetup( { beforeSend: function() { assert.strictEqual( this.type, "GET", "no data means GET request" ); } } ); - jQuery( "#first" ).load( "data/name.html", start ); + jQuery( "#first" ).load( "data/name.html", assert.async() ); } ); QUnit.test( "jQuery.fn.load() - 404 error callbacks", function( assert ) { @@ -1971,23 +1985,23 @@ QUnit.module( "ajax", { } ); // check if load can be called with url and null data - QUnit.asyncTest( "jQuery.fn.load( String, null )", 2, function( assert ) { + QUnit.test( "jQuery.fn.load( String, null )", 2, function( assert ) { jQuery.ajaxSetup( { beforeSend: function() { assert.strictEqual( this.type, "GET", "no data means GET request" ); } } ); - jQuery( "#first" ).load( "data/name.html", null, start ); + jQuery( "#first" ).load( "data/name.html", null, assert.async() ); } ); // check if load can be called with url and undefined data - QUnit.asyncTest( "jQuery.fn.load( String, undefined )", 2, function( assert ) { + QUnit.test( "jQuery.fn.load( String, undefined )", 2, function( assert ) { jQuery.ajaxSetup( { beforeSend: function() { assert.strictEqual( this.type, "GET", "no data means GET request" ); } } ); - jQuery( "#first" ).load( "data/name.html", undefined, start ); + jQuery( "#first" ).load( "data/name.html", undefined, assert.async() ); } ); // check if load can be called with only url diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 59c8ec50b..44c0c5325 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1267,7 +1267,7 @@ var testToggleClass = function( valueObj, assert ) { // Cleanup e.removeClass( "testD" ); - QUnit.expectJqData( this, e[ 0 ], "__className__" ); + assert.expectJqData( this, e[ 0 ], "__className__" ); }; QUnit.test( "toggleClass(String|boolean|undefined[, boolean])", function( assert ) { @@ -1470,7 +1470,7 @@ QUnit.test( "option value not trimmed when setting via parent select", function( } ); QUnit.test( "Insignificant white space returned for $(option).val() (#14858)", function( assert ) { - expect ( 3 ); + assert.expect( 3 ); var val = jQuery( "" ).val(); assert.equal( val.length, 0, "Empty option should have no value" ); diff --git a/test/unit/core.js b/test/unit/core.js index d9ec725c9..e2178a374 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -30,7 +30,7 @@ QUnit.test( "jQuery()", function( assert ) { // few here but beware of modular builds where these methods may be excluded. if ( jQuery.fn.click ) { expected++; - attrObj[ "click" ] = function() { ok( exec, "Click executed." ); }; + attrObj[ "click" ] = function() { assert.ok( exec, "Click executed." ); }; } if ( jQuery.fn.width ) { expected++; @@ -1303,7 +1303,9 @@ QUnit.test( "jQuery.proxy", function( assert ) { assert.expect( 9 ); var test2, test3, test4, fn, cb, - test = function() { equal( this, thisObject, "Make sure that scope is set properly." ); }, + test = function() { + assert.equal( this, thisObject, "Make sure that scope is set properly." ); + }, thisObject = { foo: "bar", method: test }; // Make sure normal works @@ -1319,15 +1321,21 @@ QUnit.test( "jQuery.proxy", function( assert ) { assert.equal( jQuery.proxy( null, thisObject ), undefined, "Make sure no function was returned." ); // Partial application - test2 = function( a ) { equal( a, "pre-applied", "Ensure arguments can be pre-applied." ); }; + test2 = function( a ) { + assert.equal( a, "pre-applied", "Ensure arguments can be pre-applied." ); + }; jQuery.proxy( test2, null, "pre-applied" )(); // Partial application w/ normal arguments - test3 = function( a, b ) { equal( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); }; + test3 = function( a, b ) { + assert.equal( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); + }; jQuery.proxy( test3, null, "pre-applied" )( "normal" ); // Test old syntax - test4 = { "meth": function( a ) { equal( a, "boom", "Ensure old syntax works." ); } }; + test4 = { "meth": function( a ) { + assert.equal( a, "boom", "Ensure old syntax works." ); + } }; jQuery.proxy( test4, "meth" )( "boom" ); // jQuery 1.9 improved currying with `this` object @@ -1386,7 +1394,7 @@ QUnit.test( "jQuery.parseHTML", function( assert ) { if ( jQuery.support.createHTMLDocument ) { QUnit.asyncTest( "jQuery.parseHTML", function( assert ) { - expect ( 1 ); + assert.expect ( 1 ); Globals.register( "parseHTMLError" ); diff --git a/test/unit/css.js b/test/unit/css.js index f91c50940..75d1db84e 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -899,7 +899,7 @@ testIframeWithCallback( } )(); QUnit.test( "certain css values of 'normal' should be convertable to a number, see #8627", function( assert ) { - expect ( 3 ); + assert.expect( 3 ); var el = jQuery( "
test
" ).appendTo( "#qunit-fixture" ); @@ -1013,9 +1013,9 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) { $table.css( "display", "none" ).html( "cellcell" ); assert.equal( jQuery( "#table td:visible" ).length, 0, "hidden cell children not perceived as visible (#4512)" ); - t( "Is Visible", "#qunit-fixture div:visible:lt(2)", [ "foo", "nothiddendiv" ] ); - t( "Is Not Hidden", "#qunit-fixture:hidden", [] ); - t( "Is Hidden", "#form input:hidden", [ "hidden1","hidden2" ] ); + assert.t( "Is Visible", "#qunit-fixture div:visible:lt(2)", [ "foo", "nothiddendiv" ] ); + assert.t( "Is Not Hidden", "#qunit-fixture:hidden", [] ); + assert.t( "Is Hidden", "#form input:hidden", [ "hidden1","hidden2" ] ); $a = jQuery( "

Header

" ).appendTo( "#qunit-fixture" ); assert.ok( $a.is( ":visible" ), "Anchor tag with flow content is visible (gh-2227)" ); @@ -1041,87 +1041,92 @@ QUnit.test( "Reset the style if set to an empty string", function( assert ) { "The style can be reset by setting to an empty string" ); } ); -QUnit.asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function( assert ) { - var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ), - styles = [ { - name: "backgroundAttachment", - value: [ "fixed" ], - expected: [ "scroll" ] - },{ - name: "backgroundColor", - value: [ "rgb(255, 0, 0)", "rgb(255,0,0)", "#ff0000" ], - expected: [ "transparent" ] - }, { - - // Firefox returns auto's value - name: "backgroundImage", - value: [ "url('test.png')", "url(" + baseUrl + "test.png)", "url(\"" + baseUrl + "test.png\")" ], - expected: [ "none", "url(\"http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif\")" ] - }, { - name: "backgroundPosition", - value: [ "5% 5%" ], - expected: [ "0% 0%", "-1000px 0px", "-1000px 0%" ] - }, { - - // Firefox returns no-repeat - name: "backgroundRepeat", - value: [ "repeat-y" ], - expected: [ "repeat", "no-repeat" ] - }, { - name: "backgroundClip", - value: [ "padding-box" ], - expected: [ "border-box" ] - }, { - name: "backgroundOrigin", - value: [ "content-box" ], - expected: [ "padding-box" ] - }, { - name: "backgroundSize", - value: [ "80px 60px" ], - expected: [ "auto auto" ] - } ]; - - jQuery.each( styles, function( index, style ) { - var $clone, $clonedChildren, - $source = jQuery( "#firstp" ), - source = $source[ 0 ], - $children = $source.children(); - - style.expected = style.expected.concat( [ "", "auto" ] ); - - if ( source.style[ style.name ] === undefined ) { - assert.ok( true, style.name + ": style isn't supported and therefore not an issue" ); - assert.ok( true ); - - return true; - } +QUnit.test( + "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", + 24, + function( assert ) { + var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ); + var done = assert.async(); + var styles = [ { + name: "backgroundAttachment", + value: [ "fixed" ], + expected: [ "scroll" ] + },{ + name: "backgroundColor", + value: [ "rgb(255, 0, 0)", "rgb(255,0,0)", "#ff0000" ], + expected: [ "transparent" ] + }, { + + // Firefox returns auto's value + name: "backgroundImage", + value: [ "url('test.png')", "url(" + baseUrl + "test.png)", "url(\"" + baseUrl + "test.png\")" ], + expected: [ "none", "url(\"http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif\")" ] + }, { + name: "backgroundPosition", + value: [ "5% 5%" ], + expected: [ "0% 0%", "-1000px 0px", "-1000px 0%" ] + }, { + + // Firefox returns no-repeat + name: "backgroundRepeat", + value: [ "repeat-y" ], + expected: [ "repeat", "no-repeat" ] + }, { + name: "backgroundClip", + value: [ "padding-box" ], + expected: [ "border-box" ] + }, { + name: "backgroundOrigin", + value: [ "content-box" ], + expected: [ "padding-box" ] + }, { + name: "backgroundSize", + value: [ "80px 60px" ], + expected: [ "auto auto" ] + } ]; + + jQuery.each( styles, function( index, style ) { + var $clone, $clonedChildren, + $source = jQuery( "#firstp" ), + source = $source[ 0 ], + $children = $source.children(); + + style.expected = style.expected.concat( [ "", "auto" ] ); + + if ( source.style[ style.name ] === undefined ) { + assert.ok( true, style.name + ": style isn't supported and therefore not an issue" ); + assert.ok( true ); + + return true; + } - $source.css( style.name, style.value[ 0 ] ); - $children.css( style.name, style.value[ 0 ] ); + $source.css( style.name, style.value[ 0 ] ); + $children.css( style.name, style.value[ 0 ] ); - $clone = $source.clone(); - $clonedChildren = $clone.children(); + $clone = $source.clone(); + $clonedChildren = $clone.children(); - $clone.css( style.name, "" ); - $clonedChildren.css( style.name, "" ); + $clone.css( style.name, "" ); + $clonedChildren.css( style.name, "" ); - window.setTimeout( function() { - assert.notEqual( $clone.css( style.name ), style.value[ 0 ], "Cloned css was changed" ); + window.setTimeout( function() { + assert.notEqual( $clone.css( style.name ), style.value[ 0 ], "Cloned css was changed" ); - assert.ok( jQuery.inArray( $source.css( style.name ) !== -1, style.value ), - "Clearing clone.css() doesn't affect source.css(): " + style.name + - "; result: " + $source.css( style.name ) + - "; expected: " + style.value.join( "," ) ); + assert.ok( jQuery.inArray( $source.css( style.name ) !== -1, style.value ), + "Clearing clone.css() doesn't affect source.css(): " + style.name + + "; result: " + $source.css( style.name ) + + "; expected: " + style.value.join( "," ) ); - assert.ok( jQuery.inArray( $children.css( style.name ) !== -1, style.value ), - "Clearing clonedChildren.css() doesn't affect children.css(): " + style.name + - "; result: " + $children.css( style.name ) + - "; expected: " + style.value.join( "," ) ); - }, 100 ); - } ); + assert.ok( jQuery.inArray( $children.css( style.name ) !== -1, style.value ), + "Clearing clonedChildren.css() doesn't affect children.css(): " + style.name + + "; result: " + $children.css( style.name ) + + "; expected: " + style.value.join( "," ) ); + }, 100 ); + } ); - window.setTimeout( start, 1000 ); -} ); + window.setTimeout( done, 1000 ); + } +); QUnit.test( "show() after hide() should always set display to initial value (#14750)", function( assert ) { assert.expect( 1 ); diff --git a/test/unit/data.js b/test/unit/data.js index fc6b5723f..e105be252 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -136,7 +136,7 @@ QUnit.test( "jQuery.data(div)", function( assert ) { // We stored one key in the private data // assert that nothing else was put in there, and that that // one stayed there. - QUnit.expectJqData( this, div, "foo" ); + assert.expectJqData( this, div, "foo" ); } ); QUnit.test( "jQuery.data({})", function( assert ) { @@ -160,7 +160,7 @@ QUnit.test( "jQuery.data(document)", function( assert ) { dataTests( document, assert ); - QUnit.expectJqData( this, document, "foo" ); + assert.expectJqData( this, document, "foo" ); } ); QUnit.test( "jQuery.data()", function( assert ) { diff --git a/test/unit/deferred.js b/test/unit/deferred.js index 33b5b4f16..2277df190 100644 --- a/test/unit/deferred.js +++ b/test/unit/deferred.js @@ -505,12 +505,14 @@ QUnit.test( "[PIPE ONLY] jQuery.Deferred.pipe - context", function( assert ) { } ); } ); -QUnit.asyncTest( "jQuery.Deferred.then - spec compatibility", function( assert ) { +QUnit.test( "jQuery.Deferred.then - spec compatibility", function( assert ) { assert.expect( 1 ); + var done = assert.async(); + var defer = jQuery.Deferred().done( function() { - setTimeout( start ); + setTimeout( done ); throw new Error(); } ); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index c2f08a0bd..91bcf8ca6 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -57,7 +57,7 @@ function testWidth( val, assert ) { assert.equal( jQuery( window ).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." ); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } QUnit.test( "width()", function( assert ) { @@ -110,7 +110,7 @@ function testHeight( val, assert ) { assert.equal( jQuery( window ).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." ); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } QUnit.test( "height()", function( assert ) { @@ -165,7 +165,7 @@ QUnit.test( "innerWidth()", function( assert ) { assert.equal( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } ); QUnit.test( "innerHeight()", function( assert ) { @@ -200,7 +200,7 @@ QUnit.test( "innerHeight()", function( assert ) { assert.equal( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } ); QUnit.test( "outerWidth()", function( assert ) { @@ -239,7 +239,7 @@ QUnit.test( "outerWidth()", function( assert ) { assert.equal( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } ); QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function( assert ) { @@ -395,7 +395,7 @@ QUnit.test( "outerHeight()", function( assert ) { assert.equal( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - QUnit.expectJqData( this, $div[ 0 ], "olddisplay" ); + assert.expectJqData( this, $div[ 0 ], "olddisplay" ); } ); QUnit.test( "passing undefined is a setter #5571", function( assert ) { diff --git a/test/unit/effects.js b/test/unit/effects.js index 4d51adbc9..9c1920566 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -89,7 +89,7 @@ QUnit.test( "show()", function( assert ) { } ); // Tolerate data from show()/hide() - QUnit.expectJqData( this, div, "olddisplay" ); + assert.expectJqData( this, div, "olddisplay" ); jQuery( "
" + @@ -222,7 +222,7 @@ QUnit.test( "Persist correct display value", function( assert ) { clock.tick( 300 ); - QUnit.expectJqData( this, $span, "olddisplay" ); + assert.expectJqData( this, $span, "olddisplay" ); } ); QUnit.test( "animate(Hash, Object, Function)", function( assert ) { @@ -1123,7 +1123,7 @@ QUnit.test( "interrupt toggle", function( assert ) { jQuery.data( this, "startVal", jQuery( this ).css( prop ) ); // Expect olddisplay data from our .hide() call below - QUnit.expectJqData( env, this, "olddisplay" ); + assert.expectJqData( env, this, "olddisplay" ); } ); // Interrupt a hiding toggle @@ -1576,7 +1576,7 @@ QUnit.test( "animate should set display for disconnected nodes", function( asser assert.strictEqual( $divInline.show()[ 0 ].style.display, "inline", "show() should not change display if it already set" ); - QUnit.expectJqData( env, $divNone[ 0 ], "olddisplay" ); + assert.expectJqData( env, $divNone[ 0 ], "olddisplay" ); jQuery.each( methods, function( name, opt ) { jQuery.fn[ name ].apply( jQuery( "
" ), opt.concat( [ function() { diff --git a/test/unit/event.js b/test/unit/event.js index 6f4e6824e..4c7660e4a 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -235,7 +235,7 @@ QUnit.test( "on(), namespace with special add", function( assert ) { QUnit.test( "on(), no data", function( assert ) { assert.expect( 1 ); var handler = function( event ) { - ok ( !event.data, "Check that no data is added to the event object" ); + assert.ok( !event.data, "Check that no data is added to the event object" ); }; jQuery( "#firstp" ).on( "click", handler ).trigger( "click" ); } ); @@ -1608,17 +1608,23 @@ QUnit.test( ".on()/.off()", function( assert ) { assert.equal( clicked, 2, "off with a context" ); // Test binding with event data - jQuery( "#body" ).on( "click", "#foo", true, function( e ) { equal( e.data, true, "on with event data" ); } ); + jQuery( "#body" ).on( "click", "#foo", true, function( e ) { + assert.equal( e.data, true, "on with event data" ); + } ); jQuery( "#foo" ).trigger( "click" ); jQuery( "#body" ).off( "click", "#foo" ); // Test binding with trigger data - jQuery( "#body" ).on( "click", "#foo", function( e, data ) { equal( data, true, "on with trigger data" ); } ); + jQuery( "#body" ).on( "click", "#foo", function( e, data ) { + assert.equal( data, true, "on with trigger data" ); + } ); jQuery( "#foo" ).trigger( "click", true ); jQuery( "#body" ).off( "click", "#foo" ); // Test binding with different this object - jQuery( "#body" ).on( "click", "#foo", jQuery.proxy( function() { equal( this[ "foo" ], "bar", "on with event scope" ); }, { "foo": "bar" } ) ); + jQuery( "#body" ).on( "click", "#foo", jQuery.proxy( function() { + assert.equal( this[ "foo" ], "bar", "on with event scope" ); }, { "foo": "bar" } + ) ); jQuery( "#foo" ).trigger( "click" ); jQuery( "#body" ).off( "click", "#foo" ); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 2daa78fc4..d9f1b0247 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -242,7 +242,7 @@ function testAppend( valueObj, assert ) { } jQuery( "
" ).appendTo( "#form" ).append( valueObj( "test" ) ); - t( "Append legend", "#legend", [ "legend" ] ); + assert.t( "Append legend", "#legend", [ "legend" ] ); $map = jQuery( "" ).append( valueObj( "jQuery" ) ); @@ -270,7 +270,7 @@ function testAppend( valueObj, assert ) { jQuery( "#form" ) .append( valueObj( "" ) ) .append( valueObj( "" ) ); - t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] ); + assert.t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] ); assert.equal( "Two nodes", jQuery( "
" ).append( "Two", " nodes" ).text(), "Appending two text nodes (#4011)" ); assert.equal( jQuery( "
" ).append( "1", "", 3 ).text(), "13", "If median is false-like value, subsequent arguments should not be ignored" ); @@ -607,7 +607,7 @@ QUnit.test( "appendTo(jQuery)", function( assert ) { assert.equal( jQuery( "#sap" ).text(), expected, "Check for appending of jQuery object" ); jQuery( "#select1" ).appendTo( "#foo" ); - t( "Append select", "#foo select", [ "select1" ] ); + assert.t( "Append select", "#foo select", [ "select1" ] ); div = jQuery( "
" ).on( "click", function() { assert.ok( true, "Running a cloned click." ); @@ -814,7 +814,7 @@ QUnit.test( "prependTo(Array)", function( assert ) { jQuery( "" ).prependTo( "#form" ); jQuery( "" ).prependTo( "#form" ); - t( "Prepend Select", "#prependSelect2, #prependSelect1", [ "prependSelect2", "prependSelect1" ] ); + assert.t( "Prepend Select", "#prependSelect2, #prependSelect1", [ "prependSelect2", "prependSelect1" ] ); } ); QUnit.test( "before(String)", function( assert ) { diff --git a/test/unit/selector.js b/test/unit/selector.js index 8d18506fe..31ce852a6 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -26,41 +26,41 @@ QUnit.test( "id", function( assert ) { var a; - t( "ID Selector", "#body", [ "body" ] ); - t( "ID Selector w/ Element", "body#body", [ "body" ] ); - t( "ID Selector w/ Element", "ul#first", [] ); - t( "ID selector with existing ID descendant", "#firstp #simon1", [ "simon1" ] ); - t( "ID selector with non-existent descendant", "#firstp #foobar", [] ); - t( "ID selector using UTF8", "#台北Táiběi", [ "台北Táiběi" ] ); - t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", [ "台北Táiběi","台北" ] ); - t( "Descendant ID selector using UTF8", "div #台北", [ "台北" ] ); - t( "Child ID selector using UTF8", "form > #台北", [ "台北" ] ); - - t( "Escaped ID", "#foo\\:bar", [ "foo:bar" ] ); - t( "Escaped ID", "#test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); - t( "Descendant escaped ID", "div #foo\\:bar", [ "foo:bar" ] ); - t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); - t( "Child escaped ID", "form > #foo\\:bar", [ "foo:bar" ] ); - t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); - - t( "ID Selector, child ID present", "#form > #radio1", [ "radio1" ] ); // bug #267 - t( "ID Selector, not an ancestor ID", "#form #first", [] ); - t( "ID Selector, not a child ID", "#form > #option1a", [] ); - - t( "All Children of ID", "#foo > *", [ "sndp", "en", "sap" ] ); - t( "All Children of ID with no children", "#firstUL > *", [] ); + assert.t( "ID Selector", "#body", [ "body" ] ); + assert.t( "ID Selector w/ Element", "body#body", [ "body" ] ); + assert.t( "ID Selector w/ Element", "ul#first", [] ); + assert.t( "ID selector with existing ID descendant", "#firstp #simon1", [ "simon1" ] ); + assert.t( "ID selector with non-existent descendant", "#firstp #foobar", [] ); + assert.t( "ID selector using UTF8", "#台北Táiběi", [ "台北Táiběi" ] ); + assert.t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", [ "台北Táiběi","台北" ] ); + assert.t( "Descendant ID selector using UTF8", "div #台北", [ "台北" ] ); + assert.t( "Child ID selector using UTF8", "form > #台北", [ "台北" ] ); + + assert.t( "Escaped ID", "#foo\\:bar", [ "foo:bar" ] ); + assert.t( "Escaped ID", "#test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); + assert.t( "Descendant escaped ID", "div #foo\\:bar", [ "foo:bar" ] ); + assert.t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); + assert.t( "Child escaped ID", "form > #foo\\:bar", [ "foo:bar" ] ); + assert.t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", [ "test.foo[5]bar" ] ); + + assert.t( "ID Selector, child ID present", "#form > #radio1", [ "radio1" ] ); // bug #267 + assert.t( "ID Selector, not an ancestor ID", "#form #first", [] ); + assert.t( "ID Selector, not a child ID", "#form > #option1a", [] ); + + assert.t( "All Children of ID", "#foo > *", [ "sndp", "en", "sap" ] ); + assert.t( "All Children of ID with no children", "#firstUL > *", [] ); a = jQuery( "" ).appendTo( "#qunit-fixture" ); - t( "ID Selector contains backslash", "#backslash\\\\foo", [ "backslash\\foo" ] ); + assert.t( "ID Selector contains backslash", "#backslash\\\\foo", [ "backslash\\foo" ] ); - t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", [ "lengthtest" ] ); + assert.t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", [ "lengthtest" ] ); - t( "ID selector with non-existent ancestor", "#asdfasdf #foobar", [] ); // bug #986 + assert.t( "ID selector with non-existent ancestor", "#asdfasdf #foobar", [] ); // bug #986 - t( "Underscore ID", "#types_all", [ "types_all" ] ); - t( "Dash ID", "#qunit-fixture", [ "qunit-fixture" ] ); + assert.t( "Underscore ID", "#types_all", [ "types_all" ] ); + assert.t( "Dash ID", "#qunit-fixture", [ "qunit-fixture" ] ); - t( "ID with weird characters in it", "#name\\+value", [ "name+value" ] ); + assert.t( "ID with weird characters in it", "#name\\+value", [ "name+value" ] ); } ); QUnit.test( "class - jQuery only", function( assert ) { @@ -77,11 +77,11 @@ QUnit.test( "name", function( assert ) { var form; - t( "Name selector", "input[name=action]", [ "text1" ] ); - t( "Name selector with single quotes", "input[name='action']", [ "text1" ] ); - t( "Name selector with double quotes", "input[name=\"action\"]", [ "text1" ] ); + assert.t( "Name selector", "input[name=action]", [ "text1" ] ); + assert.t( "Name selector with single quotes", "input[name='action']", [ "text1" ] ); + assert.t( "Name selector with double quotes", "input[name=\"action\"]", [ "text1" ] ); - t( "Name selector for grouped input", "input[name='types[]']", [ "types_all", "types_anime", "types_movie" ] ); + assert.t( "Name selector for grouped input", "input[name='types[]']", [ "types_all", "types_anime", "types_movie" ] ); form = jQuery( "
" ).appendTo( "body" ); assert.equal( jQuery( "input", form[ 0 ] ).length, 1, "Make sure that rooted queries on forms (with possible expandos) work." ); @@ -105,40 +105,40 @@ QUnit.test( "child and adjacent", function( assert ) { var nothiddendiv; - t( "Child", "p > a", [ "simon1","google","groups","mark","yahoo","simon" ] ); - t( "Child", "p> a", [ "simon1","google","groups","mark","yahoo","simon" ] ); - t( "Child", "p >a", [ "simon1","google","groups","mark","yahoo","simon" ] ); - t( "Child", "p>a", [ "simon1","google","groups","mark","yahoo","simon" ] ); - t( "Child w/ Class", "p > a.blog", [ "mark","simon" ] ); - t( "All Children", "code > *", [ "anchor1","anchor2" ] ); - t( "All Grandchildren", "p > * > *", [ "anchor1","anchor2" ] ); - t( "Adjacent", "p + p", [ "ap","en","sap" ] ); - t( "Adjacent", "p#firstp + p", [ "ap" ] ); - t( "Adjacent", "p[lang=en] + p", [ "sap" ] ); - t( "Adjacent", "a.GROUPS + code + a", [ "mark" ] ); - t( "Element Preceded By", "#groups ~ a", [ "mark" ] ); - t( "Element Preceded By", "#length ~ input", [ "idTest" ] ); - t( "Element Preceded By", "#siblingfirst ~ em", [ "siblingnext", "siblingthird" ] ); - t( "Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", [ "siblingspan" ] ); - t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", [ "siblingfirst" ] ); - - t( "Multiple combinators selects all levels", "#siblingTest em *", [ "siblingchild", "siblinggrandchild", "siblinggreatgrandchild" ] ); - t( "Multiple combinators selects all levels", "#siblingTest > em *", [ "siblingchild", "siblinggrandchild", "siblinggreatgrandchild" ] ); - t( "Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", [ "siblingspan" ] ); - t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] ); + assert.t( "Child", "p > a", [ "simon1","google","groups","mark","yahoo","simon" ] ); + assert.t( "Child", "p> a", [ "simon1","google","groups","mark","yahoo","simon" ] ); + assert.t( "Child", "p >a", [ "simon1","google","groups","mark","yahoo","simon" ] ); + assert.t( "Child", "p>a", [ "simon1","google","groups","mark","yahoo","simon" ] ); + assert.t( "Child w/ Class", "p > a.blog", [ "mark","simon" ] ); + assert.t( "All Children", "code > *", [ "anchor1","anchor2" ] ); + assert.t( "All Grandchildren", "p > * > *", [ "anchor1","anchor2" ] ); + assert.t( "Adjacent", "p + p", [ "ap","en","sap" ] ); + assert.t( "Adjacent", "p#firstp + p", [ "ap" ] ); + assert.t( "Adjacent", "p[lang=en] + p", [ "sap" ] ); + assert.t( "Adjacent", "a.GROUPS + code + a", [ "mark" ] ); + assert.t( "Element Preceded By", "#groups ~ a", [ "mark" ] ); + assert.t( "Element Preceded By", "#length ~ input", [ "idTest" ] ); + assert.t( "Element Preceded By", "#siblingfirst ~ em", [ "siblingnext", "siblingthird" ] ); + assert.t( "Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", [ "siblingspan" ] ); + assert.t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", [ "siblingfirst" ] ); + + assert.t( "Multiple combinators selects all levels", "#siblingTest em *", [ "siblingchild", "siblinggrandchild", "siblinggreatgrandchild" ] ); + assert.t( "Multiple combinators selects all levels", "#siblingTest > em *", [ "siblingchild", "siblinggrandchild", "siblinggreatgrandchild" ] ); + assert.t( "Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", [ "siblingspan" ] ); + assert.t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] ); assert.equal( jQuery( "#listWithTabIndex" ).length, 1, "Parent div for next test is found via ID (#8310)" ); assert.equal( jQuery( "#listWithTabIndex li:eq(2) ~ li" ).length, 1, "Find by general sibling combinator (#8310)" ); assert.equal( jQuery( "#__sizzle__" ).length, 0, "Make sure the temporary id assigned by sizzle is cleared out (#8310)" ); assert.equal( jQuery( "#listWithTabIndex" ).length, 1, "Parent div for previous test is still found via ID (#8310)" ); - t( "Verify deep class selector", "div.blah > p > a", [] ); + assert.t( "Verify deep class selector", "div.blah > p > a", [] ); - t( "No element deep selector", "div.foo > span > a", [] ); + assert.t( "No element deep selector", "div.foo > span > a", [] ); nothiddendiv = document.getElementById( "nothiddendiv" ); - t( "Non-existent ancestors", ".fototab > .thumbnails > a", [] ); + assert.t( "Non-existent ancestors", ".fototab > .thumbnails > a", [] ); } ); QUnit.test( "attributes", function( assert ) { @@ -146,60 +146,60 @@ QUnit.test( "attributes", function( assert ) { var attrbad, div, withScript; - t( "Find elements with a tabindex attribute", "[tabindex]", [ "listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex" ] ); + assert.t( "Find elements with a tabindex attribute", "[tabindex]", [ "listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex" ] ); - t( "Attribute Exists", "#qunit-fixture a[title]", [ "google" ] ); - t( "Attribute Exists (case-insensitive)", "#qunit-fixture a[TITLE]", [ "google" ] ); - t( "Attribute Exists", "#qunit-fixture *[title]", [ "google" ] ); - t( "Attribute Exists", "#qunit-fixture [title]", [ "google" ] ); - t( "Attribute Exists", "#qunit-fixture a[ title ]", [ "google" ] ); + assert.t( "Attribute Exists", "#qunit-fixture a[title]", [ "google" ] ); + assert.t( "Attribute Exists (case-insensitive)", "#qunit-fixture a[TITLE]", [ "google" ] ); + assert.t( "Attribute Exists", "#qunit-fixture *[title]", [ "google" ] ); + assert.t( "Attribute Exists", "#qunit-fixture [title]", [ "google" ] ); + assert.t( "Attribute Exists", "#qunit-fixture a[ title ]", [ "google" ] ); - t( "Boolean attribute exists", "#select2 option[selected]", [ "option2d" ] ); - t( "Boolean attribute equals", "#select2 option[selected='selected']", [ "option2d" ] ); + assert.t( "Boolean attribute exists", "#select2 option[selected]", [ "option2d" ] ); + assert.t( "Boolean attribute equals", "#select2 option[selected='selected']", [ "option2d" ] ); - t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", [ "simon1" ] ); - t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", [ "simon1" ] ); - t( "Attribute Equals", "#qunit-fixture a[rel=bookmark]", [ "simon1" ] ); - t( "Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", [ "google" ] ); - t( "Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", [ "simon1" ] ); - t( "Attribute Equals Number", "#qunit-fixture option[value=1]", [ "option1b","option2b","option3b","option4b","option5c" ] ); - t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", [ "foodWithNegativeTabIndex" ] ); + assert.t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", [ "simon1" ] ); + assert.t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", [ "simon1" ] ); + assert.t( "Attribute Equals", "#qunit-fixture a[rel=bookmark]", [ "simon1" ] ); + assert.t( "Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", [ "google" ] ); + assert.t( "Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", [ "simon1" ] ); + assert.t( "Attribute Equals Number", "#qunit-fixture option[value=1]", [ "option1b","option2b","option3b","option4b","option5c" ] ); + assert.t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", [ "foodWithNegativeTabIndex" ] ); document.getElementById( "anchor2" ).href = "#2"; - t( "href Attribute", "p a[href^='#']", [ "anchor2" ] ); - t( "href Attribute", "p a[href*='#']", [ "simon1", "anchor2" ] ); + assert.t( "href Attribute", "p a[href^='#']", [ "anchor2" ] ); + assert.t( "href Attribute", "p a[href*='#']", [ "simon1", "anchor2" ] ); - t( "for Attribute", "form label[for]", [ "label-for" ] ); - t( "for Attribute in form", "#form [for=action]", [ "label-for" ] ); + assert.t( "for Attribute", "form label[for]", [ "label-for" ] ); + assert.t( "for Attribute in form", "#form [for=action]", [ "label-for" ] ); - t( "Attribute containing []", "input[name^='foo[']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name^='foo[bar]']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name*='[bar]']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name$='bar]']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name$='[bar]']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name$='foo[bar]']", [ "hidden2" ] ); - t( "Attribute containing []", "input[name*='foo[bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name^='foo[']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name^='foo[bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name*='[bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name$='bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name$='[bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name$='foo[bar]']", [ "hidden2" ] ); + assert.t( "Attribute containing []", "input[name*='foo[bar]']", [ "hidden2" ] ); - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", [ "radio1", "radio2", "hidden1" ] ); - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", [ "radio1", "radio2", "hidden1" ] ); - t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", [ "radio1", "radio2", "hidden1" ] ); + assert.t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", [ "radio1", "radio2", "hidden1" ] ); + assert.t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", [ "radio1", "radio2", "hidden1" ] ); + assert.t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", [ "radio1", "radio2", "hidden1" ] ); - t( "Attribute selector using UTF8", "span[lang=中文]", [ "台北" ] ); + assert.t( "Attribute selector using UTF8", "span[lang=中文]", [ "台北" ] ); - t( "Attribute Begins With", "a[href ^= 'http://www']", [ "google","yahoo" ] ); - t( "Attribute Ends With", "a[href $= 'org/']", [ "mark" ] ); - t( "Attribute Contains", "a[href *= 'google']", [ "google","groups" ] ); - t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", [ "google","groups","anchor1" ] ); + assert.t( "Attribute Begins With", "a[href ^= 'http://www']", [ "google","yahoo" ] ); + assert.t( "Attribute Ends With", "a[href $= 'org/']", [ "mark" ] ); + assert.t( "Attribute Contains", "a[href *= 'google']", [ "google","groups" ] ); + assert.t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", [ "google","groups","anchor1" ] ); - t( "Empty values", "#select1 option[value='']", [ "option1a" ] ); - t( "Empty values", "#select1 option[value!='']", [ "option1b","option1c","option1d" ] ); + assert.t( "Empty values", "#select1 option[value='']", [ "option1a" ] ); + assert.t( "Empty values", "#select1 option[value!='']", [ "option1b","option1c","option1d" ] ); - t( "Select options via :selected", "#select1 option:selected", [ "option1a" ] ); - t( "Select options via :selected", "#select2 option:selected", [ "option2d" ] ); - t( "Select options via :selected", "#select3 option:selected", [ "option3b", "option3c" ] ); - t( "Select options via :selected", "select[name='select2'] option:selected", [ "option2d" ] ); + assert.t( "Select options via :selected", "#select1 option:selected", [ "option1a" ] ); + assert.t( "Select options via :selected", "#select2 option:selected", [ "option2d" ] ); + assert.t( "Select options via :selected", "#select3 option:selected", [ "option3b", "option3c" ] ); + assert.t( "Select options via :selected", "select[name='select2'] option:selected", [ "option2d" ] ); - t( "Grouped Form Elements", "input[name='foo[bar]']", [ "hidden2" ] ); + assert.t( "Grouped Form Elements", "input[name='foo[bar]']", [ "hidden2" ] ); // Make sure attribute value quoting works correctly. See jQuery #6093; #6428; #13894 // Use seeded results to bypass querySelectorAll optimizations @@ -215,23 +215,23 @@ QUnit.test( "attributes", function( assert ) { "" ).appendTo( "#qunit-fixture" ).get(); - t( "Underscores don't need escaping", "input[id=types_all]", [ "types_all" ] ); + assert.t( "Underscores don't need escaping", "input[id=types_all]", [ "types_all" ] ); - t( "input[type=text]", "#form input[type=text]", [ "text1", "text2", "hidden2", "name" ] ); - t( "input[type=search]", "#form input[type=search]", [ "search" ] ); + assert.t( "input[type=text]", "#form input[type=text]", [ "text1", "text2", "hidden2", "name" ] ); + assert.t( "input[type=search]", "#form input[type=search]", [ "search" ] ); withScript = supportjQuery( "