Commit f35ba5e6 authored by Mike Sherov's avatar Mike Sherov Committed by Dave Methvin

Fix #10691. Remove all instances of equals() and same(), as these are deprecated in QUnit.

parent 83c72eaa
...@@ -41,7 +41,7 @@ function t(a,b,c) { ...@@ -41,7 +41,7 @@ function t(a,b,c) {
s += (s && ",") + '"' + f[i].id + '"'; s += (s && ",") + '"' + f[i].id + '"';
} }
same(f, q.apply(q,c), a + " (" + b + ")"); deepEqual(f, q.apply(q,c), a + " (" + b + ")");
} }
var fireNative; var fireNative;
...@@ -102,19 +102,19 @@ function url(value) { ...@@ -102,19 +102,19 @@ function url(value) {
// Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test, // Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test,
// if we unconditionally assert any of these, the test will fail with too many assertions :| // if we unconditionally assert any of these, the test will fail with too many assertions :|
if ( cacheLength !== oldCacheLength ) { if ( cacheLength !== oldCacheLength ) {
equals( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
oldCacheLength = cacheLength; oldCacheLength = cacheLength;
} }
if ( fragmentsLength !== oldFragmentsLength ) { if ( fragmentsLength !== oldFragmentsLength ) {
equals( fragmentsLength, oldFragmentsLength, "No unit tests leak memory in jQuery.fragments" ); equal( fragmentsLength, oldFragmentsLength, "No unit tests leak memory in jQuery.fragments" );
oldFragmentsLength = fragmentsLength; oldFragmentsLength = fragmentsLength;
} }
if ( jQuery.timers.length !== oldTimersLength ) { if ( jQuery.timers.length !== oldTimersLength ) {
equals( jQuery.timers.length, oldTimersLength, "No timers are still running" ); equal( jQuery.timers.length, oldTimersLength, "No timers are still running" );
oldTimersLength = jQuery.timers.length; oldTimersLength = jQuery.timers.length;
} }
if ( jQuery.active !== oldActive ) { if ( jQuery.active !== oldActive ) {
equals( jQuery.active, 0, "No AJAX requests are still active" ); equal( jQuery.active, 0, "No AJAX requests are still active" );
oldActive = jQuery.active; oldActive = jQuery.active;
} }
} }
......
...@@ -25,9 +25,3 @@ jQuery.noConflict(); // Allow the test to run with other libs or jQuery's. ...@@ -25,9 +25,3 @@ jQuery.noConflict(); // Allow the test to run with other libs or jQuery's.
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>"); document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
})(); })();
// QUnit Aliases
(function() {
window.equals = window.equal;
window.same = window.deepEqual;
})();
This diff is collapsed.
This diff is collapsed.
...@@ -69,7 +69,7 @@ jQuery.each( tests, function( flags, resultString ) { ...@@ -69,7 +69,7 @@ jQuery.each( tests, function( flags, resultString ) {
output = "X"; output = "X";
cblist = jQuery.Callbacks( flags ); cblist = jQuery.Callbacks( flags );
cblist.add(function() { cblist.add(function() {
equals( this, window, "Basic binding and firing (context)" ); equal( this, window, "Basic binding and firing (context)" );
output += Array.prototype.join.call( arguments, "" ); output += Array.prototype.join.call( arguments, "" );
}); });
cblist.fireWith( window, [ "A", "B" ] ); cblist.fireWith( window, [ "A", "B" ] );
...@@ -79,7 +79,7 @@ jQuery.each( tests, function( flags, resultString ) { ...@@ -79,7 +79,7 @@ jQuery.each( tests, function( flags, resultString ) {
output = ""; output = "";
cblist = jQuery.Callbacks( flags ); cblist = jQuery.Callbacks( flags );
cblist.add(function() { cblist.add(function() {
equals( this, window, "fireWith with no arguments (context is window)" ); equal( this, window, "fireWith with no arguments (context is window)" );
strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" ); strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" );
}); });
cblist.fireWith(); cblist.fireWith();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -351,18 +351,18 @@ test("jQuery.when - joined", function() { ...@@ -351,18 +351,18 @@ test("jQuery.when - joined", function() {
var promise = jQuery.when( defer1, defer2 ).done(function( a, b ) { var promise = jQuery.when( defer1, defer2 ).done(function( a, b ) {
if ( shouldResolve ) { if ( shouldResolve ) {
same( [ a, b ], expected, code + " => resolve" ); deepEqual( [ a, b ], expected, code + " => resolve" );
} else { } else {
ok( false , code + " => resolve" ); ok( false , code + " => resolve" );
} }
}).fail(function( a, b ) { }).fail(function( a, b ) {
if ( shouldError ) { if ( shouldError ) {
same( [ a, b ], expected, code + " => reject" ); deepEqual( [ a, b ], expected, code + " => reject" );
} else { } else {
ok( false , code + " => reject" ); ok( false , code + " => reject" );
} }
}).progress(function progress( a, b ) { }).progress(function progress( a, b ) {
same( [ a, b ], expectedNotify, code + " => progress" ); deepEqual( [ a, b ], expectedNotify, code + " => progress" );
}); });
} ); } );
} ); } );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -10,41 +10,41 @@ test("queue() with other types",function() { ...@@ -10,41 +10,41 @@ test("queue() with other types",function() {
defer; defer;
$div.promise("foo").done(function() { $div.promise("foo").done(function() {
equals( counter, 0, "Deferred for collection with no queue is automatically resolved" ); equal( counter, 0, "Deferred for collection with no queue is automatically resolved" );
}); });
$div $div
.queue("foo",function(){ .queue("foo",function(){
equals( ++counter, 1, "Dequeuing" ); equal( ++counter, 1, "Dequeuing" );
jQuery.dequeue(this,"foo"); jQuery.dequeue(this,"foo");
}) })
.queue("foo",function(){ .queue("foo",function(){
equals( ++counter, 2, "Dequeuing" ); equal( ++counter, 2, "Dequeuing" );
jQuery(this).dequeue("foo"); jQuery(this).dequeue("foo");
}) })
.queue("foo",function(){ .queue("foo",function(){
equals( ++counter, 3, "Dequeuing" ); equal( ++counter, 3, "Dequeuing" );
}) })
.queue("foo",function(){ .queue("foo",function(){
equals( ++counter, 4, "Dequeuing" ); equal( ++counter, 4, "Dequeuing" );
}); });
defer = $div.promise("foo").done(function() { defer = $div.promise("foo").done(function() {
equals( counter, 4, "Testing previous call to dequeue in deferred" ); equal( counter, 4, "Testing previous call to dequeue in deferred" );
start(); start();
}); });
equals( $div.queue("foo").length, 4, "Testing queue length" ); equal( $div.queue("foo").length, 4, "Testing queue length" );
$div.dequeue("foo"); $div.dequeue("foo");
equals( counter, 3, "Testing previous call to dequeue" ); equal( counter, 3, "Testing previous call to dequeue" );
equals( $div.queue("foo").length, 1, "Testing queue length" ); equal( $div.queue("foo").length, 1, "Testing queue length" );
$div.dequeue("foo"); $div.dequeue("foo");
equals( counter, 4, "Testing previous call to dequeue" ); equal( counter, 4, "Testing previous call to dequeue" );
equals( $div.queue("foo").length, 0, "Testing queue length" ); equal( $div.queue("foo").length, 0, "Testing queue length" );
}); });
test("queue(name) passes in the next item in the queue as a parameter", function() { test("queue(name) passes in the next item in the queue as a parameter", function() {
...@@ -54,13 +54,13 @@ test("queue(name) passes in the next item in the queue as a parameter", function ...@@ -54,13 +54,13 @@ test("queue(name) passes in the next item in the queue as a parameter", function
var counter = 0; var counter = 0;
div.queue("foo", function(next) { div.queue("foo", function(next) {
equals(++counter, 1, "Dequeueing"); equal(++counter, 1, "Dequeueing");
next(); next();
}).queue("foo", function(next) { }).queue("foo", function(next) {
equals(++counter, 2, "Next was called"); equal(++counter, 2, "Next was called");
next(); next();
}).queue("bar", function() { }).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()") equal(++counter, 3, "Other queues are not triggered by next()")
}); });
div.dequeue("foo"); div.dequeue("foo");
...@@ -74,18 +74,18 @@ test("queue() passes in the next item in the queue as a parameter to fx queues", ...@@ -74,18 +74,18 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
var counter = 0; var counter = 0;
div.queue(function(next) { div.queue(function(next) {
equals(++counter, 1, "Dequeueing"); equal(++counter, 1, "Dequeueing");
var self = this; var self = this;
setTimeout(function() { next() }, 500); setTimeout(function() { next() }, 500);
}).queue(function(next) { }).queue(function(next) {
equals(++counter, 2, "Next was called"); equal(++counter, 2, "Next was called");
next(); next();
}).queue("bar", function() { }).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()") equal(++counter, 3, "Other queues are not triggered by next()")
}); });
jQuery.when( div.promise("fx"), div ).done(function() { jQuery.when( div.promise("fx"), div ).done(function() {
equals(counter, 2, "Deferreds resolved"); equal(counter, 2, "Deferreds resolved");
start(); start();
}); });
}); });
...@@ -110,7 +110,7 @@ test("callbacks keep their place in the queue", function() { ...@@ -110,7 +110,7 @@ test("callbacks keep their place in the queue", function() {
}); });
div.promise("fx").done(function() { div.promise("fx").done(function() {
equals(counter, 4, "Deferreds resolved"); equal(counter, 4, "Deferreds resolved");
start(); start();
}); });
}); });
...@@ -127,7 +127,7 @@ test("delay()", function() { ...@@ -127,7 +127,7 @@ test("delay()", function() {
start(); start();
}); });
equals( run, 0, "The delay delayed the next function from running." ); equal( run, 0, "The delay delayed the next function from running." );
}); });
test("delay() can be stopped", function() { test("delay() can be stopped", function() {
...@@ -191,7 +191,7 @@ test("clearQueue(name) clears the queue", function() { ...@@ -191,7 +191,7 @@ test("clearQueue(name) clears the queue", function() {
div.dequeue("foo"); div.dequeue("foo");
equals(counter, 1, "the queue was cleared"); equal(counter, 1, "the queue was cleared");
}); });
test("clearQueue() clears the fx queue", function() { test("clearQueue() clears the fx queue", function() {
...@@ -208,7 +208,7 @@ test("clearQueue() clears the fx queue", function() { ...@@ -208,7 +208,7 @@ test("clearQueue() clears the fx queue", function() {
counter++; counter++;
}); });
equals(counter, 1, "the queue was cleared"); equal(counter, 1, "the queue was cleared");
div.removeData(); div.removeData();
}); });
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment