diff options
author | abnud1 <ahmad13932013@hotmail.com> | 2019-02-18 19:02:38 +0100 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-02-18 19:03:26 +0100 |
commit | c3498187421d0a50ee0369163428481137a04b99 (patch) | |
tree | 9f56f408a22f610089474d2f1784f1a680b4d483 /test/data | |
parent | da44ff39c2c3433e32b757b05b5643edb72fe786 (diff) | |
download | jquery-c3498187421d0a50ee0369163428481137a04b99.tar.gz jquery-c3498187421d0a50ee0369163428481137a04b99.zip |
Build: Update test code for compatibility with QUnit 2.x (#4297)
Also, run `grunt npmcopy` to sync the "external" directory with dependencies
from package.json. For example, the Sinon library version didn't match.
Ref gh-4234
Closes gh-4297
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/cleanScript.html | 4 | ||||
-rw-r--r-- | test/data/inner_module.js | 2 | ||||
-rw-r--r-- | test/data/mock.php | 6 | ||||
-rw-r--r-- | test/data/module.js | 2 | ||||
-rw-r--r-- | test/data/name.html | 2 | ||||
-rw-r--r-- | test/data/test.include.html | 2 | ||||
-rw-r--r-- | test/data/test2.html | 2 | ||||
-rw-r--r-- | test/data/testinit.js | 11 | ||||
-rw-r--r-- | test/data/testrunner.js | 3 |
9 files changed, 17 insertions, 17 deletions
diff --git a/test/data/cleanScript.html b/test/data/cleanScript.html index 69288a858..c37694aac 100644 --- a/test/data/cleanScript.html +++ b/test/data/cleanScript.html @@ -1,10 +1,10 @@ <script> <!-- -ok( true, "script within html comments executed" ); +QUnit.assert.ok( true, "script within html comments executed" ); --> </script> <script> <![CDATA[ -ok( true, "script within CDATA executed" ); +QUnit.assert.ok( true, "script within CDATA executed" ); ]]> </script> diff --git a/test/data/inner_module.js b/test/data/inner_module.js index 7f359ed95..b13315a24 100644 --- a/test/data/inner_module.js +++ b/test/data/inner_module.js @@ -1 +1 @@ -window.ok( true, "evaluated: inner module with src" ); +QUnit.assert.ok( true, "evaluated: inner module with src" ); diff --git a/test/data/mock.php b/test/data/mock.php index 52de8ae9d..ba1930415 100644 --- a/test/data/mock.php +++ b/test/data/mock.php @@ -16,7 +16,7 @@ class MockServer { header( 'Content-type: text/javascript' ); } else { header( 'Content-type: text/html' ); - echo 'ERROR <script>ok( true, "mock executed" );</script>'; + echo 'ERROR <script>QUnit.assert.ok( true, "mock executed" );</script>'; } } @@ -54,7 +54,7 @@ class MockServer { } else { header( 'Content-type: text/html' ); } - echo 'ok( true, "mock executed" );'; + echo 'QUnit.assert.ok( true, "mock executed" );'; } // Used to be in test.js, but was renamed to testbar.php @@ -62,7 +62,7 @@ class MockServer { protected function testbar( $req ) { echo 'this.testBar = "bar"; jQuery("#ap").html("bar"); -ok( true, "mock executed");'; +QUnit.assert.ok( true, "mock executed");'; } protected function json( $req ) { diff --git a/test/data/module.js b/test/data/module.js index b0a8a21fd..a3a8c7aec 100644 --- a/test/data/module.js +++ b/test/data/module.js @@ -1 +1 @@ -window.ok( true, "evaluated: module with src" ); +QUnit.assert.ok( true, "evaluated: module with src" ); diff --git a/test/data/name.html b/test/data/name.html index 0fa32d1a8..e360af9bf 100644 --- a/test/data/name.html +++ b/test/data/name.html @@ -1 +1 @@ -ERROR <script type="text/javascript">ok( true, "name.html retrieved" );</script> +ERROR <script type="text/javascript">QUnit.assert.ok( true, "name.html retrieved" );</script> diff --git a/test/data/test.include.html b/test/data/test.include.html index 73299db07..ea75074f9 100644 --- a/test/data/test.include.html +++ b/test/data/test.include.html @@ -1,7 +1,7 @@ html text<br/> <script type="text/javascript">/* <![CDATA[ */ testFoo = "foo"; jQuery('#foo').html('foo'); -ok( true, "test.include.html executed" ); +QUnit.assert.ok( true, "test.include.html executed" ); /* ]]> */</script> <script src="{{baseURL}}mock.php?action=testbar"></script> blabla diff --git a/test/data/test2.html b/test/data/test2.html index 1df6151a0..c7fff22fb 100644 --- a/test/data/test2.html +++ b/test/data/test2.html @@ -1,5 +1,5 @@ <script type="text/javascript"> var testFoo = "foo"; jQuery('#foo').html('foo'); -ok( true, "test2.html executed" ); +QUnit.assert.ok( true, "test2.html executed" ); </script> diff --git a/test/data/testinit.js b/test/data/testinit.js index a87ebf206..e1d81c5c7 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -48,7 +48,7 @@ this.q = function() { * @param {(String|Node)=document} context - Selector context * @example match("Check for something", "p", ["foo", "bar"]); */ -function match( message, selector, expectedIds, context ) { +function match( message, selector, expectedIds, context, assert ) { var f = jQuery( selector, context ).get(), s = "", i = 0; @@ -57,7 +57,7 @@ function match( message, selector, expectedIds, context ) { s += ( s && "," ) + "\"" + f[ i ].id + "\""; } - this.deepEqual( f, q.apply( q, expectedIds ), message + " (" + selector + ")" ); + assert.deepEqual( f, q.apply( q, expectedIds ), message + " (" + selector + ")" ); } /** @@ -69,7 +69,7 @@ function match( message, selector, expectedIds, context ) { * @example t("Check for something", "p", ["foo", "bar"]); */ QUnit.assert.t = function( message, selector, expectedIds ) { - match( message, selector, expectedIds, undefined ); + match( message, selector, expectedIds, undefined, QUnit.assert ); }; /** @@ -81,7 +81,7 @@ QUnit.assert.t = function( message, selector, expectedIds ) { * @example selectInFixture("Check for something", "p", ["foo", "bar"]); */ QUnit.assert.selectInFixture = function( message, selector, expectedIds ) { - match( message, selector, expectedIds, "#qunit-fixture" ); + match( message, selector, expectedIds, "#qunit-fixture", QUnit.assert ); }; this.createDashboardXML = function() { @@ -174,7 +174,8 @@ function url( value ) { // Ajax testing helper this.ajaxTest = function( title, expect, options ) { - QUnit.test( title, expect, function( assert ) { + QUnit.test( title, function( assert ) { + assert.expect( expect ); var requestOptions; if ( typeof options === "function" ) { diff --git a/test/data/testrunner.js b/test/data/testrunner.js index d5120c6a0..39000c33b 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -13,8 +13,7 @@ var oldCacheLength = 0, * QUnit configuration */ -// Max time for stop() and asyncTest() until it aborts test -// and start()'s the next test. +// Max time for done() to fire in an async test. QUnit.config.testTimeout = 60e3; // 1 minute // Enforce an "expect" argument or expect() call in all test bodies. |