google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

Add the possibility for developer to set any DOM element's height and width manually #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Element.getClientHeight() and Element.getClientWidth() alway return 0.

Although gwt-test-utils does not attempt to reproduce a real Web Browser 
behaviour, it would be nice for developers to be able to set those values 
manually.

Any utility class with some static methods would be fine : 

GwtDomUtils.setHeight(Element element);
GwtDomUtils.setWidth(Element element);

Original issue reported on code.google.com by gael.laz...@gmail.com on 18 Jul 2011 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 19 Jul 2011 at 5:09

GoogleCodeExporter commented 9 years ago
A new GwtDomUtils class is now available (0.31-SNAPSHOT). The following tests 
are working :

public class GwtDomUtilsTest extends GwtTestTest {

  @Test
  public void setClientHeight() {
    // Arrange
    Element e = Document.get().createAnchorElement();

    // Act
    GwtDomUtils.setClientHeight(e, 4);

    // Assert
    Assert.assertEquals(4, e.getClientHeight());
  }

  @Test
  public void setClientWidth() {
    // Arrange
    Element e = Document.get().createAnchorElement();

    // Act
    GwtDomUtils.setClientWidth(e, 4);

    // Assert
    Assert.assertEquals(4, e.getClientWidth());
  }

}

Original comment by gael.laz...@gmail.com on 19 Jul 2011 at 5:45