fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-24 07:03 am

[dw-free] Create page to run multiple test pages using our js test framework

[commit: http://hg.dwscoalition.org/dw-free/rev/98bb3a3bb147]

http://bugs.dwscoalition.org/show_bug.cgi?id=3534

Work around weird bug with Firefox and iframes with display:none, which
causes getComputedStyle to fail (which causes some tests to fail when
they're in iframes such as caused by tests-all)

Patch by [personal profile] exor674.

Files modified:
  • htdocs/js/tests/qunit-all.js
  • views/dev/tests-all.tt
--------------------------------------------------------------------------------
diff -r c7966d7a04db -r 98bb3a3bb147 htdocs/js/tests/qunit-all.js
--- a/htdocs/js/tests/qunit-all.js	Thu Feb 24 13:21:25 2011 +0800
+++ b/htdocs/js/tests/qunit-all.js	Thu Feb 24 15:03:19 2011 +0800
@@ -76,11 +76,10 @@ var _r = {
         strong.append(counts);
 
         var iframe = $("<iframe>");
-        li.append(iframe);
+        iframe.attr("src",url);
+
+        $("#qunit-fixture").append(iframe);
         _r.current_iframe = iframe;
-
-        iframe.hide();
-        iframe.attr("src",url);
 
 
         iframe.load(function () {
@@ -149,6 +148,7 @@ var _r = {
             lib.text(" (" +_r.cur_test + "/" + _r.cur_lib + ")");
             element.append(lib);
         });
+        _r.current_iframe.remove();
         _r.current_li.remove();
         _r.run_next();
     },
diff -r c7966d7a04db -r 98bb3a3bb147 views/dev/tests-all.tt
--- a/views/dev/tests-all.tt	Thu Feb 24 13:21:25 2011 +0800
+++ b/views/dev/tests-all.tt	Thu Feb 24 15:03:19 2011 +0800
@@ -23,3 +23,4 @@ All Libraries for [% test | html %]
 <h2 id="qunit-userAgent"></h2>
 <p id="qunit-testresult" class="result"><span class="line1"></span><br/><span class="line2"><span class="passed">0</span> test(s) of <span class="total">0</span> passed, <span class="failed">0</span> failed.</span></p>
 <ol id="qunit-tests"></ol>
+<div id="qunit-fixture"></div>
--------------------------------------------------------------------------------