Repository: jquery/jquery
File: test/unit/ajax.js (JavaScript)

Code before:
	} );

	QUnit.test( "jQuery[get|post]( options ) - simple with xml", function( assert ) {
		assert.expect( 2 );
		var done = assert.async();

		jQuery.when.apply( jQuery,
			jQuery.map( [ "get", "post" ], function( method ) {
				return jQuery[ method ]( {
					url: url( "mock.php?action=xml" ),
					data: {
						cal: "5-2"
					},
					success: function( xml ) {
						jQuery( "math", xml ).each( function() {
							assert.strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" );
						} );
					}
				} );
			} )
		).always( function() {
			done();
		} );
	} );

	QUnit.test( "jQuery.append with crossOrigin attribute", function( assert ) {
		var done = assert.async();
		assert.expect( 1 );

		var timeout = null;

		Globals.register( "corsCallback" );
		window.corsCallback = function( response ) {
			assert.ok( response === true, "Cors" );
			window.clearTimeout( timeout );
			done();
		};

		var src = baseURL + "mock.php?action=cors";

		// To simulate a cross-origin request
		src = src.replace( "localhost", "127.0.0.1" );
		var html = "<script type=\"text/javascript\" src=\"" + src + "\" crossorigin=\"anonymous\"><\/script>";

		jQuery( document.body ).append( html );
		timeout = window.setTimeout( function() {
			assert.ok( false, "Cors" );
			done();
		}, 2000 );
	} );


Review comment (suggestion):
The attribute is lowercase so:
```suggestion
	QUnit.test( "jQuery.append with crossorigin attribute", function( assert ) {
```

Code after:
			assert.ok( jQuery( "#first" ).html().match( /^html text/ ), "Check content after loading html" );
			assert.strictEqual( jQuery( "#foo" ).html(), "foo", "Check if script evaluation has modified DOM" );
			assert.strictEqual( window[ "testFoo" ], "foo", "Check if script was evaluated after load" );
			setTimeout( verifyEvaluation, 600 );
		} );
	} );

	QUnit.test( "jQuery.fn.load( String, Function ) - check file with only a script tag", function( assert ) {
		assert.expect( 3 );
		var done = assert.async();
		Globals.register( "testFoo" );

		jQuery( "#first" ).load( url( "test2.html" ), function() {
			assert.strictEqual( jQuery( "#foo" ).html(), "foo", "Check if script evaluation has modified DOM" );
			assert.strictEqual( window[ "testFoo" ], "foo", "Check if script was evaluated after load" );
			done();
		} );
	} );

	QUnit.test( "jQuery.fn.load( String, Function ) - dataFilter in ajaxSettings", function( assert ) {
		assert.expect( 2 );
		var done = assert.async();
		jQuery.ajaxSetup( {
			dataFilter: function() {
				return "Hello World";
			}
		} );
		jQuery( "<div></div>" ).load( url( "name.html" ), function( responseText ) {
			assert.strictEqual( jQuery( this ).html(), "Hello World", "Test div was filled with filtered data" );
			assert.strictEqual( responseText, "Hello World", "Test callback receives filtered data" );
			done();
		} );
	} );

	QUnit.test( "jQuery.fn.load( String, Object, Function )", function( assert ) {
		assert.expect( 2 );
		var done = assert.async();
		jQuery( "<div></div>" ).load( url( "mock.php?action=echoHtml" ), {
			"bar": "ok"
		}, function() {
			var $node = jQuery( this );
			assert.strictEqual( $node.find( "#method" ).text(), "POST", "Check method" );
			assert.strictEqual( $node.find( "#data" ).text(), "bar=ok", "Check if data is passed correctly" );
			done();
		} );
	} );

	QUnit.test( "jQuery.fn.load( String, String, Function )", function( assert ) {
		assert.expect( 2 );
		var done = assert.async();