diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-11-25 12:20:24 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-11-25 11:15:22 +0000 |
commit | 459bb376e4005fdd32b2653a9ba8d8df90b8d560 (patch) | |
tree | 833756968257d1bd0f8d6298ee5e4397efdde083 /uitest | |
parent | b4d0865f93c5ba8e08957812bc563f4ad2e9d00f (diff) | |
download | vaadin-framework-459bb376e4005fdd32b2653a9ba8d8df90b8d560.tar.gz vaadin-framework-459bb376e4005fdd32b2653a9ba8d8df90b8d560.zip |
Fix setSelected in MultiSelectionModel to update row data (#19302)
Change-Id: I32c980b2cae199ad2059701e4e04b4a7cb76bafa
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java | 14 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInitTest.java | 12 |
2 files changed, 25 insertions, 1 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java b/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java index 10d4977623..4a11c19242 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInit.java @@ -17,18 +17,30 @@ package com.vaadin.tests.components.grid; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.MultiSelectionModel; import com.vaadin.ui.Grid.SelectionMode; public class GridMultiSelectionOnInit extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - Grid grid = new Grid(); + final Grid grid = new Grid(); grid.addColumn("foo", String.class); grid.addRow("Foo 1"); grid.addRow("Foo 2"); grid.setSelectionMode(SelectionMode.MULTI); addComponent(grid); + + addComponent(new Button("Select rows", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + ((MultiSelectionModel) grid.getSelectionModel()) + .setSelected(grid.getContainerDataSource().getItemIds()); + } + })); } } diff --git a/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInitTest.java b/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInitTest.java index d5eedae824..1818baa4c9 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInitTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridMultiSelectionOnInitTest.java @@ -15,11 +15,13 @@ */ package com.vaadin.tests.components.grid; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; import org.openqa.selenium.By; +import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -34,4 +36,14 @@ public class GridMultiSelectionOnInitTest extends MultiBrowserTest { $(GridElement.class).first().getHeaderCell(0, 0) .isElementPresent(By.tagName("input"))); } + + @Test + public void testSetSelectedUpdatesClient() { + openTestURL(); + assertFalse("Rows should not be selected initially.", + $(GridElement.class).first().getRow(0).isSelected()); + $(ButtonElement.class).first().click(); + assertTrue("Rows should be selected after button click.", + $(GridElement.class).first().getRow(0).isSelected()); + } } |