[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.27,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-03-09 20:56:24
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26914/test/com/meterware/httpunit/javascript Modified Files: FormScriptingTest.java Log Message: enable setting the control 'disabled' attribute from javascript Index: FormScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- FormScriptingTest.java 3 Mar 2004 02:20:11 -0000 1.27 +++ FormScriptingTest.java 9 Mar 2004 20:31:03 -0000 1.28 @@ -298,6 +298,33 @@ } } + public void testEnablingDisabledRadioButtonViaScript() throws Exception { + defineResource( "OnCommand.html", "<html><head></head>" + + "<body>" + + "<form name=spectrum action='DoIt'>" + + "<input type='radio' name='color' value='red' checked>" + + "<input type='radio' name='color' value='green' disabled>" + + "<input type=button name=enableChange id=enableChange value=Hello onClick='document.spectrum.color[1].disabled=false;'>" + + "<input type=submit name=change value=success>" + + "</form>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + WebForm form = response.getFormWithName( "spectrum" ); + + assertMatchingSet( "Color choices", new String[] { "red" }, form.getOptionValues( "color" ) ); + try { + form.setParameter( "color", "green" ); + fail( "Should not have been able to set color" ); + } catch (Exception e) {} + + form.getScriptableObject().doEvent( "document.spectrum.color[1].disabled=false" ); + + assertMatchingSet( "Color choices", new String[] { "red", "green" }, form.getOptionValues( "color" ) ); + form.setParameter( "color", "green" ); + } + + public void testSubmitViaScriptWithPostParams() throws Exception { defineResource( "/servlet/TestServlet?param3=value3¶m4=value4", new PseudoServlet() { public WebResource getPostResponse() throws IOException { |