aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/caption/EmptyCaptions.java
blob: 05b8333e7d3333b2eeb58d99c890d00f2cb33f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.vaadin.tests.components.caption;

import com.vaadin.server.UserError;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.TextField;

public class EmptyCaptions extends TestBase {

    @Override
    protected void setup() {
        TextField tf;

        tf = new TextField(null, "Null caption");
        addComponent(tf);

        tf = new TextField("", "Empty caption");
        addComponent(tf);

        tf = new TextField(" ", "Space as caption");
        addComponent(tf);

        tf = new TextField(null, "Null caption, required");
        tf.setRequired(true);
        addComponent(tf);
        tf = new TextField("", "Empty caption, required");
        tf.setRequired(true);
        addComponent(tf);
        tf = new TextField(" ", "Space as caption, required");
        tf.setRequired(true);
        addComponent(tf);

        tf = new TextField(null, "Null caption, error");
        tf.setComponentError(new UserError("error"));
        addComponent(tf);

        tf = new TextField("", "Empty caption, error");
        tf.setComponentError(new UserError("error"));
        addComponent(tf);

        tf = new TextField(" ", "Space as caption, error");
        tf.setComponentError(new UserError("error"));
        addComponent(tf);

    }

    @Override
    protected String getDescription() {
        return "Null caption should never use space while a non-null caption always should use space.";
    }

    @Override
    protected Integer getTicketNumber() {
        return 3846;
    }

}