web/test/jstests/test_ajax.js
changeset 7017 cd2ea273007a
parent 6215 759cf097f5aa
equal deleted inserted replaced
7016:6665fa16aa45 7017:cd2ea273007a
    42         stop();
    42         stop();
    43         jQuery('#main').loadxhtml('/../ajax_url1.html', {
    43         jQuery('#main').loadxhtml('/../ajax_url1.html', {
    44             callback: function() {
    44             callback: function() {
    45                 var origLength = scriptsIncluded.length;
    45                 var origLength = scriptsIncluded.length;
    46                 scriptsIncluded = jsSources();
    46                 scriptsIncluded = jsSources();
    47                 // check that foo.js has been inserted in <head>
    47                 // check that foo.js has been *appended* to <head>
    48                 equals(scriptsIncluded.length, origLength + 1);
    48                 equals(scriptsIncluded.length, origLength + 1);
    49                 equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
    49                 equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
    50                 // check that <div class="ajaxHtmlHead"> has been removed
    50                 // check that <div class="ajaxHtmlHead"> has been removed
    51                 equals(jQuery('#main').children().length, 1);
    51                 equals(jQuery('#main').children().length, 1);
    52                 equals(jQuery('div.ajaxHtmlHead').length, 0);
    52                 equals(jQuery('div.ajaxHtmlHead').length, 0);
   103     });
   103     });
   104 
   104 
   105     test('test callback after synchronous request with parameters', function() {
   105     test('test callback after synchronous request with parameters', function() {
   106         var deferred = new Deferred();
   106         var deferred = new Deferred();
   107         var result = jQuery.ajax({
   107         var result = jQuery.ajax({
   108             url: './ajax_url0.html',
   108             url: '/../ajax_url0.html',
   109             async: false,
   109             async: false,
   110             beforeSend: function(xhr) {
   110             beforeSend: function(xhr) {
   111                 deferred._req = xhr;
   111                 deferred._req = xhr;
   112             },
   112             },
   113             success: function(data, status) {
   113             success: function(data, status) {