aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/textfield/TextFields.java
blob: 994769b1d106d35fdd9d147cbab02467096e0d1c (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
57
58
59
60
61
62
63
64
65
package com.vaadin.tests.components.textfield;

import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.TextField;

public class TextFields extends ComponentTestCase<TextField> {

    @Override
    protected Class<TextField> getTestClass() {
        return TextField.class;
    }

    @Override
    protected void initializeComponents() {
        TextField tf;

        tf = createTextField("TextField 100% wide");
        tf.setWidth("100%");
        addTestComponent(tf);

        tf = createTextField(null, "TextField 100% wide, no caption");
        tf.setWidth("100%");
        addTestComponent(tf);

        tf = createTextField("TextField auto wide");
        addTestComponent(tf);

        tf = createTextField("TextField with input prompt");
        tf.setInputPrompt("Please enter a value");
        addTestComponent(tf);

        tf = createTextField("100px wide textfield");
        tf.setWidth("100px");
        addTestComponent(tf);

        tf = createTextField("150px wide, 120px high textfield");
        tf.setWidth("150px");
        tf.setHeight("120px");
        addTestComponent(tf);

        tf = createTextField("50px high textfield");
        tf.setHeight("50px");
        addTestComponent(tf);

        tf = createTextField(null, "No caption");
        addTestComponent(tf);

        tf = createTextField(null, "No caption and input prompt");
        tf.setInputPrompt("Enter a value");
        addTestComponent(tf);

    }

    private TextField createTextField(String caption, String value) {
        TextField tf = new TextField(caption);
        tf.setValue(value);

        return tf;
    }

    private TextField createTextField(String caption) {
        return createTextField(caption, "");
    }

}