This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 237 - Suggestion for easier debugging (test run link on generated HTML pages)
Summary: Suggestion for easier debugging (test run link on generated HTML pages)
Status: RESOLVED FIXED
Alias: None
Product: DOM TS
Classification: Unclassified
Component: ECMAScript Binding (show other bugs)
Version: unspecified
Hardware: Other other
: P2 enhancement
Target Milestone: ---
Assignee: Curt Arnold
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-25 15:14 UTC by Curt Arnold
Modified: 2003-06-25 22:55 UTC (History)
0 users

See Also:


Attachments

Description Curt Arnold 2003-06-25 15:14:41 UTC
In http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0012.html

I noticed that the hc_*.html files are nearly standalone now, they can
be opened directly in a browser, but one can't run the Javascript code
that it's supposed to be testing (for debugging purposes, to test some
behaviour without the full JSUnit framework around).

Could the scripts that generate the hc_*.html files include
something like

<a href="javascript:hc_documentgetelementsbytagnametotallength()">test</a>

in the <body> part of the page? It shouldn't hurt the normal (non-interactive)
case, but it would help when debugging individual problems. Of course I add
such lines myself, but it would save a bit of time if all hc_* files had this
already.

Thanks.

-- 
David FAURE, faure@kde.org
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
Qtella users - stability patches at http://blackie.dk/~dfaure/qtella.html
Comment 1 Curt Arnold 2003-06-25 18:55:13 UTC
Index: test-to-html.xsl
===================================================================
RCS file: /sources/public/2001/DOM-Test-Suite/transforms/test-to-html.xsl,v
retrieving revision 1.2
diff -u -r1.2 test-to-html.xsl
--- test-to-html.xsl	26 Feb 2002 06:35:36 -0000	1.2
+++ test-to-html.xsl	25 Jun 2003 22:53:24 -0000
@@ -160,7 +160,7 @@
 
 <xsl:template match="text()">
     <xsl:param name="indent"/>
-    <xsl:variable name="normedText" value="normalize-space(.)"/>
+    <xsl:variable name="normedText" select="normalize-space(.)"/>
     <xsl:if test="string-length($normedText) &gt; 0">
         <xsl:value-of select="$indent"/>
         <xsl:value-of select="$normedText"/>
Index: test-to-jsunit.xsl
===================================================================
RCS file: /sources/public/2001/DOM-Test-Suite/transforms/test-to-jsunit.xsl,v
retrieving revision 1.13
diff -u -r1.13 test-to-jsunit.xsl
--- test-to-jsunit.xsl	20 Jun 2003 20:13:04 -0000	1.13
+++ test-to-jsunit.xsl	25 Jun 2003 22:53:25 -0000
@@ -126,7 +126,9 @@
         </head>
         <body>
             <p class="jsUnitHeading"><xsl:value-of select="@name"/></p>
-            <p class="jsUnitDefault">This page contains test "<xsl:value-of
select="@name"/>".</p>
+            <p class="jsUnitDefault">Test source:</p>
+            <xsl:apply-templates select="." mode="html_source"/>
+            <p class="jsUnitDefault">Test documents:</p>
             <xsl:for-each select="$loads">
             	<xsl:choose>
             		<xsl:when test="@href = 'staff'"/>
@@ -135,9 +137,14 @@
             		
             		<xsl:otherwise>
                 		<iframe name="{@var}" src='files/{@href}.html'></iframe>
+                		<br/>
                 	</xsl:otherwise>
                 </xsl:choose>
             </xsl:for-each>
+            
+            <a href="javascript:setUpPage()">Run setUpPage</a>
+            <br/>
+            <a href="javascript:{@name}()">Run <xsl:value-of select="@name"/></a>
         </body>
     </html>
 </xsl:template>
@@ -381,6 +388,137 @@
 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
 </xsl:comment>
 </xsl:template>
+
+
+<xsl:template match="*[local-name()='metadata']" mode="html_source">
+    <xsl:param name="indent"/>
+    <xsl:value-of select="$indent"/>
+    <xsl:text>&lt;metadata&gt;</xsl:text>
+    <br/>
+    <xsl:apply-templates select="*" mode="html_metadata">
+          <xsl:with-param name="indent"
select="concat('&#160;&#160;&#160;&#160;&#160;',$indent)"/>
+    </xsl:apply-templates>
+    <xsl:text>&lt;/metadata&gt;</xsl:text>
+    <br/>
+</xsl:template>
+
+<xsl:template match="*" mode="html_metadata">
+    <xsl:param name="indent"/>
+    <xsl:value-of select="$indent"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="local-name()"/>
+    <xsl:apply-templates select="@*" mode="html_source"/>
+    <xsl:choose>
+    	<xsl:when test="*|text()">
+    		<xsl:text>&gt;</xsl:text>
+    		<xsl:apply-templates select="*|text()" mode="html-metadata"/>
+    		<xsl:text>&lt;/</xsl:text>
+    		<xsl:value-of select="local-name()"/>
+    		<xsl:text>&gt;</xsl:text>
+    	</xsl:when>
+    	<xsl:otherwise>
+    		<xsl:text>/&gt;</xsl:text>    	
+    	</xsl:otherwise>
+    </xsl:choose>
+    <br/>
+</xsl:template>
+        
+
+<xsl:template match="*" mode="html_source">
+    <xsl:param name="indent"/>
+    <!--  indent the element   -->
+    <xsl:value-of select="$indent"/>
+    <!--  start the element   -->
+    <xsl:text>&lt;</xsl:text>
+    <!--  output the tag name   -->
+    <xsl:value-of select="local-name()"/>
+    <!--  output any attributes  -->
+    <xsl:apply-templates select="@*" mode="html_source"/>
+
+    <xsl:choose>
+        <!--  if there are any child elements  -->
+
+        <xsl:when test="*|comment()">
+            <!--   then close the start tag  -->
+            <xsl:text>&gt;</xsl:text>
+            <br/>
+            <!--    emit the child elements   -->
+            <xsl:apply-templates select="*|comment()|text()" mode="html_source">
+                <xsl:with-param name="indent"
select="concat('&#160;&#160;&#160;&#160;&#160;',$indent)"/>
+            </xsl:apply-templates>
+            <!--  write the end tag   -->
+            <xsl:value-of select="$indent"/>
+            <xsl:text>&lt;/</xsl:text>
+            <xsl:value-of select="local-name()"/>
+            <xsl:text>&gt;</xsl:text>
+            <br/>
+        </xsl:when>
+
+        <xsl:otherwise>
+            <!--  close an empty tag   -->
+            <xsl:text>/&gt;</xsl:text>
+            <br/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="@id" mode="html_source">
+    <xsl:text> </xsl:text>
+    <a id="{.}">
+        <xsl:text>id='</xsl:text>
+        <xsl:value-of select="."/>
+        <xsl:text>'</xsl:text>
+    </a>
+</xsl:template>
+
+<xsl:template match="@resource" mode="html_source">
+    <xsl:text> resource='</xsl:text>
+    <xsl:choose>
+		<xsl:when test="contains(.,'#xpointer(id(')">
+            <a>
+                <xsl:attribute name="href">
+		            <xsl:value-of select="substring-before(.,'#xpointer')"/>
+			        <xsl:text>#</xsl:text>
+			        <xsl:variable name="after"
select="substring-after(.,&quot;#xpointer(id(&apos;&quot;)"/>
+			        <xsl:value-of select="substring-before($after,&quot;')&quot;)"/>
+                </xsl:attribute>
+                <xsl:value-of select="."/>
+            </a>
+		</xsl:when>
+
+        <xsl:otherwise>
+            <a href="{.}">
+                <xsl:value-of select="."/>
+            </a>
+        </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>'</xsl:text>
+</xsl:template>
+
+<xsl:template match="@*" mode="html_source">
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="local-name()"/>
+    <xsl:text>='</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>'</xsl:text>
+</xsl:template>
+
+<xsl:template match="comment()" mode="html_source">
+    <xsl:param name="indent"/>
+    <xsl:value-of select="$indent"/>
+    <xsl:text>&lt;!--</xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>--&gt;</xsl:text>
+    <br/>
+</xsl:template>
+
+<xsl:template match="text()" mode="html_metadata">
+	<xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="text()" mode="html_source">
+</xsl:template>
+
 
 
 </xsl:stylesheet>