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

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;

/*
 * NOTE This class is arbitrarily picked to represent a legacy application in
 * MultipleServletConfigurationTest and the corresponding "Embed App 1" servlet
 * configuration. The test will break if this class is refactored to extend UI
 * instead of LegacyApplication. Just a friendly warning.
 */
public class ButtonHtml extends TestBase {

    @Override
    protected void setup() {
        Button b = new Button("<b>Plain text button</b>");
        addComponent(b);

        b = new Button(
                "<span style=\"color: red; font-weight: bold;\">HTML</span> button");
        b.setCaptionAsHtml(true);
        addComponent(b);

        final Button swapButton = new Button("<i>Swap button<i>");
        swapButton.addClickListener(event -> swapButton
                .setCaptionAsHtml(!swapButton.isCaptionAsHtml()));
        addComponent(swapButton);
    }

    @Override
    protected String getDescription() {
        return "Verify that Button HTML rendering works";
    }

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