diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-01-09 13:53:23 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-01-09 13:53:23 +0000 |
commit | 30f4d3ede40f95919a225a1f7f8bff182a1bf0e2 (patch) | |
tree | 6cbd35abff436c9dbaf132b32465cabdb5693f03 /uitest | |
parent | 1a20331682f4495509fa79ad54c96fe77de82eed (diff) | |
parent | 058224f31198b2a56fd7fd52e9a767909b58cd79 (diff) | |
download | vaadin-framework-30f4d3ede40f95919a225a1f7f8bff182a1bf0e2.tar.gz vaadin-framework-30f4d3ede40f95919a225a1f7f8bff182a1bf0e2.zip |
Merge "Merge of (#7842) to Vaadin 7."
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java | 74 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/window/PageOpenTest.java | 81 |
2 files changed, 155 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java new file mode 100644 index 0000000000..175c3f6d8a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.server.ExternalResource; +import com.vaadin.tests.TestForWindowOpen; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.LegacyWindow; + +public class LegacyWindowOpenTest extends TestBase { + + final ExternalResource r = new ExternalResource("http://www.google.com"); + + @Override + protected void setup() { + final LegacyWindow win = getMainWindow(); + + addComponent(new TestForWindowOpen()); + + addComponent(new Button("Window.open _blank always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.open(r, "_blank", true); + } + })); + + addComponent(new Button("Window.open _blank NOT always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.open(r, "_blank", false); + } + })); + + addComponent(new Button("Window.open _new always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.open(r, "_new", true); + } + })); + + addComponent(new Button("Window.open _new NOT always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.open(r, "_new", false); + } + })); + addComponent(new Button( + "Window execute Javascript window.open(www.google.com, _blank)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\");"); + } + })); + addComponent(new Button( + "Window execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\", \"resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes\");"); + } + })); + + } + + @Override + protected String getDescription() { + return "Windows never opened to a new tab"; + } + + @Override + protected Integer getTicketNumber() { + return 7842; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java new file mode 100644 index 0000000000..2dbc24cb66 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java @@ -0,0 +1,81 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.server.Page; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.TestForWindowOpen; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.JavaScript; + +public class PageOpenTest extends AbstractTestUI { + + final String url = "http://www.google.com"; + + @Override + protected void setup(VaadinRequest request) { + final Page page = getPage(); + + addComponent(new TestForWindowOpen()); + + addComponent(new Button("Page.open _blank always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + page.open(url, "_blank", true); + } + })); + + addComponent(new Button("Page.open _blank NOT always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + page.open(url, "_blank", false); + } + })); + + addComponent(new Button("Page.open _new always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + page.open(url, "_new", true); + } + })); + + addComponent(new Button("Page.open _new NOT always as popup", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + page.open(url, "_new", false); + } + })); + addComponent(new Button( + "Execute Javascript window.open(www.google.com, _blank)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + JavaScript + .getCurrent() + .execute( + "window.open(\"http://www.google.com\", \"_blank\");"); + } + })); + addComponent(new Button( + "Execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + JavaScript + .getCurrent() + .execute( + "window.open(\"http://www.google.com\", \"_blank\", \"resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes\");"); + } + })); + + } + + @Override + protected String getTestDescription() { + return "Windows never opened to a new tab"; + } + + @Override + protected Integer getTicketNumber() { + return 7842; + } + +} |