use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.
the class TSIT method lumoBadgeIsRenderedCorrectly.
@Test
public void lumoBadgeIsRenderedCorrectly() {
open();
checkLogsForErrors();
DivElement badge = $("ts-component").first().$(DivElement.class).attribute("theme", "badge").first();
String badgeBackgroundColor = badge.getCssValue("backgroundColor");
Assert.assertEquals("rgba(51, 139, 255, 0.13)", badgeBackgroundColor);
}
use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.
the class SimpleLitTemplateShadowRootIT method clientPropertyAndCallbackWorks.
@Test
public void clientPropertyAndCallbackWorks() {
NativeButtonElement clientButton = template.$(NativeButtonElement.class).id("clientButton");
Assert.assertEquals("Client button", clientButton.getText());
clientButton.click();
DivElement label = template.$(DivElement.class).id("label");
Assert.assertEquals("Hello from ClientCallable", label.getText());
}
use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.
the class ShadowRootIT method checkShadowRoot.
@Test
public void checkShadowRoot() {
open();
DivElement div = $(DivElement.class).id("test-element");
WebElement shadowDiv = div.$(DivElement.class).id("shadow-div");
Assert.assertEquals("Div inside shadow DOM", shadowDiv.getText());
WebElement shadowLabel = div.$(LabelElement.class).id("shadow-label");
Assert.assertEquals("Label inside shadow DOM", shadowLabel.getText());
findElement(By.id("remove")).click();
Assert.assertTrue("Child has not been removed from the shadow root", findElements(By.id("shadow-label")).isEmpty());
}
use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.
the class ModelListIT method clickOnAddedItems_itemsAreUpdated.
@Test
public void clickOnAddedItems_itemsAreUpdated() {
DivElement repeat1 = findRepeatByID("repeat-1");
DivElement repeat2 = findRepeatByID("repeat-2");
DivElement repeat3 = findRepeatByID("repeat-3");
DivElement repeat4 = findRepeatByID("repeat-4");
assertClickedStates();
repeat1.findElements(By.tagName("div")).get(1).click();
assertClickedStates(1);
repeat2.findElements(By.tagName("div")).get(1).click();
assertClickedStates(1, 3);
repeat3.findElements(By.tagName("div")).get(1).click();
assertClickedStates(1, 3, 5);
repeat3.findElements(By.tagName("div")).get(3).click();
assertClickedStates(1, 3, 5, 7);
repeat4.findElements(By.tagName("div")).get(1).click();
assertClickedStates(1, 3, 5, 7, 9);
}
use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.
the class ModelListIT method assertClickedStates.
private void assertClickedStates(int... clicked) {
DivElement repeat1 = findRepeatByID("repeat-1");
DivElement repeat2 = findRepeatByID("repeat-2");
DivElement repeat3 = findRepeatByID("repeat-3");
DivElement repeat4 = findRepeatByID("repeat-4");
List<DivElement> divs = new ArrayList<>();
divs.addAll(repeat1.$(DivElement.class).all());
divs.addAll(repeat2.$(DivElement.class).all());
divs.addAll(repeat3.$(DivElement.class).all());
divs.addAll(repeat4.$(DivElement.class).all());
divs.add(findRepeatByID("item-with-item-div"));
for (int i = 0; i < divs.size(); i++) {
int index = i;
boolean clickedState = IntStream.of(clicked).anyMatch(x -> x == index);
Assert.assertThat(divs.get(index).getText(), CoreMatchers.startsWith(String.valueOf(clickedState)));
}
}
Aggregations