aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupItemDisabledTest.java
blob: 6ccc171a7eb9c04b290e6cfbab32ec3e806dc2ea (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
package com.vaadin.tests.components.checkboxgroup;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.elements.CheckBoxGroupElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class CheckBoxGroupItemDisabledTest extends MultiBrowserTest {

    @Test
    public void itemDisabledOnInit() {
        openTestURL();
        List<WebElement> options = $(CheckBoxGroupElement.class).first()
                .getOptionElements();
        options.stream().forEach(option -> {
            Integer value = Integer.parseInt(option.getText());
            boolean disabled = !CheckBoxGroupItemDisabled.ENABLED_PROVIDER
                    .test(value);
            assertEquals(
                    "Unexpected status of v-disabled stylename for item "
                            + value,
                    disabled,
                    option.getAttribute("class").contains("v-disabled"));
        });
    }
}