diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2018-05-03 12:22:36 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-05-03 12:22:35 +0300 |
commit | 1d6002baf96ec0cc4cb6aff7336af8fa94f57c63 (patch) | |
tree | 925fccb5ddb4e9eca097923c903890869232a96f /uitest | |
parent | 4b9e102a2e03558df224cec73c21077eb7368ad1 (diff) | |
download | vaadin-framework-1d6002baf96ec0cc4cb6aff7336af8fa94f57c63.tar.gz vaadin-framework-1d6002baf96ec0cc4cb6aff7336af8fa94f57c63.zip |
Fix Window layout when resizing (#10830)
Fixes #10652
Diffstat (limited to 'uitest')
3 files changed, 97 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowTwinColSelect.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowTwinColSelect.java new file mode 100644 index 0000000000..0833a7d93e --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowTwinColSelect.java @@ -0,0 +1,41 @@ +package com.vaadin.tests.components.window; + +import java.util.Arrays; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.TwinColSelect; +import com.vaadin.ui.Window; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class WindowTwinColSelect extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final TwinColSelect<String> testScroll = new TwinColSelect<>(); + testScroll.setItems(Arrays.asList("Option1", "Option2")); + testScroll.setRows(10); + testScroll.setSizeFull(); + testScroll.setHeightUndefined(); + + Window window = new Window(); + window.setHeight("200px"); + window.setWidth("400px"); + window.setModal(true); + window.setContent(testScroll); + addWindow(window); + window.center(); + } + + @Override + protected String getTestDescription() { + return "Scroll bar shouldn't interfere with how " + + "full-size TwinColSelect contents are displayed."; + } + + @Override + protected Integer getTicketNumber() { + return 10652; + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java index c4cb78eeef..878314f284 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java @@ -3,8 +3,11 @@ package com.vaadin.tests.components.window; import static com.vaadin.tests.components.window.ComboboxScrollableWindow.COMBOBOX_ID; import static com.vaadin.tests.components.window.ComboboxScrollableWindow.WINDOW_ID; +import java.util.List; + import org.junit.Test; import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; import com.vaadin.testbench.By; import com.vaadin.testbench.commands.TestBenchElementCommands; @@ -19,6 +22,12 @@ import com.vaadin.tests.tb3.MultiBrowserTest; */ public class ComboboxScrollableWindowTest extends MultiBrowserTest { + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + // Fix to #10652 broke this for PhantomJS + return getBrowsersExcludingPhantomJS(); + } + @Test public void testWindowScrollbars() throws Exception { openTestURL(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java b/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java new file mode 100644 index 0000000000..829632023e --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java @@ -0,0 +1,47 @@ +package com.vaadin.tests.components.window; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.TwinColSelectElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class WindowTwinColSelectTest extends MultiBrowserTest { + + @Test + public void testBothVisibleInitially() { + openTestURL(); + TwinColSelectElement twinColSelect = $(TwinColSelectElement.class) + .first(); + WebElement optionsElement = twinColSelect.getOptionsElement(); + WebElement selectionsElement = twinColSelect.getSelectionsElement(); + assertTrue(optionsElement.isDisplayed()); + assertTrue(selectionsElement.isDisplayed()); + assertThat(selectionsElement.getLocation().getY(), + is(optionsElement.getLocation().getY())); + } + + @Test + public void testBothVisibleAfterResize() { + openTestURL(); + waitForElementPresent(By.className("v-window-resizebox")); + TwinColSelectElement twinColSelect = $(TwinColSelectElement.class) + .first(); + new Actions(getDriver()) + .moveToElement(findElement(By.className("v-window-resizebox"))) + .clickAndHold().moveByOffset(-30, -30).release().build() + .perform(); + WebElement optionsElement = twinColSelect.getOptionsElement(); + WebElement selectionsElement = twinColSelect.getSelectionsElement(); + assertTrue(optionsElement.isDisplayed()); + assertTrue(selectionsElement.isDisplayed()); + assertThat(selectionsElement.getLocation().getY(), + is(optionsElement.getLocation().getY())); + } +} |