Search in sources :

Example 6 with HeadingElement

use of com.google.gwt.dom.client.HeadingElement in project gwt-test-utils by gwt-test-utils.

the class AnchorTest method html.

@Test
public void html() {
    // Given
    Anchor a = new Anchor("<h1>foo</h1>", true);
    assertThat(a.getHTML()).isEqualTo("<h1>foo</h1>");
    // When
    a.setHTML("<h1>test</h1>");
    // Then
    assertThat(a.getHTML()).isEqualTo("<h1>test</h1>");
    assertThat(a.getElement().getChildCount()).isEqualTo(1);
    HeadingElement h1 = a.getElement().getChild(0).cast();
    assertThat(h1.getTagName()).isEqualTo("H1");
    assertThat(h1.getInnerText()).isEqualTo("test");
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) HeadingElement(com.google.gwt.dom.client.HeadingElement) Test(org.junit.Test)

Example 7 with HeadingElement

use of com.google.gwt.dom.client.HeadingElement in project gwt-test-utils by gwt-test-utils.

the class HyperlinkTest method html.

@Test
public void html() {
    // Given
    Hyperlink link = new Hyperlink();
    // When
    link.setHTML("<h1>test</h1>");
    // Then
    assertThat(link.getHTML()).isEqualTo("<h1>test</h1>");
    assertThat(link.getElement().getChild(0).getChildCount()).isEqualTo(1);
    HeadingElement h1 = link.getElement().getChild(0).getChild(0).cast();
    assertThat(h1.getTagName()).isEqualTo("H1");
    assertThat(h1.getInnerText()).isEqualTo("test");
}
Also used : HeadingElement(com.google.gwt.dom.client.HeadingElement) Hyperlink(com.google.gwt.user.client.ui.Hyperlink) Test(org.junit.Test)

Aggregations

HeadingElement (com.google.gwt.dom.client.HeadingElement)7 Test (org.junit.Test)6 Element (com.google.gwt.dom.client.Element)2 DivElement (com.google.gwt.dom.client.DivElement)1 Document (com.google.gwt.dom.client.Document)1 Anchor (com.google.gwt.user.client.ui.Anchor)1 CheckBox (com.google.gwt.user.client.ui.CheckBox)1 Hyperlink (com.google.gwt.user.client.ui.Hyperlink)1 RadioButton (com.google.gwt.user.client.ui.RadioButton)1 Tag (com.willshex.blogwt.shared.api.datatype.Tag)1 User (com.willshex.blogwt.shared.api.datatype.User)1 Date (java.util.Date)1