diff options
author | Artur Signell <artur@vaadin.com> | 2015-08-03 23:02:47 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-08-04 13:15:47 +0000 |
commit | 50e13188aa372b0ad50c7279bcb3f18706897c23 (patch) | |
tree | b05bb4307d5768e37629b1c2ce0ac307930d8087 /uitest/src/com | |
parent | 3951ba9c2d751e3719699c546f530859d2b593ee (diff) | |
download | vaadin-framework-50e13188aa372b0ad50c7279bcb3f18706897c23.tar.gz vaadin-framework-50e13188aa372b0ad50c7279bcb3f18706897c23.zip |
Attach Window in hierarchy change as required (#18502)
Change-Id: Ia9ca393480b80c19e5391bce034534bde31f3a81
Diffstat (limited to 'uitest/src/com')
3 files changed, 95 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindow.java b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java new file mode 100644 index 0000000000..918a991cc1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.window; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Window; + +public class GridInWindow extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + final Grid grid = new Grid(); + + grid.addColumn("Hidable column").setHidable(true); + grid.addRow("Close and reopen and it vanishes"); + + Button popupButton = new Button("Open PopUp", + new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + Window subWindow = new Window("Sub-window"); + subWindow.setContent(grid); + subWindow.setWidth(600, Unit.PIXELS); + subWindow.setWidth(400, Unit.PIXELS); + getUI().addWindow(subWindow); + } + }); + + addComponent(popupButton); + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java new file mode 100644 index 0000000000..301a7c60e4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.window; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.SingleBrowserTest; +import com.vaadin.tests.tb3.newelements.WindowElement; + +public class GridInWindowTest extends SingleBrowserTest { + + @Test + public void ensureAttachInHierachyChange() { + openTestURL("debug"); + $(ButtonElement.class).first().click(); + assertNoErrorNotifications(); + $(WindowElement.class).first().close(); + assertNoErrorNotifications(); + $(ButtonElement.class).first().click(); + assertNoErrorNotifications(); + } +} diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java index 34344324d0..784d203ab0 100644 --- a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java +++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java @@ -14,6 +14,7 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement { private final String restoreBoxClass = "v-window-restorebox"; private final String maximizeBoxClass = "v-window-maximizebox"; + private final String closeBoxClass = "v-window-closebox"; public void restore() { if (isMaximized()) { @@ -63,4 +64,13 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement { public String getCaption() { return findElement(By.className("v-window-header")).getText(); } + + private WebElement getCloseButton() { + return findElement(By.className(closeBoxClass)); + } + + public void close() { + getCloseButton().click(); + + } } |