aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java
blob: cc75f87a71dae19ac88ce579a2e23b0c91087a42 (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
package com.vaadin.tests.components.button;

import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.Button;
import com.vaadin.ui.NativeButton;

public class ButtonsWaiAria extends ComponentTestCase<Button> {

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

    @Override
    protected void initializeComponents() {

        Button l;
        boolean nat = false;

        l = createButton("Default Button", nat);
        addTestComponent(l);

        l = createButton("Icon Button, empty alt", nat);
        l.setIcon(ICON_16_USER_PNG_CACHEABLE);
        l.setDescription("Empty alt text");
        addTestComponent(l);

        l = createButton("Icon Button with alt", nat);
        l.setIcon(ICON_16_USER_PNG_CACHEABLE, "user icon");
        addTestComponent(l);

        l = createButton("Tooltip Button", nat);
        l.setDescription("Tooltip");
        addTestComponent(l);
    }

    private Button createButton(String text, boolean nativeButton) {
        Button b;
        if (nativeButton) {
            b = new NativeButton(text);
        } else {
            b = new Button(text);
        }

        return b;
    }

    @Override
    protected String getDescription() {
        return "A generic test for Buttons in different configurations";
    }
}