Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv4813/src/com/meterware/httpunit
Modified Files:
FormControl.java WebForm.java
Log Message:
Added JavaScript support for text field values
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FormControl.java 24 Jul 2002 20:54:31 -0000 1.12
+++ FormControl.java 1 Aug 2002 20:23:15 -0000 1.13
@@ -544,6 +544,15 @@
class Scriptable extends FormControl.Scriptable {
+ public Object get( String propertyName ) {
+ if (propertyName.equalsIgnoreCase( "value" )) {
+ return getValues()[0];
+ } else {
+ return super.get( propertyName );
+ }
+ }
+
+
public void set( String propertyName, Object value ) {
if (propertyName.equalsIgnoreCase( "value" )) {
_value[0] =_defaultValue[0] = value.toString();
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- WebForm.java 1 Aug 2002 14:58:59 -0000 1.51
+++ WebForm.java 1 Aug 2002 20:23:16 -0000 1.52
@@ -413,6 +413,13 @@
public String getAction() { return WebForm.this.getAction(); }
public void setAction( String newAction ) { _action = newAction; }
+
+ public Object get( String propertyName ) {
+ final FormParameter parameter = getParameter( propertyName );
+ return parameter == UNKNOWN_PARAMETER ? null : parameter.getScriptableObject();
+ }
+
+
public void setParameterValue( String name, String value ) {
getParameter( name ).getScriptableObject().set( "value", value );
}
|