Author: hlship
Date: Thu Jun 30 00:38:03 2011
New Revision: 1141345

URL: http://svn.apache.org/viewvc?rev=1141345&view=rev
Log:
Improve JS exception output in unit tests

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css
    
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css?rev=1141345&r1=1141344&r2=1141345&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.css
 Thu Jun 30 00:38:03 2011
@@ -23,4 +23,8 @@ DIV.js-results .pass {
 
 DIV.js-results .fail {
     color: red;    
+}
+
+DIV.js-results .exception {
+    font-weight: bold;
 }
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js?rev=1141345&r1=1141344&r2=1141345&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/js-testing.js
 Thu Jun 30 00:38:03 2011
@@ -84,43 +84,46 @@ var JST = (function() {
                                        e.addClassName("odd");
                                });
 
-               $(elementId).select("div").each(function(test) {
+               $(elementId).select("div").each(
+                               function(test) {
 
-                       test.addClassName("active");
+                                       test.addClassName("active");
 
-                       test.scrollTo();
+                                       test.scrollTo();
 
-                       resultElement = test.down("p");
-                       resultNoted = false;
+                                       resultElement = test.down("p");
+                                       resultNoted = false;
 
-                       var testCode = test.down("pre").textContent;
+                                       var testCode = 
test.down("pre").textContent;
 
-                       try {
-                               eval(testCode);
+                                       try {
+                                               eval(testCode);
 
-                               passCount++;
+                                               passCount++;
 
-                               resultElement.insert({
-                                       top : "PASS - "
-                               });
+                                               resultElement.insert({
+                                                       top : "PASS - "
+                                               });
 
-                               test.addClassName("pass");
+                                               test.addClassName("pass");
 
-                       } catch (e) {
-                               failCount++;
+                                       } catch (e) {
+                                               failCount++;
 
-                               if (e !== $fail) {
-                                       resultElement.next().insert({
-                                               top : "EXCEPTION - ",
-                                               after : "<hr><pre>" + 
toString(e) + "</pre>"
-                                       });
-
-                                       test.addClassName("fail");
-                               }
-                       }
+                                               if (e !== $fail) {
+                                                       
resultElement.next().insert(
+                                                                       {
+                                                                               
top : "EXCEPTION - ",
+                                                                               
after : "<hr><div class='exception'>"
+                                                                               
                + toString(e) + "</div>"
+                                                                       });
+
+                                                       
test.addClassName("fail");
+                                               }
+                                       }
 
-                       test.removeClassName("active");
-               });
+                                       test.removeClassName("active");
+                               });
 
                $(elementId)
                                .insert(


Reply via email to