aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testbench/com/vaadin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testbench/com/vaadin')
-rw-r--r--tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html133
-rw-r--r--tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java94
2 files changed, 227 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html
new file mode 100644
index 0000000000..4b273ca260
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.html
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.validation.ValidationOfRequiredFields?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>11,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+ <td>60,11</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTextField[0]</td>
+ <td>The field is required</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>required-message</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td>
+ <td>13,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>28,13</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>a</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/domChild[0]/domChild[1]</td>
+ <td>34,186</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>error-must-be-int</td>
+</tr>
+<!-- Dummy command to remove the tooltip -->
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
+ <td>45,9</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>error-must-be-int-and-5-to-10-chars</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
+ <td>12,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>124,12</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]</td>
+ <td>8,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
+ <td>13,7</td>
+</tr>
+<tr>
+ <td>showTooltip</td>
+ <td>vaadin=runcomvaadintestsvalidationValidationOfRequiredFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VTextField[0]</td>
+ <td>0,0</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>empty-invalid-not-required</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java
new file mode 100644
index 0000000000..396b244758
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java
@@ -0,0 +1,94 @@
+package com.vaadin.tests.validation;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.Validator;
+import com.vaadin.data.validator.IntegerValidator;
+import com.vaadin.data.validator.StringLengthValidator;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.TextField;
+
+public class ValidationOfRequiredEmptyFields extends TestBase {
+
+ private TextField tf;
+ private CheckBox requiredInput;
+ private TextField requiredErrorInput;
+
+ private Validator integerValidator = new IntegerValidator(
+ "Must be an integer");
+ private Validator stringLengthValidator = new StringLengthValidator(
+ "Must be 5-10 chars", 5, 10, false);
+ private CheckBox integerValidatorInput;
+ private CheckBox stringLengthValidatorInput;
+
+ @Override
+ protected void setup() {
+ requiredInput = new CheckBox("Field required");
+ requiredInput.setImmediate(true);
+ requiredInput.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ tf.setRequired((Boolean) requiredInput.getValue());
+ }
+ });
+
+ requiredErrorInput = new TextField("Required error message");
+ requiredErrorInput.setImmediate(true);
+ requiredErrorInput.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ tf.setRequiredError((String) requiredErrorInput.getValue());
+ }
+ });
+
+ integerValidatorInput = new CheckBox("Integer.parseInt validator");
+ integerValidatorInput.setImmediate(true);
+ integerValidatorInput.addListener(new ValueChangeListener() {
+
+ public void valueChange(ValueChangeEvent event) {
+ if ((Boolean) integerValidatorInput.getValue()) {
+ tf.addValidator(integerValidator);
+ } else {
+ tf.removeValidator(integerValidator);
+ }
+ }
+ });
+ stringLengthValidatorInput = new CheckBox(
+ "stringLength.parseInt validator");
+ stringLengthValidatorInput.setImmediate(true);
+ stringLengthValidatorInput.addListener(new ValueChangeListener() {
+
+ public void valueChange(ValueChangeEvent event) {
+ if ((Boolean) stringLengthValidatorInput.getValue()) {
+ tf.addValidator(stringLengthValidator);
+ } else {
+ tf.removeValidator(stringLengthValidator);
+ }
+ }
+ });
+
+ tf = new TextField();
+ tf.setImmediate(true);
+
+ requiredInput.setValue(false);
+ requiredErrorInput.setValue("");
+ integerValidatorInput.setValue(false);
+ stringLengthValidatorInput.setValue(false);
+
+ addComponent(requiredInput);
+ addComponent(requiredErrorInput);
+ addComponent(integerValidatorInput);
+ addComponent(stringLengthValidatorInput);
+ addComponent(tf);
+ }
+
+ @Override
+ protected String getDescription() {
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3851;
+ }
+
+}