You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractOrderedLayoutWithCaptionsTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.vaadin.tests.components;
  2. import static org.hamcrest.MatcherAssert.assertThat;
  3. import static org.hamcrest.Matchers.lessThanOrEqualTo;
  4. import static org.hamcrest.core.Is.is;
  5. import java.util.List;
  6. import org.junit.Test;
  7. import org.openqa.selenium.WebElement;
  8. import com.vaadin.testbench.By;
  9. import com.vaadin.tests.tb3.MultiBrowserTest;
  10. /**
  11. * Test to see if AbstractOrderedLayout displays captions correctly with
  12. * expanding ratios.
  13. *
  14. * @author Vaadin Ltd
  15. */
  16. public class AbstractOrderedLayoutWithCaptionsTest extends MultiBrowserTest {
  17. @Test
  18. public void CaptionHeightMeasuredCorrectly() {
  19. openTestURL();
  20. WebElement div = getDriver()
  21. .findElement(By.cssSelector(".v-panel-content > div > div"));
  22. String paddingTop = div.getCssValue("padding-top");
  23. Integer paddingHeight = Integer
  24. .parseInt(paddingTop.substring(0, paddingTop.length() - 2));
  25. List<WebElement> children = getDriver()
  26. .findElements(By.cssSelector(".v-panel-content .v-slot"));
  27. assertThat(children.size(), is(3));
  28. Integer neededHeight = children.get(0).getSize().getHeight()
  29. + children.get(2).getSize().getHeight();
  30. assertThat(neededHeight, is(lessThanOrEqualTo(paddingHeight)));
  31. }
  32. }