Author: dolander Date: Thu Jan 20 10:58:42 2005 New Revision: 125803 URL: http://svn.apache.org/viewcvs?view=rev&rev=125803 Log: Add DRT tests of the ScriptBlock tag.
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBase.xml incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBefore.xml incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbInline.xml Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Modified: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp?view=diff&rev=125803&p1=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp&r1=125802&p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp&r2=125803 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp (original) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/base/index.jsp Thu Jan 20 10:58:42 2005 @@ -1,16 +1,14 @@ <%@ page language="java" contentType="text/html;charset=UTF-8"%> <%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> -<%@ taglib prefix="netui-data" uri="http://beehive.apache.org/netui/tags-databinding-1.0"%> -<%@ taglib prefix="netui-template" uri="http://beehive.apache.org/netui/tags-template-1.0"%> - - <netui:html idScope="html"> <head> <netui:base/> </head> <netui:body> - <p style="color:green">Test of the ScriptContainer tag with a scopeId set on - it. + <p style="color:green">This is a test of the ScriptBlock tag. The + script block generated will be placed after the framework generated + javaScript. This is necessary because the JavaScript here calls + methods generated by the framework. </p> <span id="scopeOneSpan" /> <netui:form tagId="form" action="post" focus="b1"> @@ -34,7 +32,9 @@ <hr> <p id="javaOut"></p> - <netui:scriptBlock placement="after"> +<netui:scriptBlock placement="after"> + // JavaScript from the page. This should be placed after the + // framework generated JavaScript var p = document.getElementById("javaOut"); var s = document.getElementById("scopeOneSpan"); @@ -56,7 +56,7 @@ (document["bean"][lookupNameByTagId("t1",s)] == null) + "</b><br>"; p.innerHTML = val; - </netui:scriptBlock> +</netui:scriptBlock> </netui:body> </netui:html> Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/Controller.jpf?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/Controller.jpf Thu Jan 20 10:58:42 2005 @@ -0,0 +1,40 @@ +package coretags.sb.before; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + return new Forward("index"); + } + + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } + +} Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/index.jsp?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/before/index.jsp Thu Jan 20 10:58:42 2005 @@ -0,0 +1,36 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> +<netui:html idScope="html"> + <head> + <netui:base/> + </head> + <netui:body> + <p style="color:green">This test will verify that script blocks with + before will be placed before the framework generated javascript. + </p> + <netui:label tagId="forceJavaScript" value="Force Framework JavaScript"/> + <hr> +<netui:scriptBlock placement="before"> + // This JavaScript should appear before the framework generated + // JavaScript. + var p = document.getElementById("javaOut"); + + var val = "<b>This is generated from the first code block</b><br>"; + p.innerHTML = val; +</netui:scriptBlock> + + <p id="javaOut"></p> + <p id="javaOutTwo"></p> + <hr> +<netui:scriptBlock placement="before"> + // This JavaScript should appear before the framework generated + // JavaScript. + var p = document.getElementById("javaOutTwo"); + var val = "<b>This is generated from the second code block</b><br>"; + p.innerHTML = val; +</netui:scriptBlock> + + </netui:body> +</netui:html> + + \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/Controller.jpf?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/Controller.jpf Thu Jan 20 10:58:42 2005 @@ -0,0 +1,40 @@ +package coretags.sb.inline; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + return new Forward("index"); + } + + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } + +} Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/index.jsp?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/coretags/sb/inline/index.jsp Thu Jan 20 10:58:42 2005 @@ -0,0 +1,26 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> +<netui:html idScope="html"> + <head> + <netui:base/> + </head> + <netui:body> + <p style="color:green">This will output javascript using the + ScriptBlock and the script will appear inline. + </p> + <netui:label tagId="forceJavaScript" value="Force Framework JavaScript"/> + <hr> +<netui:scriptBlock placement="inline"> + document.write("<p><b>This is from the first inline element</b></p>"); +</netui:scriptBlock> + + <p>This is content from the page</p> + +<netui:scriptBlock placement="inline"> + document.write("<p><b>This is from the second inline element</b></p>"); +</netui:scriptBlock> + <hr> + </netui:body> +</netui:html> + + \ No newline at end of file Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=125803&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=125802&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=125803 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Thu Jan 20 10:58:42 2005 @@ -2261,6 +2261,45 @@ </features> </test> <test> + <name>CtSbBase</name> + <description>Base test of the ScriptBlock with "after"</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>tags</category> + </categories> + <features> + <feature>ScriptBlock</feature> + <feature>JavaScript</feature> + </features> + </test> + <test> + <name>CtSbBefore</name> + <description>Base test of the ScriptBlock with "before"</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>tags</category> + </categories> + <features> + <feature>ScriptBlock</feature> + <feature>JavaScript</feature> + </features> + </test> + <test> + <name>CtSbInline</name> + <description>Base test of the ScriptBlock with "inline" and default</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>tags</category> + </categories> + <features> + <feature>ScriptBlock</feature> + <feature>JavaScript</feature> + </features> + </test> + <test> <name>CtScScopeId</name> <description>Test of nesting scope id</description> <webapp>coreWeb</webapp> Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBase.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBase.xml?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBase.xml Thu Jan 20 10:58:42 2005 @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>CtSbBase</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>20 Jan 2005, 11:37:29.545 AM MST</ses:startDate> + <ses:description>Base test of the ScriptBlock tag. This version puts the blocks after the framework generated JavaScript</ses:description> + <ses:tests> + <ses:test> + <ses:testNumber>1</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/coretags/sb/base/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-encoding</ses:name> + <ses:value>gzip,deflate</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en" netui:idScope="html"> + + <head> + <base href="http://localhost:8080/coreWeb/coretags/sb/base/index.jsp"> + </head> + <body> + <p style="color:green">This is a test of the ScriptBlock tag. The + script block generated will be placed after the framework generated + javaScript. This is necessary because the JavaScript here calls + methods generated by the framework. + </p> + <span id="scopeOneSpan" /> + <form name="bean" id="html.form" action="/coreWeb/coretags/sb/base/post.do" method="post"> + <table> + <tr valign="top"> + <td>Text:</td> + <td> + <input type="text" name="{actionForm.text1}" id="html.t1"><br> + <input type="text" name="{actionForm.text2}" id="html.t2"> + </td> + </tr> + </table> + <br> + <input type="submit" id="html.b1" value="Submit">&nbsp; + <input type="submit" name="actionOverride:override" id="html.b2" value="Override">&nbsp; + + </form> + <hr> + Post Value: <span id="html.postValue"></span><br> + Method: <span id="html.method"></span> + <hr> + <p id="javaOut"></p> + + + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.html__b1="html.b1" +netui_names.html__t1="{actionForm.text1}" +netui_names.html__form="html.form" +netui_names.html__postValue="html.postValue" +netui_names.html__b2="actionOverride:override" +netui_names.html__method="html.method" +netui_names.html__t2="{actionForm.text2}" + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_tagIdNameMap == null) + var netui_tagIdNameMap = new Object(); +netui_tagIdNameMap.html___t1="{actionForm.text1}" +netui_tagIdNameMap.html___form="bean" +netui_tagIdNameMap.html___b2="actionOverride:override" +netui_tagIdNameMap.html___t2="{actionForm.text2}" + + +// **** This section contains functions typically run as events **** + + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the idScope for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var idScope = getScopeId(tag); + if (idScope == "") + return netui_names[id]; + else + return netui_names[idScope + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a idScope. +// The first idScope found will be returned or the empty string if a idScope is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var idScope = lookupIdScope(tag,"."); + return (idScope == "") ? id : idScope + id; +} + +// lookup by tagId to "real name" +function lookupNameByTagId(id, tag) +{ + var idScope = lookupIdScope(tag,"_"); + if (idScope == "") + return netui_tagIdNameMap[id]; + else + return netui_tagIdNameMap[idScope + "__" + id]; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupIdScope(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + + // JavaScript from the page. This should be placed after the + // framework generated JavaScript + + var p = document.getElementById("javaOut"); + var s = document.getElementById("scopeOneSpan"); + + var val = "<b>Document Access</b><br>"; + val = val + "JavaScript lookup real name is null: <b>" + + (document["bean"] == null) + "</b><br>"; + val = val + "Form by name is null: <b>" + + (document[lookupNameByTagId("form",s)] == null) + "</b><br>"; + + + val = val + "<br><b>ScopeId value</b><br>"; + val = val + "ScopeId: <b>" + getScopeId(s) + "</b><br>"; + + val = val + "<br><b>NetUI Access Methods</b><br>"; + val = val + "TextBox 1 by id is null: <b>" + + (document.getElementById(lookupIdByTagId("t1",s)) == null) + "</b><br>"; + val = val + "TextBox 1 by name is null: <b>" + + (document["bean"][lookupNameByTagId("t1",s)] == null) + "</b><br>"; + + p.innerHTML = val; + +--> +</script> + +</body> +</div> +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>20 Jan 2005, 11:38:01.640 AM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBefore.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBefore.xml?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbBefore.xml Thu Jan 20 10:58:42 2005 @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>CtSbBefore</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>20 Jan 2005, 11:38:37.681 AM MST</ses:startDate> + <ses:description>Verify the behavior of the ScriptBlock with Before set.</ses:description> + <ses:tests> + <ses:test> + <ses:testNumber>1</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/coretags/sb/before/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-encoding</ses:name> + <ses:value>gzip,deflate</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en" netui:idScope="html"> + + <head> + <base href="http://localhost:8080/coreWeb/coretags/sb/before/index.jsp"> + </head> + <body> + <p style="color:green">This test will verify that script blocks with + before will be placed before the framework generated javascript. + </p> + <label id="html.forceJavaScript">Force Framework JavaScript</label> + <hr> + + + <p id="javaOut"></p> + <p id="javaOutTwo"></p> + <hr> + + + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + + // This JavaScript should appear before the framework generated + // JavaScript. + var p = document.getElementById("javaOut"); + + var val = "<b>This is generated from the first code block</b><br>"; + p.innerHTML = val; + + + // This JavaScript should appear before the framework generated + // JavaScript. + var p = document.getElementById("javaOutTwo"); + var val = "<b>This is generated from the second code block</b><br>"; + p.innerHTML = val; + +--> +</script> + + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.html__forceJavaScript="html.forceJavaScript" + + +// **** This section contains functions typically run as events **** + + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the idScope for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var idScope = getScopeId(tag); + if (idScope == "") + return netui_names[id]; + else + return netui_names[idScope + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a idScope. +// The first idScope found will be returned or the empty string if a idScope is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var idScope = lookupIdScope(tag,"."); + return (idScope == "") ? id : idScope + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupIdScope(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + +</body> +</div> +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>20 Jan 2005, 11:39:07.202 AM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbInline.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbInline.xml?view=auto&rev=125803 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/CtSbInline.xml Thu Jan 20 10:58:42 2005 @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>CtSbInline</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>20 Jan 2005, 11:39:33.459 AM MST</ses:startDate> + <ses:description>Verify the ScriptBlock with inline</ses:description> + <ses:tests> + <ses:test> + <ses:testNumber>1</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/coretags/sb/inline/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-encoding</ses:name> + <ses:value>gzip,deflate</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=CDC3054DDC028F6BDE6022C82195385D</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en" netui:idScope="html"> + + <head> + <base href="http://localhost:8080/coreWeb/coretags/sb/inline/index.jsp"> + </head> + <body> + <p style="color:green">This will output javascript using the + ScriptBlock and the script will appear inline. + </p> + <label id="html.forceJavaScript">Force Framework JavaScript</label> + <hr> + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + + document.write("<p><b>This is from the first inline element</b></p>"); +--> +</script> + + + + <p>This is content from the page</p> + + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + + document.write("<p><b>This is from the second inline element</b></p>"); +--> +</script> + + + <hr> + + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.html__forceJavaScript="html.forceJavaScript" + + +// **** This section contains functions typically run as events **** + + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the idScope for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var idScope = getScopeId(tag); + if (idScope == "") + return netui_names[id]; + else + return netui_names[idScope + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a idScope. +// The first idScope found will be returned or the empty string if a idScope is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var idScope = lookupIdScope(tag,"."); + return (idScope == "") ? id : idScope + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupIdScope(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:idScope"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + +</body> +</div> +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>20 Jan 2005, 11:39:41.471 AM MST</ses:endDate> + <ses:testCount>1</ses:testCount> +</ses:recorderSession> \ No newline at end of file
