summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-09-21 10:41:28 +0300
committerVaadin Code Review <review@vaadin.com>2016-09-22 12:55:13 +0000
commitf12fbfb7044defc8442d05e6810c43875c04710c (patch)
tree26b47b9ddb48da84001ebb582a34acff5ef0042c /uitest
parentab1fd8a7be62a2381d2aa8c5434db9c39acaad9d (diff)
downloadvaadin-framework-f12fbfb7044defc8442d05e6810c43875c04710c.tar.gz
vaadin-framework-f12fbfb7044defc8442d05e6810c43875c04710c.zip
Re-add back Form to compatibility package (#296).
Change-Id: Id187402e78e3c368ae6530f7b7ea68d2e6c4a6ca
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java58
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContent.java60
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java60
-rw-r--r--uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java34
4 files changed, 212 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java b/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java
new file mode 100644
index 0000000000..75688dfdb9
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/form/FormTooltips.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2012 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.v7.tests.components.form;
+
+import java.util.Arrays;
+
+import com.vaadin.server.UserError;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.tests.data.bean.Sex;
+import com.vaadin.v7.data.util.BeanItem;
+import com.vaadin.v7.ui.Form;
+import com.vaadin.v7.ui.TextField;
+
+public class FormTooltips extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Form form = new Form();
+ form.setId("tooltipForm");
+ form.setDescription("Some description");
+ form.setItemDataSource(
+ new BeanItem<>(
+ new Person("foo", "bar", "baz", 12, Sex.MALE, null)),
+ Arrays.asList(new String[] { "firstName", "lastName", "age" }));
+ ((TextField) form.getField("firstName"))
+ .setDescription("Fields own tooltip");
+
+ form.setComponentError(new UserError("Form error"));
+ addComponent(form);
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "The 'first name' should show its own tooltip, the other fields should show no tooltip";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9173;
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContent.java b/uitest/src/main/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContent.java
new file mode 100644
index 0000000000..4a747771ac
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContent.java
@@ -0,0 +1,60 @@
+package com.vaadin.v7.tests.components.window;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.v7.data.Validator;
+import com.vaadin.v7.ui.Form;
+import com.vaadin.v7.ui.TextField;
+
+public class UndefinedHeightSubWindowAndContent extends TestBase {
+
+ @Override
+ protected void setup() {
+ Window subWindow = new Window("No scrollbars!");
+ subWindow.setWidth("300px");
+ subWindow.center();
+ subWindow.setModal(true);
+ VerticalLayout layout = new VerticalLayout();
+ layout.setWidth("100%");
+ subWindow.setContent(layout);
+
+ final Form form = new Form();
+ form.setFooter(null);
+ form.setImmediate(true);
+ form.setValidationVisible(true);
+ form.setCaption("This is a form");
+ form.setDescription("How do you do?");
+ final TextField field1 = new TextField("Write here");
+ field1.setImmediate(true);
+ field1.addValidator(new Validator() {
+
+ @Override
+ public void validate(Object value) throws InvalidValueException {
+ if (!isValid(value)) {
+ throw new InvalidValueException("FAIL!");
+ }
+ }
+
+ public boolean isValid(Object value) {
+ return field1.getValue().equals("valid");
+ }
+ });
+ form.addField("Field 1", field1);
+ layout.addComponent(form);
+
+ getMainWindow().addWindow(subWindow);
+ subWindow.bringToFront();
+ }
+
+ @Override
+ protected String getDescription() {
+ return "When both window and its content have undefined height, window must not reserve space for a scroll bar when it is not needed.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8852;
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java
new file mode 100644
index 0000000000..710fd5a8c1
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/form/FormTooltipsTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2013 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.v7.tests.components.form;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.FormElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.TooltipTest;
+
+public class FormTooltipsTest extends TooltipTest {
+
+ @Test
+ public void testTooltipConfiguration() throws Exception {
+ openTestURL();
+ // first name tooltip
+
+ WebElement fieldElement = $(FormElement.class).first()
+ .$(TextFieldElement.class).first();
+ checkTooltip(fieldElement, "Fields own tooltip");
+ clearTooltip();
+ checkTooltipNotPresent();
+
+ // first name caption tooltip
+ checkTooltip($(FormElement.class).first()
+ .findElement(By.className("v-caption")), "Fields own tooltip");
+
+ clearTooltip();
+ checkTooltipNotPresent();
+
+ // Form should not have a description tooltip
+ checkTooltip($(FormElement.class).first(), null);
+
+ // Form error message should not have a tooltip
+ checkTooltip(By.className("v-form-errormessage"), null);
+
+ // last name should have no tooltip
+ checkTooltip($(TextFieldElement.class).get(1), null);
+
+ // last name caption should have no tooltip
+ checkTooltip($(FormElement.class).first()
+ .findElements(By.className("v-caption")).get(1), null);
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java
new file mode 100644
index 0000000000..09489d4566
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/v7/tests/components/window/UndefinedHeightSubWindowAndContentTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.v7.tests.components.window;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+
+import com.vaadin.testbench.customelements.WindowElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class UndefinedHeightSubWindowAndContentTest extends MultiBrowserTest {
+
+ @Test
+ public void testUndefinedHeight() {
+ openTestURL();
+
+ TextFieldElement textField = $(TextFieldElement.class).first();
+
+ textField.click();
+ textField.sendKeys("invalid", Keys.ENTER);
+
+ WindowElement window = $(WindowElement.class).first();
+ int height = window.getSize().getHeight();
+ Assert.assertTrue("Window height with validation failure",
+ 161 <= height && height <= 164);
+
+ textField.setValue("valid");
+ textField.sendKeys(Keys.ENTER);
+ height = window.getSize().getHeight();
+ Assert.assertTrue("Window height with validation success",
+ 136 <= height && height <= 139);
+ }
+
+}