Search in sources :

Example 1 with Html

use of com.vaadin.flow.component.Html in project flow by vaadin.

the class HTMLTest method brokenHtml.

@Test
public void brokenHtml() {
    Html html = new Html("<b></div>");
    Assert.assertEquals("b", html.getElement().getTag());
    Assert.assertEquals("", html.getInnerHtml());
}
Also used : Html(com.vaadin.flow.component.Html) Test(org.junit.Test)

Example 2 with Html

use of com.vaadin.flow.component.Html in project flow by vaadin.

the class HTMLTest method rootAttributes.

@Test
public void rootAttributes() {
    Html html = new Html("<span foo='bar'>hello</span>");
    Assert.assertEquals(Tag.SPAN, html.getElement().getTag());
    Assert.assertEquals(1, html.getElement().getAttributeNames().count());
    Assert.assertEquals("bar", html.getElement().getAttribute("foo"));
    Assert.assertEquals("hello", html.getInnerHtml());
}
Also used : Html(com.vaadin.flow.component.Html) Test(org.junit.Test)

Example 3 with Html

use of com.vaadin.flow.component.Html in project flow by vaadin.

the class PushConfigurator method construct.

private void construct() {
    for (PushMode mode : PushMode.values()) {
        pushMode.addOption(mode.name(), mode);
    }
    for (Transport transp : Transport.values()) {
        transport.addOption(transp.name(), transp);
        fallbackTransport.addOption(transp.name(), transp);
    }
    listeners();
    paramValue.add(parameter, value, set);
    status.setId("status");
    vl.add(pushMode, transport, fallbackTransport, paramValue, new Html("<hr></hr>"), status);
    add(vl);
}
Also used : Html(com.vaadin.flow.component.Html) Transport(com.vaadin.flow.shared.ui.Transport) PushMode(com.vaadin.flow.shared.communication.PushMode)

Example 4 with Html

use of com.vaadin.flow.component.Html in project flow by vaadin.

the class HTMLTest method extraWhitespace.

@Test
public void extraWhitespace() {
    String input = // 
    "   <span>    " + // 
    "    <div>" + // 
    "       <b>Hello!</b>" + // 
    "    </div>" + "</span>" + // 
    "  " + // 
    "" + "";
    Html html = new Html(input);
    Assert.assertEquals(Tag.SPAN, html.getElement().getTag());
    String expectedInnerHtml = input.replaceAll("^[ ]*<span>", "").replaceAll("</span>[ ]*$", "");
    Assert.assertEquals(expectedInnerHtml, html.getInnerHtml());
}
Also used : Html(com.vaadin.flow.component.Html) Test(org.junit.Test)

Example 5 with Html

use of com.vaadin.flow.component.Html in project flow by vaadin.

the class HTMLTest method simpleHtml.

@Test
public void simpleHtml() {
    Html html = new Html("<span>hello</span>");
    Assert.assertEquals(Tag.SPAN, html.getElement().getTag());
    Assert.assertEquals("hello", html.getInnerHtml());
}
Also used : Html(com.vaadin.flow.component.Html) Test(org.junit.Test)

Aggregations

Html (com.vaadin.flow.component.Html)6 Test (org.junit.Test)5 ElementListenersTest (com.vaadin.flow.internal.nodefeature.ElementListenersTest)1 PushMode (com.vaadin.flow.shared.communication.PushMode)1 Transport (com.vaadin.flow.shared.ui.Transport)1