aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java
blob: 4155dd8a075b0198cf5195577fdd5c855f99cf71 (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.richtextarea;

import java.util.LinkedHashMap;

import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
import com.vaadin.ui.RichTextArea;

public class RichTextAreaTest extends AbstractFieldTest<RichTextArea> {

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

    private Command<RichTextArea, Boolean> nullSelectionAllowedCommand = new Command<RichTextArea, Boolean>() {

        @Override
        public void execute(RichTextArea c, Boolean value, Object data) {
            c.setNullSettingAllowed(value);

        }
    };
    private Command<RichTextArea, String> nullRepresentationCommand = new Command<RichTextArea, String>() {

        @Override
        public void execute(RichTextArea c, String value, Object data) {
            c.setNullRepresentation(value);
        }
    };

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

        createSetTextValueAction(CATEGORY_ACTIONS);

        createNullSettingAllowedAction(CATEGORY_FEATURES);
        createNullRepresentationAction(CATEGORY_FEATURES);
    }

    private void createNullSettingAllowedAction(String category) {
        createBooleanAction("Null selection allowed", category, true,
                nullSelectionAllowedCommand);
    }

    private void createNullRepresentationAction(String category) {
        LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
        options.put("-", null);
        options.put("null", "null");
        options.put("This is empty", "This is empty");
        options.put("- Nothing -", "- Nothing -");
        createSelectAction("Null representation", category, options, "null",
                nullRepresentationCommand);
    }

}