[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebFormTest.java,1.14,1.15
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2001-12-11 21:41:52
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv23428/test/com/meterware/httpunit Modified Files: WebFormTest.java Log Message: Added test for textarea name prefix lookup Index: WebFormTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- WebFormTest.java 2001/11/05 18:54:51 1.14 +++ WebFormTest.java 2001/12/11 21:41:38 1.15 @@ -109,16 +109,24 @@ public void testFormParameters() throws Exception { - WebForm form = _wc.getResponse( getHostPath() + "/OneForm.html" ).getForms()[0]; + defineWebPage( "AForm", "<h2>Login required</h2>" + + "<form method=POST action = \"/servlet/Login\"><B>" + + "Enter the name 'master': <textarea Name=name>Something</textarea></B>" + + "<input type=\"checkbox\" name=first>Disabled" + + "<input type=\"checkbox\" name=second checked>Enabled" + + "<br><Input type=submit value = \"Log in\">" + + "</form>" ); + + WebForm form = _wc.getResponse( getHostPath() + "/AForm.html" ).getForms()[0]; String[] parameters = form.getParameterNames(); assertNotNull( parameters ); - assertEquals( 3, parameters.length ); - assertEquals( "name", parameters[0] ); + assertMatchingSet( "form parameter names", new String[] { "first", "name", "second" }, parameters ); assertEquals( "First checkbox", "", form.getParameterValue( "first" ) ); assertEquals( "Second checkbox", "on", form.getParameterValue( "second" ) ); assertTrue( "Did not find parameter 'first'", form.hasParameterNamed( "first" ) ); assertTrue( "Did not find parameter with prefix 'sec'", form.hasParameterStartingWithPrefix( "sec" ) ); + assertTrue( "Did not find parameter with prefix 'nam'", form.hasParameterStartingWithPrefix( "nam" ) ); } |