diff options
author | Anna Koskinen <anna@vaadin.com> | 2013-01-09 15:51:52 +0200 |
---|---|---|
committer | Anna Koskinen <anna@vaadin.com> | 2013-01-09 15:51:52 +0200 |
commit | 058224f31198b2a56fd7fd52e9a767909b58cd79 (patch) | |
tree | 53fa880a87901515667b17014dcc145659c1d088 /uitest/src/com | |
parent | 97b03bae695663ee4924d82fa97af54f89a841ae (diff) | |
download | vaadin-framework-058224f31198b2a56fd7fd52e9a767909b58cd79.tar.gz vaadin-framework-058224f31198b2a56fd7fd52e9a767909b58cd79.zip |
Merge of (#7842) to Vaadin 7.
Windows never opened to a new tab.
Change-Id: Ida874c55bbb00325edf49d4ebf27067d99d056b8
Diffstat (limited to 'uitest/src/com')
-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; + } + +} |