Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 8107 Fix And Proper Unit-tests ( Try #2 ) #219

Merged
2 commits merged into from Feb 1, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/ajax.js
Expand Up @@ -322,9 +322,8 @@ jQuery.extend({
// Main method
ajax: function( url, options ) {

// If options is not an object,
// we simulate pre-1.5 signature
if ( typeof options !== "object" ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
Expand Down
15 changes: 15 additions & 0 deletions test/unit/ajax.js
Expand Up @@ -38,6 +38,21 @@ test("jQuery.ajax() - success callbacks", function() {
});
});

test( "jQuery.ajax - multiple method signatures introduced in 1.5 ( #8107)", function() {

expect( 4 );

stop();

jQuery.when(
jQuery.ajax().success(function() { ok( true, 'With no arguments' ); }),
jQuery.ajax('data/name.html').success(function() { ok( true, 'With only string URL argument' ); }),
jQuery.ajax('data/name.html', {} ).success(function() { ok( true, 'With string URL param and map' ); }),
jQuery.ajax({ url: 'data/name.html'} ).success(function() { ok( true, 'With only map' ); })
).then( start, start );

});

test("jQuery.ajax() - success callbacks - (url, options) syntax", function() {
expect( 8 );

Expand Down