aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-09-08 03:26:29 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-09-08 04:15:54 +0300
commit2f0cedc9972efa4bf9eb656001a098d9c51e53ec (patch)
tree33d44ac9d4a8ea0e441663c6f070593f615ce2b1 /test/unit
parentf71e32d4b46f3be293304d40ed6dc85cf30d6a7b (diff)
downloadjquery-2f0cedc9972efa4bf9eb656001a098d9c51e53ec.tar.gz
jquery-2f0cedc9972efa4bf9eb656001a098d9c51e53ec.zip
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 Ref c8d15a2f9f108e90d3651c31e4abf45415a30fde
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/ajax.js74
-rw-r--r--test/unit/attributes.js4
-rw-r--r--test/unit/core.js20
-rw-r--r--test/unit/css.js161
-rw-r--r--test/unit/data.js4
-rw-r--r--test/unit/deferred.js6
-rw-r--r--test/unit/dimensions.js12
-rw-r--r--test/unit/effects.js6
-rw-r--r--test/unit/event.js14
-rw-r--r--test/unit/manipulation.js8
-rw-r--r--test/unit/selector.js212
-rw-r--r--test/unit/support.js6
-rw-r--r--test/unit/traversing.js2
13 files changed, 282 insertions, 247 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 541bdff5c..edeed18fc 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 59362f397..f8ded417a 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -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" );
diff --git a/test/unit/core.js b/test/unit/core.js
index 805ae4eaa..de0fc0bcd 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++;
@@ -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" );
diff --git a/test/unit/css.js b/test/unit/css.js
index dd532f1a7..6b031f61f 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -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 );
diff --git a/test/unit/data.js b/test/unit/data.js
index adade2a5f..5a232c401 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -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 ) {
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 0b49b5c68..ef93aa7a3 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 ], "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 ) {
diff --git a/test/unit/effects.js b/test/unit/effects.js
index b31617bb9..f290eec63 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -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
diff --git a/test/unit/event.js b/test/unit/event.js
index d31795632..cb4fb629b 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" );
} );
@@ -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" );
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index f3a3e5415..dad61a476 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -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 ) {
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 1c15a3df8..ade5d24df 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-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(
diff --git a/test/unit/support.js b/test/unit/support.js
index 6d97fa6f8..b5c1594c0 100644
--- a/test/unit/support.js
+++ b/test/unit/support.js
@@ -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 );
} );
}
);
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 5d30f85b1..f18bb1fe1 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -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();