[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebForm.java,1.73,1.74 WebRequestSource.j
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-12-27 05:09:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv1498/src/com/meterware/httpunit
Modified Files:
WebForm.java WebRequestSource.java
Log Message:
Added JavaScript Form.target support
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- WebForm.java 26 Dec 2002 18:55:18 -0000 1.73
+++ WebForm.java 27 Dec 2002 05:09:38 -0000 1.74
@@ -531,8 +531,25 @@
public Object get( String propertyName ) {
- final FormParameter parameter = getParameter( propertyName );
- return parameter == UNKNOWN_PARAMETER ? null : parameter.getScriptableObject();
+ if (propertyName.equals( "target" )) {
+ return getTarget();
+ } else {
+ final FormParameter parameter = getParameter( propertyName );
+ return parameter == UNKNOWN_PARAMETER ? null : parameter.getScriptableObject();
+ }
+ }
+
+
+ /**
+ * Sets the value of the named property. Will throw a runtime exception if the property does not exist or
+ * cannot accept the specified value.
+ **/
+ public void set( String propertyName, Object value ) {
+ if (propertyName.equals( "target" )) {
+ setTargetAttribute( value.toString() );
+ } else {
+ super.set( propertyName, value );
+ }
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- WebRequestSource.java 26 Dec 2002 04:59:35 -0000 1.21
+++ WebRequestSource.java 27 Dec 2002 05:09:38 -0000 1.22
@@ -23,6 +23,7 @@
import com.meterware.httpunit.scripting.ScriptableDelegate;
import org.w3c.dom.Node;
+import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import java.net.URL;
@@ -250,6 +251,11 @@
private String getSpecifiedTarget() {
return getAttribute( "target" );
+ }
+
+
+ protected void setTargetAttribute( String value ) {
+ ((Element) _node).setAttribute( "target", value );
}
|