[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.15,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-12-27 05:09:41
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv1498/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
Added JavaScript Form.target support
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FormScriptingTest.java 27 Nov 2002 15:06:41 -0000 1.15
+++ FormScriptingTest.java 27 Dec 2002 05:09:38 -0000 1.16
@@ -440,6 +440,26 @@
}
+ public void testFormTargetProperty() throws Exception {
+ WebConversation wc = new WebConversation();
+ defineWebPage( "Default", "<form method=GET name='the_form' action = 'ask'>" +
+ "<Input type=text name=age>" +
+ "<Input type=submit value=Go>" +
+ "</form>" +
+ "<a href='#' name='doTell' onClick='document.the_form.target=\"_blank\";'>tell</a>" +
+ "<a href='#' name='doShow' onClick='alert( document.the_form.target );'>show</a>" );
+ WebResponse page = wc.getResponse( getHostPath() + "/Default.html" );
+ page.getLinkWithName( "doShow" ).click();
+ assertEquals( "Initial target", "_top", wc.popNextAlert() );
+ page.getLinkWithName( "doTell" ).click();
+ page.getLinkWithName( "doShow" ).click();
+ assertEquals( "Current target", "_blank", wc.popNextAlert() );
+
+ WebRequest request = page.getForms()[0].getRequest();
+ assertEquals( "_blank", request.getTarget() );
+ }
+
+
public void testFormValidationOnSubmit() throws Exception {
defineResource( "doIt?color=pink", "You got it!", "text/plain" );
defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" +
|