]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make LoginForm work inside iframes (#8144)
authorLeif Åstrand <leif@vaadin.com>
Fri, 3 Aug 2012 10:35:51 +0000 (10:35 +0000)
committerLeif Åstrand <leif@vaadin.com>
Fri, 3 Aug 2012 10:35:51 +0000 (10:35 +0000)
Automatic test case included but not enabled because it does not currently work with IE6-8

svn changeset:24053/svn branch:6.8

WebContent/statictestfiles/LoginFormIframe.html [new file with mode: 0644]
src/com/vaadin/ui/LoginForm.java
tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled [new file with mode: 0644]

diff --git a/WebContent/statictestfiles/LoginFormIframe.html b/WebContent/statictestfiles/LoginFormIframe.html
new file mode 100644 (file)
index 0000000..0d6ee9d
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>LoginForm</title>
+<script type="text/javascript">
+       window.name="LoginForm";
+</script>
+</head>
+<body>
+<p>Tests that LoginForm can be submitted even when the Application is embedded inside an iframe</p>
+<iframe src="/run/com.vaadin.tests.components.loginform.LoginFormTest?restartApplication" name="LoginForm" height="500px" width="500px"></iframe>
+</body>
+</html>
\ No newline at end of file
index 80e002435ed8c75e99f46256da7b7b2329d7d2ba..eb921e1e18c986128b59bdb691c4479a88018ee4 100644 (file)
@@ -94,8 +94,8 @@ public class LoginForm extends CustomComponent {
     };
 
     private URIHandler uriHandler = new URIHandler() {
-        private final String responce = "<html><body>Login form handeled."
-                + "<script type='text/javascript'>top.vaadin.forceSync();"
+        private final String response = "<html><body>Login form handeled."
+                + "<script type='text/javascript'>parent.parent.vaadin.forceSync();"
                 + "</script></body></html>";
 
         public DownloadStream handleURI(URL context, String relativeUri) {
@@ -104,7 +104,7 @@ public class LoginForm extends CustomComponent {
                     window.removeURIHandler(this);
                 }
                 DownloadStream downloadStream = new DownloadStream(
-                        new ByteArrayInputStream(responce.getBytes()),
+                        new ByteArrayInputStream(response.getBytes()),
                         "text/html", "loginSuccesfull");
                 downloadStream.setCacheTime(-1);
                 return downloadStream;
diff --git a/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled b/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled
new file mode 100644 (file)
index 0000000..075bb3c
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>LoginFormTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">LoginFormTest</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/statictestfiles/LoginFormIframe.html</td>
+       <td></td>
+</tr>
+<tr>
+       <td>selectFrame</td>
+       <td>LoginForm</td>
+       <td></td>
+</tr>
+<tr>
+       <td>selectFrame</td>
+       <td>PID6</td>
+       <td></td>
+</tr>
+<tr>
+       <td>enterCharacter</td>
+       <td>username</td>
+       <td>username</td>
+</tr>
+<tr>
+       <td>enterCharacter</td>
+       <td>password</td>
+       <td>password</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>//form[@id='loginf']/div[5]/div/span/span</td>
+       <td></td>
+</tr>
+<tr>
+       <td>selectFrame</td>
+       <td>relative=top</td>
+       <td></td>
+</tr>
+<tr>
+       <td>selectFrame</td>
+       <td>LoginForm</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+       <td>User 'username', password='password' logged in</td>
+</tr>
+</tbody></table>
+</body>
+</html>