X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2FajaxTest.js;h=c8fae234bd1de2b3ab36b5fc597e582c91a63c1c;hb=c330527318775d32c87954f640c53066e7a732d9;hp=8d32716faa18dec6faffb372e68441cd54a0c26c;hpb=4c66f62a6fcc84a6c85249d0fb34b93edd40be00;p=jquery.git diff --git a/src/ajax/ajaxTest.js b/src/ajax/ajaxTest.js index 8d32716..c8fae23 100644 --- a/src/ajax/ajaxTest.js +++ b/src/ajax/ajaxTest.js @@ -72,17 +72,28 @@ test("load(String, Object, Function) - check scripts", function() { foobar = null; var verifyEvaluation = function() { ok( foobar == "bar", 'Check if script src was evaluated after load' ); - ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM'); start(); }; $('#first').load(url('data/test.php'), function() { ok( $('#first').html().match(/^html text/), 'Check content after loading html' ); + ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); ok( testFoo == "foo", 'Check if script was evaluated after load' ); setTimeout(verifyEvaluation, 600); }); }); +test("load(String, Object, Function) - check file with only a script tag", function() { + expect(3); + stop(); + testFoo = undefined; + $('#first').load(url('data/test2.php'), function() { + ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); + ok( testFoo == "foo", 'Check if script was evaluated after load' ); + start(); + }); +}); + test("test global handlers - success", function() { expect(8); stop(); @@ -351,3 +362,17 @@ test("ajaxSetup()", function() { }); $.ajax(); }); + +test("evalScripts() with no script elements", function() { + expect(2); + + var data = "this is just some bogus text"; + $('#foo').html(data); + ok ( true, 'before evalScripts()'); + try { + $('#foo').evalScripts(); + } catch(e) { + ok (false, 'exception evaluating scripts: ' + e.message); + } + ok ( true, 'after evalScripts()'); +});