mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: Fix tests for not auto-executing scripts without dataType
Two issues are fixed in testing for responses with a script Content-Type not getting auto-executed unless an explicit `dataType: "script"` is provided: * the test is now using a correct "text/javascript" Content-Type; it was using "text/html" until now which doesn't really check if the fix works * the Node.js based version of the tests didn't account for an empty `header` query string parameter Closes gh-4824 Ref gh-2432 Ref gh-2588 Ref39cdb8c9aa
(cherry picked from commitd38528b17a
)
This commit is contained in:
parent
bcd40aa7a3
commit
7298e04fae
@ -62,7 +62,7 @@ var mocks = {
|
|||||||
script: function( req, resp ) {
|
script: function( req, resp ) {
|
||||||
if ( req.query.header === "ecma" ) {
|
if ( req.query.header === "ecma" ) {
|
||||||
resp.writeHead( 200, { "content-type": "application/ecmascript" } );
|
resp.writeHead( 200, { "content-type": "application/ecmascript" } );
|
||||||
} else if ( req.query.header ) {
|
} else if ( "header" in req.query ) {
|
||||||
resp.writeHead( 200, { "content-type": "text/javascript" } );
|
resp.writeHead( 200, { "content-type": "text/javascript" } );
|
||||||
} else {
|
} else {
|
||||||
resp.writeHead( 200, { "content-type": "text/html" } );
|
resp.writeHead( 200, { "content-type": "text/html" } );
|
||||||
|
@ -114,7 +114,7 @@ QUnit.module( "ajax", {
|
|||||||
return {
|
return {
|
||||||
create: function( options ) {
|
create: function( options ) {
|
||||||
options.crossDomain = true;
|
options.crossDomain = true;
|
||||||
return jQuery.ajax( url( "mock.php?action=script" ), options );
|
return jQuery.ajax( url( "mock.php?action=script&header" ), options );
|
||||||
},
|
},
|
||||||
success: function() {
|
success: function() {
|
||||||
assert.ok( true, "success" );
|
assert.ok( true, "success" );
|
||||||
|
Loading…
Reference in New Issue
Block a user