aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTest.java
blob: 5a4172d463d12b322307a5ba5f819320b679414a (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
package com.vaadin.tests.components.datefield;

import java.util.LinkedHashMap;

import com.vaadin.ui.DateField;

public class DateFieldTest extends AbstractDateFieldTest<DateField> {

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

    @Override
    protected void createActions() {
        super.createActions();

        createInputPromptSelectAction(CATEGORY_FEATURES);
        createTextEnabledAction(CATEGORY_FEATURES);
    }

    private void createInputPromptSelectAction(String category) {
        LinkedHashMap<String, String> options = new LinkedHashMap<>();
        options.put("<none>", null);
        options.put("Please enter date", "Please enter date");
        options.put("åäöÅÄÖ", "åäöÅÄÖ");

        createSelectAction("Input prompt", category, options, "<none>",
                new Command<DateField, String>() {

                    @Override
                    public void execute(DateField c, String value,
                            Object data) {
                        c.setPlaceholder(value);

                    }
                });
    }

    private void createTextEnabledAction(String category) {
        this.createBooleanAction("Text field enabled", category, true,
                (field, value, data) -> field.setTextFieldEnabled(value));
    }
}