]> source.dussan.org Git - jquery.git/commitdiff
Tests: further improvements QUnit 2.0 migration
authorOleg Gaidarenko <markelog@gmail.com>
Tue, 8 Sep 2015 00:26:29 +0000 (03:26 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 8 Sep 2015 01:15:54 +0000 (04:15 +0300)
* Remove QUnit jshint globals
* Extend QUnit.assert methods
* Use assert.async instead of start/stop/done

Ref b930d14ce64937e9478405eee2828d4da091d2cb
Ref c8d15a2f9f108e90d3651c31e4abf45415a30fde

16 files changed:
test/.jshintrc
test/data/testinit.js
test/data/testrunner.js
test/unit/ajax.js
test/unit/attributes.js
test/unit/core.js
test/unit/css.js
test/unit/data.js
test/unit/deferred.js
test/unit/dimensions.js
test/unit/effects.js
test/unit/event.js
test/unit/manipulation.js
test/unit/selector.js
test/unit/support.js
test/unit/traversing.js

index 272752e5388976b93473feabb3cf77ddfb55b2ff..a5b3c6feec5ddab9b99af769067b84342ce8b2e0 100644 (file)
                "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,
@@ -51,8 +40,6 @@
 
                "jQuery": true,
                "sinon": true,
-               "module": true,
-               "test": true,
                "amdDefined": true,
                "fireNative": true,
                "Globals": true,
index 491440e1990ce61e327edd986742071e065fd87d..341e3941316d6e3eee8f070eb7dbab49a6148601 100644 (file)
@@ -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();
                                } );
index c60b152b1017660727f4867756556ddd6f44b68d..0758219f02dbe04acf925c5e7b73eb36dd7e4fba 100644 (file)
@@ -43,7 +43,7 @@ function keys( o ) {
  * @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
@@ -83,7 +83,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, " +
@@ -111,7 +111,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;
@@ -123,7 +123,7 @@ window.moduleTeardown = function() {
                        expectedKeys = expectedDataKeys[ i ];
                        actualKeys = jQuery.cache[ i ] ? 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 ];
@@ -131,7 +131,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 + ")"
@@ -145,12 +145,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" );
                }
@@ -168,7 +168,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;
        }
 };
index 541bdff5c8e5a7e18811d2e6a426f1c6bd3e3ffb..edeed18fc4424c37f19f2e6f1499984ed896b7c9 100644 (file)
@@ -186,7 +186,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: {
@@ -1686,20 +1686,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()
 
@@ -1764,37 +1772,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 ) {
@@ -1809,23 +1823,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
index 59362f3975a8ea6867bf4e5d42b254c0b9b7fdb1..f8ded417a8d2d92ad3402a86f4493d80a60d0edc 100644 (file)
@@ -1266,7 +1266,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 ) {
@@ -1469,7 +1469,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( "<option></option>" ).val();
        assert.equal( val.length, 0, "Empty option should have no value" );
index 805ae4eaa1c9bc07aeef6fefc676ac8f9fa8ac94..de0fc0bcd46d6792f0370c04c3add02a9e9bd91b 100644 (file)
@@ -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++;
@@ -1285,7 +1285,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
@@ -1301,15 +1303,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
@@ -1365,7 +1373,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" );
 
index dd532f1a77cd22bb5cc343da7143a25474e6ca85..6b031f61f00a8dd6ef11667a200888a135e12be8 100644 (file)
@@ -959,7 +959,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( "<div style='letter-spacing:normal;font-weight:normal;'>test</div>" ).appendTo( "#qunit-fixture" );
 
@@ -1073,9 +1073,9 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) {
        $table.css( "display", "none" ).html( "<tr><td>cell</td><td>cell</td></tr>" );
        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( "<a href='#'><h1>Header</h1></a>" ).appendTo( "#qunit-fixture" );
        assert.ok( $a.is( ":visible" ), "Anchor tag with flow content is visible (gh-2227)" );
@@ -1101,87 +1101,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 );
-                       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 );
+                               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 );
index adade2a5f27fd68244d46ebfa8b1d5a4d0c48ac5..5a232c401d7cfb3770dae12adfd230853ea16048 100644 (file)
@@ -150,7 +150,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 ) {
@@ -175,7 +175,7 @@ QUnit.test( "jQuery.data(document)", function( assert ) {
 
        dataTests( document, assert );
 
-       QUnit.expectJqData( this, document, "foo" );
+       assert.expectJqData( this, document, "foo" );
 } );
 
 QUnit.test( "Expando cleanup", function( assert ) {
index 33b5b4f16325666b13f73eab5fb9f81463692c80..2277df1903188a458b780d351e1b3369e42deac0 100644 (file)
@@ -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();
        } );
 
index 0b49b5c68d3ba71904e58bbd4559e38e6bf48f75..ef93aa7a388a4da81f67614d329b6a85e8c1862c 100644 (file)
@@ -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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 }
 
 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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 }
 
 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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 } );
 
 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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 } );
 
 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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 } );
 
 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 ], "display" );
+       assert.expectJqData( this, $div[ 0 ], "display" );
 } );
 
 QUnit.test( "passing undefined is a setter #5571", function( assert ) {
index b31617bb917b8ed130cbbbb4d7db8a346f23379f..f290eec63750c9819d032cbaea366cb2861febf7 100644 (file)
@@ -91,7 +91,7 @@ QUnit.test( "show()", function( assert ) {
        } );
 
        // Tolerate data from show()/hide()
-       QUnit.expectJqData( this, div, "display" );
+       assert.expectJqData( this, div, "display" );
 
        jQuery(
                "<div id='show-tests'>" +
@@ -222,7 +222,7 @@ QUnit.test( "Persist correct display value", function( assert ) {
 
        clock.tick( 300 );
 
-       QUnit.expectJqData( this, $span, "display" );
+       assert.expectJqData( this, $span, "display" );
 } );
 
 QUnit.test( "animate(Hash, Object, Function)", function( assert ) {
@@ -1141,7 +1141,7 @@ QUnit.test( "interrupt toggle", function( assert ) {
                        jQuery.data( this, "startVal", jQuery( this ).css( prop ) );
 
                        // Expect display data from our .hide() call below
-                       QUnit.expectJqData( env, this, "display" );
+                       assert.expectJqData( env, this, "display" );
                } );
 
                // Interrupt a hiding toggle
index d3179563213d0b4bafa214a62f3b69b89d430834..cb4fb629b5eb4463108746c1352f85ab54457004 100644 (file)
@@ -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" );
 } );
@@ -1647,17 +1647,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" );
 
index f3a3e54151b790cdab82139381d957b250146d03..dad61a4769d5c686beb9bab46c0af237f75889d6 100644 (file)
@@ -245,7 +245,7 @@ function testAppend( valueObj, assert ) {
        }
 
        jQuery( "<fieldset/>" ).appendTo( "#form" ).append( valueObj( "<legend id='legend'>test</legend>" ) );
-       t( "Append legend", "#legend", [ "legend" ] );
+       assert.t( "Append legend", "#legend", [ "legend" ] );
 
        $map = jQuery( "<map/>" ).append( valueObj( "<area id='map01' shape='rect' coords='50,50,150,150' href='http://www.jquery.com/' alt='jQuery'>" ) );
 
@@ -273,7 +273,7 @@ function testAppend( valueObj, assert ) {
        jQuery( "#form" )
                .append( valueObj( "<select id='appendSelect1'></select>" ) )
                .append( valueObj( "<select id='appendSelect2'><option>Test</option></select>" ) );
-       t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] );
+       assert.t( "Append Select", "#appendSelect1, #appendSelect2", [ "appendSelect1", "appendSelect2" ] );
 
        assert.equal( "Two nodes", jQuery( "<div />" ).append( "Two", " nodes" ).text(), "Appending two text nodes (#4011)" );
        assert.equal( jQuery( "<div />" ).append( "1", "", 3 ).text(), "13", "If median is false-like value, subsequent arguments should not be ignored" );
@@ -658,7 +658,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( "<div/>" ).on( "click", function() {
                assert.ok( true, "Running a cloned click." );
@@ -865,7 +865,7 @@ QUnit.test( "prependTo(Array<jQuery>)", function( assert ) {
        jQuery( "<select id='prependSelect1'></select>" ).prependTo( "#form" );
        jQuery( "<select id='prependSelect2'><option>Test</option></select>" ).prependTo( "#form" );
 
-       t( "Prepend Select", "#prependSelect2, #prependSelect1", [ "prependSelect2", "prependSelect1" ] );
+       assert.t( "Prepend Select", "#prependSelect2, #prependSelect1", [ "prependSelect2", "prependSelect1" ] );
 } );
 
 QUnit.test( "before(String)", function( assert ) {
index 1c15a3df8dd8ae45558a1d8cc158cd273f785186..ade5d24df053c02c5eb3576bb35cd8a77876d114 100644 (file)
@@ -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-existant 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-existant 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( "<a id='backslash\\foo'></a>" ).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-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
+       assert.t( "ID selector with non-existant 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( "<form><input name='id'/></form>" ).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-existant ancestors", ".fototab > .thumbnails > a", [] );
+       assert.t( "Non-existant 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 ) {
                "<input type='hidden' id='attrbad_unicode' data-attr='&#x4e00;'/>"
        ).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( "<div><span><script src=''/></span></div>" );
        assert.ok( withScript.find( "#moretests script[src]" ).has( "script" ), "script[src] (jQuery #13777)" );
 
        div = document.getElementById( "foo" );
-       t( "Object.prototype property \"constructor\" (negative)", "[constructor]", [] );
-       t( "Gecko Object.prototype property \"watch\" (negative)", "[watch]", [] );
+       assert.t( "Object.prototype property \"constructor\" (negative)", "[constructor]", [] );
+       assert.t( "Gecko Object.prototype property \"watch\" (negative)", "[watch]", [] );
        div.setAttribute( "constructor", "foo" );
        div.setAttribute( "watch", "bar" );
-       t( "Object.prototype property \"constructor\"", "[constructor='foo']", [ "foo" ] );
-       t( "Gecko Object.prototype property \"watch\"", "[watch='bar']", [ "foo" ] );
+       assert.t( "Object.prototype property \"constructor\"", "[constructor='foo']", [ "foo" ] );
+       assert.t( "Gecko Object.prototype property \"watch\"", "[watch='bar']", [ "foo" ] );
 
-       t( "Value attribute is retrieved correctly", "input[value=Test]", [ "text1", "text2" ] );
+       assert.t( "Value attribute is retrieved correctly", "input[value=Test]", [ "text1", "text2" ] );
 
        // #12600
        assert.ok(
index 6d97fa6f8734141a565ab7a2cc688a84ea1487ea..b5c1594c0a6baa8082b07c419bb674e0b8353e8f 100644 (file)
@@ -60,14 +60,14 @@ testIframeWithCallback(
        "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
        "support/csp.php",
        function( support, assert ) {
+               var done = assert.async();
+
                assert.expect( 2 );
                assert.deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" );
 
-               QUnit.stop();
-
                supportjQuery.get( "data/support/csp.log" ).done( function( data ) {
                        assert.equal( data, "", "No log request should be sent" );
-                       supportjQuery.get( "data/support/csp-clean.php" ).done( start );
+                       supportjQuery.get( "data/support/csp-clean.php" ).done( done );
                } );
        }
 );
index 5d30f85b117423683c1baf8362fda863ebd65c10..f18bb1fe12373fe63570fcefefe296100eae1270 100644 (file)
@@ -859,7 +859,7 @@ QUnit.test( "index(no arg) #10977", function( assert ) {
 
        $list = jQuery( "<ul id='indextest'><li class='zero'>THIS ONE</li><li class='one'>a</li><li class='two'>b</li><li class='three'>c</li></ul>" );
        jQuery( "#qunit-fixture" ).append( $list );
-       strictEqual ( jQuery( "#indextest li.zero" ).first().index(), 0, "No Argument Index Check" );
+       assert.strictEqual( jQuery( "#indextest li.zero" ).first().index(), 0, "No Argument Index Check" );
        $list.remove();
 
        fragment = document.createDocumentFragment();