Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv4813/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Added JavaScript support for text field values
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ScriptingTest.java 24 Jul 2002 20:54:31 -0000 1.1
+++ ScriptingTest.java 1 Aug 2002 20:23:16 -0000 1.2
@@ -22,6 +22,7 @@
import com.meterware.httpunit.HttpUnitTest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;
+import com.meterware.httpunit.WebForm;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
@@ -104,6 +105,19 @@
assertEquals( "Alert message", "found form 'realform'", response.popNextAlert() );
assertEquals( "Alert message", "did not find form 'noform'", response.popNextAlert() );
assertNull( "Alert should have been removed", response.getNextAlert() );
+ }
+
+
+ public void testSetFormFieldValue() throws Exception {
+ defineResource( "OnCommand.html", "<html><head></head>" +
+ "<body onLoad=\"document.realform.color.value='green'\">" +
+ "<form name='realform'><input name='color' value='blue'></form>" +
+ "</body></html>" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ JavaScript.run( response );
+ WebForm form = response.getFormWithName( "realform" );
+ assertEquals( "color parameter value", "green", form.getParameterValue( "color" ) );
}
|