Commit c1279895 authored by jaubourg's avatar jaubourg

Fix for #8421. Makes sure resolveWith can be called with only one parameter.

parent 71bd828d
...@@ -837,6 +837,8 @@ jQuery.extend({ ...@@ -837,6 +837,8 @@ jQuery.extend({
// resolve with given context and args // resolve with given context and args
resolveWith: function( context, args ) { resolveWith: function( context, args ) {
if ( !cancelled && !fired && !firing ) { if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1; firing = 1;
try { try {
while( callbacks[ 0 ] ) { while( callbacks[ 0 ] ) {
......
...@@ -916,7 +916,7 @@ test("jQuery.parseJSON", function(){ ...@@ -916,7 +916,7 @@ test("jQuery.parseJSON", function(){
test("jQuery._Deferred()", function() { test("jQuery._Deferred()", function() {
expect( 10 ); expect( 11 );
var deferred, var deferred,
object, object,
...@@ -1005,6 +1005,12 @@ test("jQuery._Deferred()", function() { ...@@ -1005,6 +1005,12 @@ test("jQuery._Deferred()", function() {
deferred.resolveWith( jQuery , [ document ] ).done( function( doc ) { deferred.resolveWith( jQuery , [ document ] ).done( function( doc ) {
ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" ); ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
}); });
// #8421
deferred = jQuery._Deferred();
deferred.resolveWith().done(function() {
ok( true, "Test resolveWith can be called with no argument" );
});
}); });
test("jQuery.Deferred()", function() { test("jQuery.Deferred()", function() {
...@@ -1143,16 +1149,16 @@ test("jQuery.sub() - Static Methods", function(){ ...@@ -1143,16 +1149,16 @@ test("jQuery.sub() - Static Methods", function(){
} }
}); });
Subclass.fn.extend({subClassMethod: function() { return this;}}); Subclass.fn.extend({subClassMethod: function() { return this;}});
//Test Simple Subclass //Test Simple Subclass
ok(Subclass.topLevelMethod() === false, 'Subclass.topLevelMethod thought debug was true'); ok(Subclass.topLevelMethod() === false, 'Subclass.topLevelMethod thought debug was true');
ok(Subclass.config.locale == 'en_US', Subclass.config.locale + ' is wrong!'); ok(Subclass.config.locale == 'en_US', Subclass.config.locale + ' is wrong!');
same(Subclass.config.test, undefined, 'Subclass.config.test is set incorrectly'); same(Subclass.config.test, undefined, 'Subclass.config.test is set incorrectly');
equal(jQuery.ajax, Subclass.ajax, 'The subclass failed to get all top level methods'); equal(jQuery.ajax, Subclass.ajax, 'The subclass failed to get all top level methods');
//Create a SubSubclass //Create a SubSubclass
var SubSubclass = Subclass.sub(); var SubSubclass = Subclass.sub();
//Make Sure the SubSubclass inherited properly //Make Sure the SubSubclass inherited properly
ok(SubSubclass.topLevelMethod() === false, 'SubSubclass.topLevelMethod thought debug was true'); ok(SubSubclass.topLevelMethod() === false, 'SubSubclass.topLevelMethod thought debug was true');
ok(SubSubclass.config.locale == 'en_US', SubSubclass.config.locale + ' is wrong!'); ok(SubSubclass.config.locale == 'en_US', SubSubclass.config.locale + ' is wrong!');
...@@ -1169,7 +1175,7 @@ test("jQuery.sub() - Static Methods", function(){ ...@@ -1169,7 +1175,7 @@ test("jQuery.sub() - Static Methods", function(){
ok(SubSubclass.config.locale == 'es_MX', SubSubclass.config.locale + ' is wrong!'); ok(SubSubclass.config.locale == 'es_MX', SubSubclass.config.locale + ' is wrong!');
ok(SubSubclass.config.test == 'worked', 'SubSubclass.config.test is set incorrectly'); ok(SubSubclass.config.test == 'worked', 'SubSubclass.config.test is set incorrectly');
notEqual(jQuery.ajax, SubSubclass.ajax, 'The subsubclass failed to get all top level methods'); notEqual(jQuery.ajax, SubSubclass.ajax, 'The subsubclass failed to get all top level methods');
//This shows that the modifications to the SubSubClass did not bubble back up to it's superclass //This shows that the modifications to the SubSubClass did not bubble back up to it's superclass
ok(Subclass.topLevelMethod() === false, 'Subclass.topLevelMethod thought debug was true'); ok(Subclass.topLevelMethod() === false, 'Subclass.topLevelMethod thought debug was true');
ok(Subclass.config.locale == 'en_US', Subclass.config.locale + ' is wrong!'); ok(Subclass.config.locale == 'en_US', Subclass.config.locale + ' is wrong!');
......
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