Revision: 597
          http://svn.sourceforge.net/jwebunit/?rev=597&view=rev
Author:   henryju
Date:     2006-11-05 07:13:04 -0800 (Sun, 05 Nov 2006)

Log Message:
-----------
Add unit test for Javascript prompt.

Modified Paths:
--------------
    
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/JavaScriptTest.java

Added Paths:
-----------
    
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/JavaScriptTest/Prompt.html

Modified: 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/JavaScriptTest.java
===================================================================
--- 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/JavaScriptTest.java
        2006-11-05 14:14:36 UTC (rev 596)
+++ 
branches/1.x/jwebunit-commons-tests/src/main/java/net/sourceforge/jwebunit/tests/JavaScriptTest.java
        2006-11-05 15:13:04 UTC (rev 597)
@@ -6,7 +6,6 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import net.sourceforge.jwebunit.exception.UnexpectedJavascriptAlertException;
 import net.sourceforge.jwebunit.tests.util.JettySetup;
 
 /**
@@ -57,4 +56,16 @@
         assertLinkPresent("Toto");
         assertLinkNotPresent("Titi");
     }
+
+    public void testPrompt() {
+       setExpectedJavaScriptPrompt("Foo Bar", "toto");
+        beginAt("Prompt.html");
+        assertTextPresent("Toto");
+    }
+
+    public void testPromptCanceled() {
+       setExpectedJavaScriptPrompt("Foo Bar", null);
+        beginAt("Prompt.html");
+        assertTextPresent("Cancel");
+    }
 }

Added: 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/JavaScriptTest/Prompt.html
===================================================================
--- 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/JavaScriptTest/Prompt.html
                         (rev 0)
+++ 
branches/1.x/jwebunit-commons-tests/src/main/resources/testcases/JavaScriptTest/Prompt.html
 2006-11-05 15:13:04 UTC (rev 597)
@@ -0,0 +1,16 @@
+<HTML>
+<BODY>
+<SCRIPT LANGUAGE="javascript">
+                   var tmp = prompt("Foo Bar");
+                       if (tmp=="toto") {
+                               document.write("Toto");
+                       }
+                       else if (tmp==null) {
+                               document.write("Cancel");
+                       }
+                       else {
+                               document.write("Titi");
+                       }
+               </SCRIPT>
+</BODY>
+<HTML>
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to