use of com.vaadin.flow.component.html.testbench.NativeButtonElement in project flow by vaadin.
the class InnerTemplateVisibilityIT method outerTemplateIsHiddenWithAttributeOnly.
@Test
public void outerTemplateIsHiddenWithAttributeOnly() {
open();
// when hidden
NativeButtonElement toggleButton = $(NativeButtonElement.class).id(InnerTemplateVisibilityView.TOGGLE_OUTER_VISIBILITY_BUTTON_ID);
toggleButton.click();
// then: element is not visible, attribute 'hidden' is set but
// 'display: none' is not set
WebElement outer = findElement(By.id(InnerTemplateVisibilityView.OUTER_ID));
Assert.assertFalse("expected outer to be hidden", outer.isDisplayed());
Assert.assertNotNull("expected attribute hidden on outer", outer.getAttribute("hidden"));
Assert.assertEquals("expected no style attribute", "", outer.getAttribute("style"));
}
use of com.vaadin.flow.component.html.testbench.NativeButtonElement in project flow by vaadin.
the class InnerTemplateVisibilityIT method innerTemplateIsHiddenWithDisplayNone.
@Test
public void innerTemplateIsHiddenWithDisplayNone() {
open();
// when inner is hidden
NativeButtonElement toggleButton = $(NativeButtonElement.class).id(InnerTemplateVisibilityView.TOGGLE_INNER_VISIBILITY_BUTTON_ID);
toggleButton.click();
// then: element is not visible, attribute 'hidden' and 'display: none'
// set
TestBenchElement outer = $("*").id(InnerTemplateVisibilityView.OUTER_ID);
TestBenchElement inner = outer.$("*").id(InnerTemplateVisibilityView.INNER_ID);
Assert.assertFalse("expected inner to be hidden", inner.isDisplayed());
Assert.assertNotNull("expected attribute hidden on inner", inner.getAttribute("hidden"));
Assert.assertEquals("expected 'display: none' on inner", "none", inner.getCssValue("display"));
}
use of com.vaadin.flow.component.html.testbench.NativeButtonElement 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.NativeButtonElement in project flow by vaadin.
the class InnerTemplateVisibilityIT method innerTemplateDisplayStyleRestored.
@Test
public void innerTemplateDisplayStyleRestored() {
open();
// when inner is hidden and unhidden
NativeButtonElement toggleButton = $(NativeButtonElement.class).id(InnerTemplateVisibilityView.TOGGLE_INNER_VISIBILITY_BUTTON_ID);
toggleButton.click();
toggleButton.click();
// then: element is visible, attribute and 'display: none' are no longer
// present
TestBenchElement outer = $("*").id(InnerTemplateVisibilityView.OUTER_ID);
TestBenchElement inner = outer.$("*").id(InnerTemplateVisibilityView.INNER_ID);
Assert.assertTrue("expected inner to be visible", inner.isDisplayed());
Assert.assertNull("inner should not have attribute hidden", inner.getAttribute("hidden"));
Assert.assertEquals("expected 'display: block' on inner", "block", inner.getCssValue("display"));
}
use of com.vaadin.flow.component.html.testbench.NativeButtonElement in project flow by vaadin.
the class SimpleLitTemplateShadowRootIT method idMappingWorks.
@Test
public void idMappingWorks() {
NativeButtonElement mappedButton = template.$(NativeButtonElement.class).id("mappedButton");
Assert.assertEquals("Server button", mappedButton.getText());
mappedButton.click();
DivElement label = template.$(DivElement.class).id("label");
Assert.assertEquals("Hello from server component event listener", label.getText());
DivElement sortDiv = template.$(DivElement.class).id("sort");
Assert.assertEquals("Sort", sortDiv.getText());
}
Aggregations