[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.23,1.24
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-09-26 18:22:35
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv29024/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Don't URL-encode javascript URLs Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ScriptingTest.java 25 Sep 2002 16:20:53 -0000 1.23 +++ ScriptingTest.java 26 Sep 2002 18:22:33 -0000 1.24 @@ -81,7 +81,7 @@ } - public void testJavaScriptURLWithParameters() throws Exception { + public void testJavaScriptURLWithVariables() throws Exception { defineResource( "OnCommand.html", "<html><head></head>" + "<body>" + "<a href='javascript:\"Our winner is... \" + document.the_form.winner.value'>go</a>" + @@ -92,6 +92,22 @@ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); response.getLinks()[0].click(); assertEquals( "New page", "Our winner is... George of the Jungle", wc.getCurrentPage().getText() ); + } + + + public void testJavaScriptURLWithQuestionMark() throws Exception { + defineResource( "/appname/HandleAction/report?type=C", "You made it!" ); + defineResource( "OnCommand.html", "<html><head></head>" + + "<body>" + + "<a href=\"javascript:redirect('/appname/HandleAction/report?type=C')\">go</a>" + + "<script language='JavaScript'>" + + " function redirect( url ) { window.location=url; }" + + "</script>" + + "</form></body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + response.getLinks()[0].click(); + assertEquals( "New page", "You made it!", wc.getCurrentPage().getText() ); } |