diff options
author | Artur <artur@vaadin.com> | 2017-03-27 11:14:49 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-03-27 11:14:49 +0300 |
commit | 2fe4c50ac802533e0057ebb8ce0c3c5d1bf50b4b (patch) | |
tree | ab820fb9a2e138476ea6a75fd89d1e88a40090d2 /uitest | |
parent | 9b7d34fc41c0e088069455639cca2f32750291f6 (diff) | |
download | vaadin-framework-2fe4c50ac802533e0057ebb8ce0c3c5d1bf50b4b.tar.gz vaadin-framework-2fe4c50ac802533e0057ebb8ce0c3c5d1bf50b4b.zip |
Use computed style for Escalator size calculations (#8861)
* Use computed style for Escalator size calculations
The old method of using getBoundingClientRect does not work as expected
if a transform has been applied to the element or one of its parents.
For instance PopupView animates itself using a scale(0) -> scale(1)
animation. When scale(0) is active, getBoundingClientRect will return 0
for all sizes while computed style ignores the transform and returns the
expected value.
Fixes #8793
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridPopupView.java | 26 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java | 58 |
2 files changed, 84 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridPopupView.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridPopupView.java new file mode 100644 index 0000000000..3d27f60e38 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridPopupView.java @@ -0,0 +1,26 @@ +package com.vaadin.tests.components.grid; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Grid; +import com.vaadin.ui.PopupView; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class GridPopupView extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest vaadinRequest) { + Grid<String> grid = new Grid<>(); + grid.setItems("Foo", "Bar", "Baz"); + + PopupView popupView = new PopupView( + "Show grid (click me multiple times)", grid); + popupView.setHideOnMouseOut(false); + + grid.addColumn(str -> str).setCaption("Something"); + + addComponent(popupView); + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java new file mode 100644 index 0000000000..06169337a5 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridPopupViewTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2000-2016 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.grid; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.testbench.elements.PopupViewElement; +import com.vaadin.testbench.parallel.Browser; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridPopupViewTest extends MultiBrowserTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> l = getBrowserCapabilities(Browser.IE11, + Browser.FIREFOX, Browser.CHROME); + l.add(PHANTOMJS2()); + return l; + } + + @Test + public void gridSizeCorrect() { + openTestURL(); + PopupViewElement pv = $(PopupViewElement.class).first(); + + for (int i = 0; i < 3; i++) { + pv.click(); + GridElement grid = $(GridElement.class).first(); + Dimension rect = grid.getCell(0, 0).getSize(); + Assert.assertEquals(500, rect.width); + Assert.assertEquals(38, rect.height); + findElement(By.className("v-ui")).click(); + Assert.assertTrue($(GridElement.class).all().isEmpty()); + } + + } + +} |