blob: ad0fb4fbac4f399a114f4ad4e9a4d750b8b5e36d (
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
|
package com.vaadin.tests.components.checkboxgroup;
import com.vaadin.testbench.elements.CheckBoxGroupElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
public class CheckBoxGroupReadOnlyTest extends MultiBrowserTest {
@Test
public void itemsAreReadOnly() {
openTestURL();
// Initially components are read-only
assertTrue(getSelect().isReadOnly());
assertEquals(4, findReadOnlyCheckboxes().size());
// Should not contain v-readonly
findElement(By.id("changeReadOnly")).click();
assertEquals(0, findReadOnlyCheckboxes().size());
// Should not contain v-readonly
findElement(By.id("changeEnabled")).click();
assertEquals(0, findReadOnlyCheckboxes().size());
// make read-only
findElement(By.id("changeReadOnly")).click();
// enable
findElement(By.id("changeEnabled")).click();
// Should contain v-readonly
assertEquals(4, findReadOnlyCheckboxes().size());
}
protected CheckBoxGroupElement getSelect() {
return $(CheckBoxGroupElement.class).first();
}
private List<WebElement> findReadOnlyCheckboxes() {
return findElement(By.id("cbg"))
.findElements(By.cssSelector("span.v-readonly.v-checkbox"));
}
}
|