diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-08-03 16:26:51 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-08-03 16:26:51 +0300 |
commit | 20af2f5623d264a418f73cd9cd053462227d0eb4 (patch) | |
tree | f1bf285158d8e23579667d4c2afcf0704288c756 /tests/testbench/com | |
parent | 94f81dc79526a257451c6638a0696e7505227cb7 (diff) | |
download | vaadin-framework-20af2f5623d264a418f73cd9cd053462227d0eb4.tar.gz vaadin-framework-20af2f5623d264a418f73cd9cd053462227d0eb4.zip |
Support getting translated urls in javascript (#9209)
Diffstat (limited to 'tests/testbench/com')
3 files changed, 80 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.html b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.html new file mode 100644 index 0000000000..16e74aa485 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.html @@ -0,0 +1,62 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.javascriptcomponent.BasicJavaScriptComponent?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td> + <td>3. Got callback message: Callback message processed</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1]</td> + <td>2. Got RPC message: RPC message processed</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[2]</td> + <td>1. Parent ids checked</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>Component caption</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/JavaScriptWidget[0]/domChild[0]</td> + <td>4. Url: /run/com.vaadin.tests.components.javascriptcomponent.BasicJavaScriptComponent/APP/1/test</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/JavaScriptWidget[0]/domChild[1]</td> + <td>3. State message: Second state message</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/JavaScriptWidget[0]/domChild[2]</td> + <td>2. State message: First state message</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentsjavascriptcomponentBasicJavaScriptComponent::/VVerticalLayout[0]/VVerticalLayout[0]/JavaScriptWidget[0]/domChild[3]</td> + <td>1. Parent element className: v-verticallayout v-connector v-has-width</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java index 7de2d13663..9ea61b92bb 100644 --- a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java +++ b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java @@ -12,8 +12,11 @@ import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; import com.vaadin.shared.communication.ClientRpc; import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.communication.URLReference; import com.vaadin.shared.ui.JavaScriptComponentState; +import com.vaadin.terminal.ClassResource; import com.vaadin.terminal.WrappedRequest; +import com.vaadin.terminal.gwt.server.ResourceReference; import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.tests.util.Log; import com.vaadin.ui.AbstractJavaScriptComponent; @@ -28,6 +31,7 @@ public class BasicJavaScriptComponent extends AbstractTestRoot { public static class TestState extends JavaScriptComponentState { private List<String> messages = new ArrayList<String>(); + private URLReference url; public List<String> getMessages() { return messages; @@ -36,6 +40,14 @@ public class BasicJavaScriptComponent extends AbstractTestRoot { public void setMessages(List<String> messages) { this.messages = messages; } + + public URLReference getUrl() { + return url; + } + + public void setUrl(URLReference url) { + this.url = url; + } } @JavaScript("BasicJavaScriptComponentConnector.js") @@ -83,6 +95,9 @@ public class BasicJavaScriptComponent extends AbstractTestRoot { .setMessages( Arrays.asList("First state message", "Second state message")); + ClassResource resource = new ClassResource("test", + BasicJavaScriptComponent.this.getApplication()); + getState().setUrl(new ResourceReference(resource)); } @Override diff --git a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentConnector.js b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentConnector.js index 4e9c5280b3..fe8367d18a 100644 --- a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentConnector.js +++ b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponentConnector.js @@ -23,6 +23,9 @@ window.com_vaadin_tests_components_javascriptcomponent_BasicJavaScriptComponent_ for(var i = 0; i < messages.length; i++) { log("State message: " + messages[i]); } + + var url = this.getState().url; + log("Url: " + this.translateVaadinUri(url.uRL)); //Strange format, see #9210 } this.registerRpc({ |