Search in sources :

Example 1 with DivElement

use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.

the class AnimationGwt2SchedulerTest method testRequestAnimationFrame.

// TODO(davido): doesn't work on htmlunit-2.19 (works in 2.18)
// Presumably because of: http://sourceforge.net/p/htmlunit/code/11004
@DoNotRunWith(Platform.HtmlUnitBug)
public void testRequestAnimationFrame() {
    delayTestFinish(TEST_TIMEOUT);
    final double startTime = Duration.currentTimeMillis();
    DivElement element = Document.get().createDivElement();
    scheduler.requestAnimationFrame(timestamp -> {
        // Make sure timestamp is not a high-res timestamp (see issue 8570)
        assertTrue(timestamp >= startTime);
        finishTest();
    }, element);
}
Also used : DivElement(org.gwtproject.dom.client.DivElement) DoNotRunWith(com.google.gwt.junit.DoNotRunWith)

Example 2 with DivElement

use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.

the class AttributeGwt2Test method testSetGetRemove_idrefValue.

public void testSetGetRemove_idrefValue() {
    attribute5.set(div, Id.of("1"), Id.of("2"));
    assertEquals("1 2", attribute5.get(div));
    attribute5.remove(div);
    assertEquals("", attribute5.get(div));
    DivElement ref1 = createDiv();
    ref1.setId("ref1");
    DivElement ref2 = createDiv();
    ref2.setId("ref2");
    attribute5.set(div, Id.of(ref1), Id.of(ref2));
    assertEquals("ref1 ref2", attribute5.get(div));
}
Also used : DivElement(org.gwtproject.dom.client.DivElement)

Example 3 with DivElement

use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.

the class ImageTest method testWrapThenSetUrlAndVisibleRect.

/**
 * Tests that wrapping an existing DOM element works if you call
 * setUrlAndVisibleRect() on it.
 */
public void testWrapThenSetUrlAndVisibleRect() {
    String uid = Document.get().createUniqueId();
    DivElement div = Document.get().createDivElement();
    div.setInnerHTML("<img id='" + uid + "' src='counting-backwards.png' width='16' height='16'>");
    Document.get().getBody().appendChild(div);
    final Image image = Image.wrap(Document.get().getElementById(uid));
    assertEquals(0, image.getOriginLeft());
    assertEquals(0, image.getOriginTop());
    assertEquals(16, image.getWidth());
    assertEquals(16, image.getHeight());
    assertEquals("unclipped", getCurrentImageStateName(image));
    image.setUrlAndVisibleRect("counting-forwards.png", 0, 16, 16, 16);
    assertEquals(0, image.getOriginLeft());
    assertEquals(16, image.getOriginTop());
    assertEquals(16, image.getWidth());
    assertEquals(16, image.getHeight());
    assertEquals("clipped", getCurrentImageStateName(image));
}
Also used : DivElement(org.gwtproject.dom.client.DivElement)

Example 4 with DivElement

use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.

the class LabelTest method createAttachedDivElement.

/**
 * Create a div and attach it to the {@link RootPanel}.
 *
 * @return the new div
 */
protected Element createAttachedDivElement() {
    DivElement elem = Document.get().createDivElement();
    RootPanel.getBodyElement().appendChild(elem);
    return elem;
}
Also used : DivElement(org.gwtproject.dom.client.DivElement)

Example 5 with DivElement

use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.

the class PopupTest method testAutoHidePartner.

public void testAutoHidePartner() {
    final PopupPanel popup = new PopupPanel();
    // Add a partner
    DivElement partner0 = Document.get().createDivElement();
    popup.addAutoHidePartner(partner0);
    popup.addAutoHidePartner(Document.get().createDivElement());
    // Remove a partner
    popup.removeAutoHidePartner(partner0);
}
Also used : DivElement(org.gwtproject.dom.client.DivElement)

Aggregations

DivElement (org.gwtproject.dom.client.DivElement)16 Document (org.gwtproject.dom.client.Document)4 DoNotRunWith (com.google.gwt.junit.DoNotRunWith)2 Element (org.gwtproject.dom.client.Element)2 Layer (org.gwtproject.layout.client.Layout.Layer)2 CSSStyleDeclaration (elemental2.dom.CSSStyleDeclaration)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 HTMLInputElement (elemental2.dom.HTMLInputElement)1 Promise (elemental2.promise.Promise)1 Style (org.gwtproject.dom.client.Style)1 Test (org.junit.Test)1