aboutsummaryrefslogtreecommitdiffstats
path: root/test/data/testrunner.js
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/data/testrunner.js
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/data/testrunner.js')
-rw-r--r--test/data/testrunner.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/data/testrunner.js b/test/data/testrunner.js
index c60b152b1..0758219f0 100644
--- a/test/data/testrunner.js
+++ b/test/data/testrunner.js
@@ -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;
}
};