Java Code Examples for com.vaadin.flow.dom.Element#as()

The following examples show how to use com.vaadin.flow.dom.Element#as() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalStateException.class)
public void wrappedComponentGetParent() {
    Element div = new Element("div");
    Element button = new Element("button");
    div.appendChild(button);

    div.as(TestDiv.class);
    button.as(TestButton.class).getParent();
}
 
Example 2
Source File: ComponentTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalStateException.class)
public void wrappedComponentGetChildren() {
    Element div = new Element("div");
    Element button = new Element("button");
    div.appendChild(button);

    button.as(TestButton.class);
    div.as(TestDiv.class).getChildren();
}
 
Example 3
Source File: ComponentTest.java    From flow with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void wrapWrongTag() {
    Element foo = new Element("foo");
    foo.as(TestDiv.class);
}