Browse Source

* Patch from Graeme Geldenhuys to include javascript in css/xsl

git-svn-id: trunk@5465 -
michael 18 years ago
parent
commit
b26b3e06dd
2 changed files with 110 additions and 18 deletions
  1. 44 8
      fcl/fpcunit/example_xsl/fpcunit.css
  2. 66 10
      fcl/fpcunit/example_xsl/fpcunit.xsl

+ 44 - 8
fcl/fpcunit/example_xsl/fpcunit.css

@@ -4,19 +4,23 @@ body
 	font-size: x-small;
   background: #FFFFFF;
 }
+
 a 
 {
   text-decoration: none;
   background-color: Transparent
 }
+
 a:link 
 {	
 	color: #0033ff;
 }		
+
 a:visited 
 {	
 	color:	#003399;
 }			
+
 a:active, a:hover
 {	
 	color:#69c;
@@ -26,21 +30,22 @@ h2
 {
   padding: 4px 4px 4px 6px;
   font-size: large;
-    border: 1px solid black;
-    font-weight: bold;
-    color: white;
-    background-color: #006699;
+  border: 1px solid black;
+  font-weight: bold;
+  color: white;
+  background-color: #006699;
 }
+
 h3 
 {
   padding: 4px 4px 4px 6px;
   border: 1px solid #003399;
   color: #FFFFFF;
-/* #003399;  */
   background-color: #0099CC;
   font-weight: normal;
   font-size: medium;
 }
+
 table 
 {
 	padding:0px;
@@ -48,59 +53,90 @@ table
 	margin-left: -2px;
 	margin-right: -2px;
 }
+
 th, td 
 {
   padding: 2px 4px 2px 4px;
   vertical-align: top;
   font-size: x-small;
 }
+
 address 
 {
 	font-family: verdana, arial, helvetica, Sans-Serif;
 	font-size: 8pt;
-    font-style: normal; 
-    text-align: right;
+  font-style: normal; 
+  text-align: right;
 }
 
 .title 
 {
 	background-color: #bbb; 
-/* #bbb;  #D8D8D8   #D3E4FF */
   color: white;	
 }
+
 .resultmessage
 {
 	background-color: #D3E4FF; 
 }
+
 .success 
 {
 	background-color: lightgreen;
 	color: black;
 }
+
 .failure 
 {
 	background-color: #FF00FF;
 	color: black;
 }
+
 .notrun 
 {
 	background-color: yellow;
 	color: black;
 }
+
 .error 
 {
 	background-color: red;
 	color: black;
 	font-size: 9pt;
 }
+
 .right
 {
 	font-size: 8pt;
 	text-align: right;
 }
+
 .backToTop
 {
   text-align: right;
 }
 
+.testsuitelabel
+{
+	background-color: cadetblue;
+	color: black;
+  cursor:pointer; cursor:hand;   /* cross browser hack */
+	padding-top: 3px;
+	border: 1px solid #F5F5F5;
+}
 
+.testsuiteshowall
+{
+  display:inline;
+  cursor:pointer; cursor:hand;   /* cross browser hack */
+}
+
+.testsuitehideall
+{
+  display:inline;
+  cursor:pointer; cursor:hand;   /* cross browser hack */
+}
+
+div.testcontent {
+	margin-left: 8px;
+}

+ 66 - 10
fcl/fpcunit/example_xsl/fpcunit.xsl

@@ -9,6 +9,56 @@
   	  <style type="text/css" title="fpcUnit" media="screen">
 		    @import "fpcunit.css";
 	    </style>
+    <script>
+window.onload = function () {
+	var x = document.getElementsByTagName('div');
+	for (var i=0;i&lt;x.length;i++)
+	{
+		if (x[i].className == 'testsuitelabel')
+			x[i].onclick = clickSuite;
+		if (x[i].className == 'testsuiteshowall')
+			x[i].onclick = openSuites;
+		if (x[i].className == 'testsuitehideall')
+			x[i].onclick = closeSuites;
+	}
+
+	closeSuites();
+}
+
+function closeSuites()
+{
+	var x = document.getElementsByTagName('div');
+	for (var i=0;i&lt;x.length;i++)
+	{
+		if (x[i].className == 'testcontent')
+			x[i].style.display = 'none';
+	}
+}
+
+function openSuites()
+{
+	var x = document.getElementsByTagName('div');
+	for (var i=0;i&lt;x.length;i++)
+	{
+		if (x[i].className == 'testcontent')
+			x[i].style.display = 'block';
+	}
+}
+
+function clickSuite(e)
+{
+	if (!e) var e = window.event;
+	if (e.target) var tg = e.target;
+	else if (e.srcElement) var tg = e.srcElement;
+	while (tg.nodeName != 'DIV') // Safari GRRRRRRRRRR
+		tg = tg.parentNode;
+	var nextSib = tg.nextSibling;
+	while (nextSib.nodeType != 1)
+		nextSib = nextSib.nextSibling;
+	var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
+	nextSib.style.display = nextSibStatus;
+}
+    </script>
   </head>
   <body>
 
@@ -101,18 +151,24 @@ unexpected results.</p>
   <!--  Test Listing Table -->
 	<table border="0" rules="none" width="100%">
 		<tr align="left" class="title">
-			<th width="89%" align="left">Name</th>
-			<th width="11%" align="left">Elapsed Time<br/>(hh:mm:ss.zzz)</th>
+			<td align="left">Name<br/><div class="testsuiteshowall">[show all]</div><div class="testsuitehideall">[hide all]</div></td>
+			<td width="150" align="right">Elapsed Time<br/>(hh:mm:ss.zzz)</td>
 		</tr>
-    <xsl:for-each select="TestListing/TestSuite/Test">
-    <xsl:variable name="testName" select="@Name"/>
-    <xsl:variable name="elapsedTime" select="ElapsedTime"/>
-    <tr class="success">
-      <td><xsl:value-of select="$testName"/></td>
-      <td><xsl:value-of select="ElapsedTime"/></td>
-    </tr>
-	  </xsl:for-each>
   </table>
+	<xsl:for-each select="TestListing/TestSuite">
+    <div class="testsuitelabel"><xsl:value-of select="@Name"/></div>
+    <div class="testcontent">
+      <table border="0" cellspacing="1" width="100%">
+        <xsl:for-each select="./Test">
+        <tr class="success">
+          <td><xsl:value-of select="@Name"/></td>
+          <td width="150" align="right"><xsl:value-of select="ElapsedTime"/></td>
+        </tr>
+    	  </xsl:for-each>  <!-- Test -->
+      </table>
+    </div>
+  </xsl:for-each> <!-- TestSuite -->
+
 </div>  <!-- testlisting -->
 </xsl:template>