From b021d6199acd666abc729c6c20eaf68b820d1bdb Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Sat, 29 Aug 2015 23:00:21 +0300 Subject: Unify select all behavior with single row selection. (#17742) Change-Id: I6481bf6f429046166dd0502a62b22aea51f5a0bd --- .../tests/components/grid/GridSelectAllCell.java | 21 +++++++++++++ .../components/grid/GridSelectAllCellTest.java | 34 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/grid/GridSelectAllCell.java create mode 100644 uitest/src/com/vaadin/tests/components/grid/GridSelectAllCellTest.java (limited to 'uitest/src') diff --git a/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCell.java b/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCell.java new file mode 100644 index 0000000000..1b31c38994 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCell.java @@ -0,0 +1,21 @@ +package com.vaadin.tests.components.grid; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Grid; + +@Theme("valo") +public class GridSelectAllCell extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + Grid grid = new Grid(); + + grid.addColumn("foo", String.class); + grid.addRow("bar"); + + grid.setSelectionMode(Grid.SelectionMode.MULTI); + + addComponent(grid); + } +} diff --git a/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCellTest.java b/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCellTest.java new file mode 100644 index 0000000000..423a9f419b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/GridSelectAllCellTest.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.components.grid; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; + +import java.io.IOException; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GridSelectAllCellTest extends MultiBrowserTest { + + @Override + public void setup() throws Exception { + super.setup(); + + openTestURL(); + } + + @Test + public void selectAllCellCanBeClicked() throws IOException { + GridElement.GridCellElement selectAllCell = $(GridElement.class).first().getHeaderCell(0, 0); + + new Actions(getDriver()).moveToElement(selectAllCell, 2, 2).click().perform(); + + WebElement selectAllCheckbox = selectAllCell.findElement(By.cssSelector("input")); + assertThat(selectAllCheckbox.isSelected(), is(true)); + } +} \ No newline at end of file -- cgit v1.2.3