Package elemental.dom

Examples of elemental.dom.Document$Events


  // For some reason it fails in HtmlUnit production mode. It also fails
  // in real browsers because of pop up blocker.
  @DoNotRunWith(Platform.Prod)
  public void testWrite() {
    final Window window = getWindow().open("about:blank", "_blank");
    final Document document = window.getDocument();
    document.write("<body>drink and drink and drink AND FIGHT</body>");
    assertTrue(document.getBody().getTextContent().indexOf("drink and drink and drink AND FIGHT") != -1);
  }
View Full Code Here


   * Tests that the {@link UncaughtExceptionHandler} gets called correctly when
   * events are fired from a subinterface of {@link EventTarget}.
   */
  public void testUncaughtException() {
    // Create a button with an event handler that will throw an exception.
    Document doc = Browser.getDocument();
    ButtonElement btn = doc.createButtonElement();
    doc.getBody().appendChild(btn);

    btn.addEventListener(Event.CLICK, new EventListener() {
      @Override
      public void handleEvent(Event evt) {
        throw new RuntimeException("w00t!");
      }
    }, false);

    // Setup the UncaughtExceptionHandler.
    final Throwable[] ex = new Throwable[1];
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
      @Override
      public void onUncaughtException(Throwable e) {
        ex[0] = e;
      }
    });

    // Click it and make sure the exception got caught.
    TestUtils.click(btn);
    assertNotNull(ex[0]);
    assertEquals("w00t!", ex[0].getMessage());

    // Clean up.
    GWT.setUncaughtExceptionHandler(null);
    doc.getBody().removeChild(btn);
  }
View Full Code Here

   * Tests that the {@link UncaughtExceptionHandler} gets called correctly when
   * events are fired from {@link Element#setOnClick(EventListener)}.
   */
  public void testUncaughtException() {
    // Create a button with an event handler that will throw an exception.
    Document doc = Browser.getDocument();
    ButtonElement btn = doc.createButtonElement();
    doc.getBody().appendChild(btn);

    btn.setOnclick(new EventListener() {
      @Override
      public void handleEvent(Event evt) {
        throw new RuntimeException("w00t!");
      }
    });

    // Setup the UncaughtExceptionHandler.
    final Throwable[] ex = new Throwable[1];
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
      @Override
      public void onUncaughtException(Throwable e) {
        ex[0] = e;
      }
    });

    // Click it and make sure the exception got caught.
    TestUtils.click(btn);
    assertNotNull(ex[0]);
    assertEquals("w00t!", ex[0].getMessage());

    // Clean up.
    GWT.setUncaughtExceptionHandler(null);
    doc.getBody().removeChild(btn);
  }
View Full Code Here

    middleBar.addChild(el, width);
    return el;
  }

  private static Element findBody() {
    Document doc = Browser.getDocument();
    Element body = doc.getElementById("gwt_root");
    return body == null ? doc.getBody() : body;
  }
View Full Code Here

  }

  protected Element wrapChild(Element child, PanelNode node) {
    ElementInspector.get().makeInspectable(child, node);
    // Throw in some drag handles.
    Document doc = Browser.getDocument();
    Element wrapper = doc.createDivElement();
    child.addClassName(css.panelContent());
    wrapper.addClassName(css.splitPanelChild());
    wrapper.getStyle().setPosition("absolute");
    wrapper.appendChild(child);
    createSlider(wrapper, child, node, true);
View Full Code Here

TOP

Related Classes of elemental.dom.Document$Events

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.