# HG changeset patch # User RĂ©mi Cardona # Date 1431528183 -7200 # Node ID 5edd38e3205fd40917580ea99b904d14cae21b68 # Parent e1076102bd84819dd01fa277de1986b4f7cf1568 [web/test] Fix remaining JS tests (closes #5533303) diff -r e1076102bd84 -r 5edd38e3205f web/test/jstests/test_ajax.js --- a/web/test/jstests/test_ajax.js Wed May 13 16:42:01 2015 +0200 +++ b/web/test/jstests/test_ajax.js Wed May 13 16:43:03 2015 +0200 @@ -11,7 +11,7 @@ cw.loaded_links = []; }, teardown: function() { - $('head script[src]:gt(' + this.scriptsLength + ')').remove(); + $('head script[src]:lt(' + ($('head script[src]').length - 1 - this.scriptsLength) + ')').remove(); $('head link[rel=stylesheet]:gt(' + this.cssLength + ')').remove(); } }); @@ -48,9 +48,9 @@ try { var origLength = scriptsIncluded.length; scriptsIncluded = jsSources(); - // check that foo.js has been *appended* to + // check that foo.js has been prepended to equals(scriptsIncluded.length, origLength + 1); - equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0); + equals(scriptsIncluded.indexOf('http://foo.js'), 0); // check that
has been removed equals(jQuery('#main').children().length, 1); equals(jQuery('div.ajaxHtmlHead').length, 0); @@ -118,7 +118,7 @@ }); test('test callback after synchronous request with parameters', function() { - expect(2); + expect(3); var deferred = new Deferred(); deferred.addCallback(function(data, req, arg1, arg2) { // add an assertion to ensure the callback is executed @@ -206,7 +206,7 @@ try { // check that foo.js has been inserted in equals(scriptsIncluded.length, origLength + 1); - equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0); + equals(scriptsIncluded.indexOf('http://foo.js'), 0); // check that
has been removed equals(jQuery('#main').children().length, 1); equals(jQuery('div.ajaxHtmlHead').length, 0);