[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.22,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-05-23 21:55:16
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv20521/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
bug #721989: support control ids as javascript element references
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- FormScriptingTest.java 23 May 2003 03:09:27 -0000 1.22
+++ FormScriptingTest.java 23 May 2003 21:55:12 -0000 1.23
@@ -232,7 +232,7 @@
}
- public void testSubmitButtonScript() throws Exception { // XXX not sure this is the desired behavior
+ public void testSubmitButtonScript() throws Exception {
defineResource( "DoIt?color=green", "You made it!" );
defineResource( "OnCommand.html", "<html><head></head>" +
"<body>" +
@@ -792,5 +792,33 @@
}
+ public void testElementsByIDProperty() throws Exception {
+ defineResource( "index.html", "<html>\n" +
+ "<head>\n" +
+ "<title>JavaScript Form Elements by ID String Test</title>\n" +
+ "<script language='JavaScript' type='text/javascript'><!--\n" +
+ "function foo() {\n" +
+ " if (document.forms['formName']) {\n" +
+ " var form = document.forms['formName'];\n" +
+ " if (form.elements['inputID']) {\n" +
+ " form.elements['inputID'].value = 'Hello World!';\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "// --></script>\n" +
+ "</head>\n" +
+ "<body onLoad='foo();'>\n" +
+ "<h1>JavaScript Form Elements by ID String Test</h1>\n" +
+ "<form name='formName'>\n" +
+ " <input type='text' name='inputName' value='' id='inputID'>\n" +
+ "</form>\n" +
+ "</body>\n" +
+ "</html>\n"
+ );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/index.html" );
+ WebForm form = response.getFormWithName( "formName" );
+ assertEquals( "Changed value", "Hello World!", form.getParameterValue( "inputName" ) );
+ }
}
|