From f10c0dcc7ebbafccbf0e037432dc2c75949e8e67 Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Fri, 5 May 2017 11:02:05 +0300 Subject: Allow Escalator.setHeightByRows to accept zero as a valid argument (#9244) --- .../java/com/vaadin/client/widgets/Escalator.java | 2 +- .../tests/components/tree/TreeDefaultConstructor.java | 13 +++++++++++++ .../components/tree/TreeDefaultConstructorTest.java | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 uitest/src/main/java/com/vaadin/tests/components/tree/TreeDefaultConstructor.java create mode 100644 uitest/src/test/java/com/vaadin/tests/components/tree/TreeDefaultConstructorTest.java diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index d85dd7054b..7d2ca986a7 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -6461,7 +6461,7 @@ public class Escalator extends Widget * @see #setHeightMode(HeightMode) */ public void setHeightByRows(double rows) throws IllegalArgumentException { - if (rows <= 0) { + if (rows < 0) { throw new IllegalArgumentException( "The number of rows must be a positive number."); } else if (Double.isInfinite(rows)) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeDefaultConstructor.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeDefaultConstructor.java new file mode 100644 index 0000000000..831f80e521 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeDefaultConstructor.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.components.tree; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Tree; + +public class TreeDefaultConstructor extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addComponent(new Tree<>()); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeDefaultConstructorTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeDefaultConstructorTest.java new file mode 100644 index 0000000000..8f55f800e9 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeDefaultConstructorTest.java @@ -0,0 +1,19 @@ +package com.vaadin.tests.components.tree; + +import static org.junit.Assert.assertFalse; + +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class TreeDefaultConstructorTest extends SingleBrowserTest { + + @Test + public void default_constructor_no_exceptions() { + setDebug(true); + openTestURL(); + assertNoErrorNotifications(); + assertFalse(isElementPresent(By.className("v-errorindicator"))); + } +} -- cgit v1.2.3