Search in sources :

Example 1 with AnchorElement

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

the class JsArrayMixedTest method unshiftElement.

@Test
public void unshiftElement() {
    // Given
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setHref("http://lost.com");
    // When
    jsArrayMixed.unshift(anchor);
    // Then
    assertThat(jsArrayMixed.length()).isEqualTo(6);
    assertThat(jsArrayMixed.join()).isEqualTo("<a href=\"http://lost.com\"></a>,,,,,true");
}
Also used : AnchorElement(com.google.gwt.dom.client.AnchorElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 2 with AnchorElement

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

the class HTMLTest method html_withAnchor.

@Test
public void html_withAnchor() {
    // Given
    HTML widget = new HTML("<a href=\"foo\" target=\"bar\">baz</a>");
    // When
    NodeList<Element> nodeList = widget.getElement().getElementsByTagName("a");
    // Then
    assertThat(nodeList.getLength()).isEqualTo(1);
    AnchorElement anchor = nodeList.getItem(0).cast();
    assertThat(anchor.getHref()).isEqualTo("foo");
    assertThat(anchor.getTarget()).isEqualTo("bar");
}
Also used : Element(com.google.gwt.dom.client.Element) AnchorElement(com.google.gwt.dom.client.AnchorElement) AnchorElement(com.google.gwt.dom.client.AnchorElement) HTML(com.google.gwt.user.client.ui.HTML) Test(org.junit.Test)

Example 3 with AnchorElement

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

the class MainGwtTest method create.

@Test
public void create() {
    // When
    AnchorElement e = GWT.create(AnchorElement.class);
    // Then
    assertThat(e).isNotNull();
}
Also used : AnchorElement(com.google.gwt.dom.client.AnchorElement) Test(org.junit.Test)

Example 4 with AnchorElement

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

the class AnchorElementTest method as.

@Test
public void as() {
    // When
    AnchorElement asElement = AnchorElement.as(a);
    // Then
    assertThat(asElement).isEqualTo(a);
}
Also used : AnchorElement(com.google.gwt.dom.client.AnchorElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 5 with AnchorElement

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

the class JsArrayMixedTest method getStringElement.

@Test
public void getStringElement() {
    // Given
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.setHref("http://lost.com");
    jsArrayMixed.set(2, anchor);
    // When
    String elementToString = jsArrayMixed.getString(2);
    // Then
    assertThat(elementToString).isEqualTo("<a href=\"http://lost.com\"></a>");
}
Also used : AnchorElement(com.google.gwt.dom.client.AnchorElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Aggregations

AnchorElement (com.google.gwt.dom.client.AnchorElement)5 Test (org.junit.Test)5 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)3 Element (com.google.gwt.dom.client.Element)1 HTML (com.google.gwt.user.client.ui.HTML)1