diff options
3 files changed, 78 insertions, 3 deletions
diff --git a/WebContent/statictestfiles/LoginFormIframe.html b/WebContent/statictestfiles/LoginFormIframe.html new file mode 100644 index 0000000000..0d6ee9d86b --- /dev/null +++ b/WebContent/statictestfiles/LoginFormIframe.html @@ -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 diff --git a/src/com/vaadin/ui/LoginForm.java b/src/com/vaadin/ui/LoginForm.java index 80e002435e..eb921e1e18 100644 --- a/src/com/vaadin/ui/LoginForm.java +++ b/src/com/vaadin/ui/LoginForm.java @@ -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 index 0000000000..075bb3c57f --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/loginform/LoginFormInIframe.html_disabled @@ -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> |