[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebLink.java,1.35,1.36
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-11-17 13:57:50
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv13800/src/com/meterware/httpunit
Modified Files:
WebLink.java
Log Message:
637208: Link.click() no longer returns null
Index: WebLink.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- WebLink.java 15 Nov 2002 03:06:10 -0000 1.35
+++ WebLink.java 17 Nov 2002 13:57:47 -0000 1.36
@@ -78,13 +78,17 @@
/**
* Submits a request as though the user had clicked on this link. Will also fire the 'onClick' event if defined.
- * If clicking results in submitting a request, will return the result of that submission; otherwise, will
- * return the updated contents of the frame containing this link.
+ * If clicking results in submitting a request (that is, there is no 'onClick' event or it returns true,
+ * this method will return the result of that submission; otherwise, it will
+ * return the updated contents of the frame containing this link. Note that if an event updates a different frame
+ * that frame will not be returned by this method.
**/
public WebResponse click() throws IOException, SAXException {
+ WebResponse response = null;
String event = getAttribute( "onclick" );
- if (event.length() == 0 || getScriptableObject().doEvent( event )) return submitRequest();
- return getBaseResponse().getWindow().getFrameContents( getTarget() );
+ if (event.length() == 0 || getScriptableObject().doEvent( event )) response = submitRequest();
+ if (response == null) response = getBaseResponse().getWindow().getFrameContents( getTarget() );
+ return response;
}
|