[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.2,1.
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-20 15:09:32
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv32474/test/com/meterware/httpunit/javascript Modified Files: FormScriptingTest.java ScriptingTest.java Log Message: Force graceful degregation when Rhino is missing Index: FormScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FormScriptingTest.java 19 Aug 2002 18:52:26 -0000 1.2 +++ FormScriptingTest.java 20 Aug 2002 15:09:28 -0000 1.3 @@ -107,11 +107,28 @@ defineResource( "DoIt?color=green", "You made it!" ); defineResource( "OnCommand.html", "<html><head></head>" + "<body>" + - "<form name=spectrum action='DoIt'>" + + "<form name=spectrum action='DoIt' onsubmit='return false;'>" + " <input type=text name=color value=green>" + " <input type=button id=submit value=submit onClick='this.form.submit();'>" + "</form>" + "<a href='#' onClick='document.spectrum.submit(); return false;'>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + + response.getFormWithName( "spectrum" ).getButtons()[0].click(); + assertEquals( "Result of submit", "You made it!", wc.getCurrentPage().getText() ); + } + + + public void testUpdateBeforeSubmit() throws Exception { + defineResource( "DoIt?color=green", "You made it!" ); + defineResource( "OnCommand.html", "<html><head></head>" + + "<body>" + + "<form name=spectrum action='DoIt'>" + + " <input type=text name=color value=red>" + + " <input type=submit onClick='form.color.value=\"green\";'>" + + "</form>" + "</body></html>" ); WebConversation wc = new WebConversation(); WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ScriptingTest.java 16 Aug 2002 18:52:51 -0000 1.14 +++ ScriptingTest.java 20 Aug 2002 15:09:28 -0000 1.15 @@ -59,9 +59,9 @@ public void testFunctionCallOnLoad() throws Exception { defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + - // "<!-- " + + "<!-- " + "function sayCheese() { alert( \"Cheese!\" ); }" + - // "// -->" + + "// -->" + "</script></head>" + "<body onLoad='sayCheese()'></body>" ); WebConversation wc = new WebConversation(); |