[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.34,1.35
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-10-10 20:20:39
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv14389/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
Corrected reversed Window.open params
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ScriptingTest.java 9 Oct 2002 17:16:31 -0000 1.34
+++ ScriptingTest.java 10 Oct 2002 20:20:37 -0000 1.35
@@ -226,7 +226,7 @@
defineResource( "Target.html", "You made it!" );
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
"<body>" +
- "<a href='#' onClick=\"window.open( 'sample', '" + getHostPath() + "/Target.html' );\">go</a>" +
+ "<a href='#' onClick=\"window.open( '" + getHostPath() + "/Target.html', 'sample' );\">go</a>" +
"</body></html>" );
final ArrayList windowsOpened = new ArrayList();
WebConversation wc = new WebConversation();
@@ -244,10 +244,9 @@
public void testWindowOpenNoContents() throws Exception {
- defineResource( "Target.html", "You made it!" );
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
"<body>" +
- "<a href='#' onClick=\"window.open( 'sample' );\">go</a>" +
+ "<a href='#' onClick=\"window.open( null, 'sample' );\">go</a>" +
"</body></html>" );
final ArrayList windowsOpened = new ArrayList();
WebConversation wc = new WebConversation();
@@ -269,8 +268,8 @@
defineResource( "Revise.html", "You changed it!" );
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
"<body>" +
- "<a href='#' onClick=\"window.open( 'sample', '" + getHostPath() + "/Target.html' );\">go</a>" +
- "<a href='#' onClick=\"window.open( 'sample', '" + getHostPath() + "/Revise.html' );\">go</a>" +
+ "<a href='#' onClick=\"window.open( '" + getHostPath() + "/Target.html', 'sample' );\">go</a>" +
+ "<a href='#' onClick=\"window.open( '" + getHostPath() + "/Revise.html', 'sample' );\">go</a>" +
"</body></html>" );
final ArrayList windowsOpened = new ArrayList();
WebConversation wc = new WebConversation();
@@ -297,13 +296,14 @@
"</script></head><body onload='show_properties()'>" +
"</body></html>" );
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
- "<body onload='window.name=\"main\"'>" +
- "<a href='#' onClick=\"window.open( 'sample', '" + getHostPath() + "/Target.html' );\">go</a>" +
+ "<body onload=\"window.name='main'; alert ('opener ' + (window.opener ? 'found' : 'not defined') );\">" +
+ "<a href='#' onClick=\"window.open( '" + getHostPath() + "/Target.html', 'sample' );\">go</a>" +
"</body></html>" );
final ArrayList windowsOpened = new ArrayList();
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
assertEquals( "main window name", "main", wc.getMainWindow().getName() );
+ assertEquals( "main window alert", "opener not defined", wc.popNextAlert() );
response.getLinks()[0].click();
assertEquals( "1st alert", "name=sample", wc.popNextAlert() );
|