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.

GridCustomSelectionModelTest.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.vaadin.tests.components.grid;
  2. import static org.junit.Assert.assertFalse;
  3. import static org.junit.Assert.assertTrue;
  4. import org.junit.Test;
  5. import org.openqa.selenium.By;
  6. import org.openqa.selenium.Keys;
  7. import com.vaadin.testbench.elements.GridElement;
  8. import com.vaadin.testbench.elements.GridElement.GridCellElement;
  9. import com.vaadin.testbench.parallel.TestCategory;
  10. import com.vaadin.tests.tb3.MultiBrowserTest;
  11. @TestCategory("grid")
  12. public class GridCustomSelectionModelTest extends MultiBrowserTest {
  13. @Test
  14. public void testCustomSelectionModel() {
  15. setDebug(true);
  16. openTestURL();
  17. GridElement grid = $(GridElement.class).first();
  18. GridCellElement cell = grid.getCell(0, 0);
  19. assertTrue("First column of Grid should not have an input element",
  20. cell.findElements(By.tagName("input")).isEmpty());
  21. assertFalse("Row should not be selected initially",
  22. grid.getRow(0).isSelected());
  23. cell.click(5, 5);
  24. assertTrue("Click should select row", grid.getRow(0).isSelected());
  25. cell.click(5, 5);
  26. assertFalse("Click should deselect row", grid.getRow(0).isSelected());
  27. grid.sendKeys(Keys.SPACE);
  28. assertTrue("Space should select row", grid.getRow(0).isSelected());
  29. grid.sendKeys(Keys.SPACE);
  30. assertFalse("Space should deselect row", grid.getRow(0).isSelected());
  31. assertNoErrorNotifications();
  32. }
  33. }