[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.18,1.19
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-30 18:17:51
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv5119/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Added support for location property Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ScriptingTest.java 30 Aug 2002 15:20:09 -0000 1.18 +++ ScriptingTest.java 30 Aug 2002 18:17:48 -0000 1.19 @@ -178,6 +178,28 @@ } + public void testLocationProperty() throws Exception { + defineResource( "Target.html", "You made it!" ); + defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" + + "<body onLoad='alert(\"Window location is \" + window.location);alert(\"Document location is \" + document.location)'>" + + "<a href='#' onMouseOver=\"window.location='" + getHostPath() + "/Target.html';\">go</a>" + + "<a href='#' onMouseOver=\"document.location='" + getHostPath() + "/Target.html';\">go</a>" + + "</body>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + assertEquals( "Alert message", "Window location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() ); + assertEquals( "Alert message", "Document location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() ); + response.getLinks()[0].mouseOver(); + assertEquals( "2nd page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() ); + assertEquals( "2nd page", "You made it!", wc.getCurrentPage().getText() ); + + response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + response.getLinks()[1].mouseOver(); + assertEquals( "3rd page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() ); + assertEquals( "3rd page", "You made it!", wc.getCurrentPage().getText() ); + } + + public void testDocumentFindForms() throws Exception { defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + "function getFound( object ) {" + |