# HG changeset patch # User RĂ©mi Cardona # Date 1431527908 -7200 # Node ID 59bf206996c81f7733502a8b04f2eabb4f53cc51 # Parent 6e5e1617e1cd794fd24c511ca837a85303609b0b [web/test] stop calling loadxhtml with a form.callback It was deprecated in 3.9 (changeset 7b9553a9db65) and removed in 3.18. Related to #5533303. diff -r 6e5e1617e1cd -r 59bf206996c8 web/test/jstests/test_ajax.js --- a/web/test/jstests/test_ajax.js Wed May 13 16:30:57 2015 +0200 +++ b/web/test/jstests/test_ajax.js Wed May 13 16:38:28 2015 +0200 @@ -26,8 +26,8 @@ expect(3); equals(jQuery('#main').children().length, 0); stop(); - jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html', { - callback: function() { + jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html') + .addCallback(function() { try { equals(jQuery('#main').children().length, 1); equals(jQuery('#main h1').html(), 'Hello'); @@ -35,7 +35,7 @@ start(); }; } - }); + ); }); test('test simple html head inclusion (ajax_url1.html)', function() { @@ -43,8 +43,8 @@ var scriptsIncluded = jsSources(); equals(jQuery.inArray('http://foo.js', scriptsIncluded), - 1); stop(); - jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url1.html', { - callback: function() { + jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url1.html') + .addCallback(function() { try { var origLength = scriptsIncluded.length; scriptsIncluded = jsSources(); @@ -59,7 +59,7 @@ start(); }; } - }); + ); }); test('test addCallback', function() { @@ -177,15 +177,15 @@ expect(4); var counter = 0; stop(); - var d = jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html', { - callback: function() { + var d = jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html'); + d.addCallback(function() { try { equals(++counter, 1); // should be executed first } finally { start(); }; } - }); + ); d.addCallback(function() { equals(++counter, 2); // should be executed and break callback chain throw new Error(); @@ -213,8 +213,8 @@ /* use endswith because in pytest context we have an absolute path */ ok(jQuery('head link').attr('href').endswith('/qunit.css')); stop(); - jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url1.html', { - callback: function() { + jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url1.html') + .addCallback(function() { var origLength = scriptsIncluded.length; scriptsIncluded = jsSources(); try { @@ -233,7 +233,7 @@ start(); } } - }); + ); }); test('test synchronous request loadRemote', function() { @@ -250,15 +250,15 @@ // check that server-response event on CubicWeb is triggered events = 'CubicWeb'; }); - jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html', { - callback: function() { + jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html') + .addCallback(function() { try { equals(events, 'CubicWeb'); } finally { start(); }; } - }); + ); }); test('test event on node', function() { @@ -271,8 +271,8 @@ jQuery(CubicWeb).bind('server-response', function() { nodes.push('CubicWeb'); }); - jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html', { - callback: function() { + jQuery('#main').loadxhtml(BASE_URL + 'cwsoftwareroot/web/test/jstests/ajax_url0.html') + .addCallback(function() { try { equals(nodes.length, 2); // check that server-response event on CubicWeb is triggered @@ -283,7 +283,7 @@ start(); }; } - }); + ); }); });