[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.12,1.13
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-16 17:24:04
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv22152/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Peter Royal: fixed scripting disabled, query-only URL parsing bugs Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ScriptingTest.java 13 Aug 2002 20:00:39 -0000 1.12 +++ ScriptingTest.java 16 Aug 2002 17:24:01 -0000 1.13 @@ -19,13 +19,7 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ -import com.meterware.httpunit.HttpUnitTest; -import com.meterware.httpunit.WebConversation; -import com.meterware.httpunit.WebResponse; -import com.meterware.httpunit.WebForm; -import com.meterware.httpunit.WebLink; -import com.meterware.httpunit.WebImage; -import com.meterware.httpunit.WebRequest; +import com.meterware.httpunit.*; import junit.framework.TestSuite; import junit.textui.TestRunner; @@ -215,6 +209,25 @@ assertEquals( "initial parameter value", "blue", form.getParameterValue( "color" ) ); link.click(); assertEquals( "changed parameter value", "green", form.getParameterValue( "color" ) ); + } + + + public void testScriptDisabled() throws Exception { + HttpUnitOptions.setScriptingEnabled( false ); + defineResource( "nothing.html", "Should get here" ); + defineResource( "OnCommand.html", "<html><head></head>" + + "<body>" + + "<form name='realform'><input name='color' value='blue'></form>" + + "<a href='nothing.html' onClick=\"document.realform.color.value='green';return false;\">green</a>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + WebForm form = response.getFormWithName( "realform" ); + WebLink link = response.getLinks()[0]; + assertEquals( "initial parameter value", "blue", form.getParameterValue( "color" ) ); + link.click(); + assertEquals( "unchanged parameter value", "blue", form.getParameterValue( "color" ) ); + assertEquals( "Expected result", "Should get here", wc.getCurrentPage().getText() ); } |