# HG changeset patch # User Adrien Di Mascio # Date 1284364570 -7200 # Node ID e03808843325c6455a9555a2349b1290a0c4b97b # Parent efde9f08f2aef43911955346d5279b83f0b670a6 [javascript] fix test_ajax.js implementation In cubicweb.ajax.js, we maintain two lists (cw.loaded_src and cw.loaded_href) to keep track of already included CSS and JS. (see discussion about jQuery and $('foo').appendTo($head) in _loadAjaxHtmlHead.) Since all tests are executed in the "same page", those two variables need to be reinitialized before each test. diff -r efde9f08f2ae -r e03808843325 web/test/jstests/test_ajax.js --- a/web/test/jstests/test_ajax.js Mon Sep 13 10:00:05 2010 +0200 +++ b/web/test/jstests/test_ajax.js Mon Sep 13 09:56:10 2010 +0200 @@ -3,7 +3,12 @@ module("ajax", { setup: function() { this.scriptsLength = $('head script[src]').length-1; - this.cssLength = $('head link[rel=stylesheet]').length-1; + this.cssLength = $('head link[rel=stylesheet]').length-1; + // re-initialize cw loaded cache so that each tests run in a + // clean environment, have a lookt at _loadAjaxHtmlHead implementation + // in cubicweb.ajax.js for more information. + cw.loaded_src = []; + cw.loaded_href = []; }, teardown: function() { $('head script[src]:gt(' + this.scriptsLength + ')').remove();