@Test
  public void checkCreateResetButtonElement() {
    // Test
    ButtonElement e = d.createResetButtonElement();

    // Assert
    Assert.assertEquals("button", e.getTagName());
    Assert.assertEquals("reset", e.getType());
  }
Exemple #2
0
  @Test
  public void getPreviousSibling() {
    // Pre-Assert
    assertNull(n.getPreviousSibling());

    // Arrange
    ButtonElement be0 = Document.get().createPushButtonElement();
    ButtonElement be1 = Document.get().createPushButtonElement();
    n.appendChild(be0);
    n.appendChild(be1);

    // Act & Assert
    assertEquals(be0, be1.getPreviousSibling());
  }
  // Trigger a test failure synchronously, but from within an event handler.
  // (The exception thrown from fail() will get caught by the GWT
  // UncaughtExceptionHandler).
  private void synchronousFailure(final String failMsg) {
    ButtonElement btn = Document.get().createButtonElement();
    Document.get().getBody().appendChild(btn);
    Event.sinkEvents(btn, Event.ONCLICK);

    EventListener listener =
        new EventListener() {
          public void onBrowserEvent(Event event) {
            failNow(failMsg);
          }
        };

    DOM.setEventListener(btn.<com.google.gwt.user.client.Element>cast(), listener);
    btn.click();
  }
Exemple #4
0
  protected void failViaUncaughtException(final String failMsg) {
    ButtonElement btn = Document.get().createPushButtonElement();
    Document.get().getBody().appendChild(btn);
    Event.sinkEvents(btn, Event.ONCLICK);

    EventListener listener =
        new EventListener() {
          @Override
          public void onBrowserEvent(Event event) {
            failNow(failMsg);
          }
        };

    DOM.setEventListener(btn, listener);
    btn.click();
  }