[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.43,1.44
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-11-13 13:36:42
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv3125/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Support location.href
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ScriptingTest.java 3 Nov 2002 06:31:14 -0000 1.43
+++ ScriptingTest.java 13 Nov 2002 13:36:39 -0000 1.44
@@ -369,16 +369,25 @@
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)'>" +
+ defineResource( "location.js", "function show() {" +
+ "alert('Window location is ' + window.location);" +
+ "alert('Document location is ' + document.location);" +
+ "alert('Window location.href is ' + window.location.href);" +
+ "}" );
+ defineResource( "OnCommand.html", "<html><head><title>Amazing!</title>" +
+ "<script language='JavaScript' src='location.js'></script>" +
+ "</head>" +
+ "<body onLoad='show()'>" +
"<a href='#' onMouseOver=\"window.location='" + getHostPath() + "/Target.html';\">go</a>" +
"<a href='#' onMouseOver=\"document.location='" + getHostPath() + "/Target.html';\">go</a>" +
"<a href='#' onMouseOver=\"document.location.replace('" + getHostPath() + "/Target.html');\">go</a>" +
+ "<a href='#' onMouseOver=\"window.location.href='" + 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() );
+ assertEquals( "Alert message 1", "Window location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
+ assertEquals( "Alert message 2", "Document location is " + getHostPath() + "/OnCommand.html", wc.popNextAlert() );
+ assertEquals( "Alert message 3", "Window location.href 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() );
@@ -392,6 +401,11 @@
response.getLinks()[2].mouseOver();
assertEquals( "4th page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
assertEquals( "4th page", "You made it!", wc.getCurrentPage().getText() );
+
+ response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[3].mouseOver();
+ assertEquals( "5th page URL", getHostPath() + "/Target.html", wc.getCurrentPage().getURL().toExternalForm() );
+ assertEquals( "5th page", "You made it!", wc.getCurrentPage().getText() );
}
|