aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorIlia Motornyi <elmot@vaadin.com>2016-12-15 16:32:39 +0200
committerGitHub <noreply@github.com>2016-12-15 16:32:39 +0200
commit1739bb7de7a9ac1a2b6548b8a77f7230ebd806e3 (patch)
tree731f689a6a5769a26a7919d0e2f0f7ddb099933c /uitest
parent536139870943d684907e0d9b93bbda60582b340d (diff)
downloadvaadin-framework-1739bb7de7a9ac1a2b6548b8a77f7230ebd806e3.tar.gz
vaadin-framework-1739bb7de7a9ac1a2b6548b8a77f7230ebd806e3.zip
Delete CheckboxRenderer
Fixes vaadin/framework8-issues#551
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridClickableRenderers.java17
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java24
2 files changed, 20 insertions, 21 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridClickableRenderers.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridClickableRenderers.java
index 42647e3d97..5fa2a43386 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridClickableRenderers.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridClickableRenderers.java
@@ -6,7 +6,6 @@ import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Label;
import com.vaadin.ui.renderers.ButtonRenderer;
-import com.vaadin.ui.renderers.CheckBoxRenderer;
import com.vaadin.ui.renderers.ImageRenderer;
public class GridClickableRenderers extends AbstractReindeerTestUI {
@@ -39,13 +38,15 @@ public class GridClickableRenderers extends AbstractReindeerTestUI {
.setValue(event.getItem().testText + " clicked")))
.setId("buttons").setCaption("Buttons");
- CheckBoxRenderer<TestPOJO> checkBoxRenderer = new CheckBoxRenderer<>(
- pojo -> pojo.truthValue,
- (pojo, newTruthValue) -> pojo.truthValue = newTruthValue);
- checkBoxRenderer.addClickListener(click -> checkBoxValueLabel.setValue(
- click.getItem().testText + " " + click.getItem().truthValue));
- grid.addColumn(pojo -> pojo.truthValue, checkBoxRenderer)
- .setId("checkboxes").setCaption("Checkboxes");
+ ButtonRenderer<TestPOJO> yesNoRenderer = new ButtonRenderer<>();
+ yesNoRenderer.addClickListener(event -> {
+ TestPOJO item = event.getItem();
+ item.truthValue = !item.truthValue;
+ checkBoxValueLabel.setValue(item.testText + " " + item.truthValue);
+ grid.getDataProvider().refreshAll();
+ });
+ grid.addColumn(pojo -> pojo.truthValue ? "Yes" : "No",
+ yesNoRenderer).setCaption("Truth").setId("truth");
grid.setItems(new TestPOJO("first row", "", "button 1 text", true),
new TestPOJO("second row", "", "button 2 text", false));
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java
index a548bff679..c4ec0d99ea 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridClickableRenderersTest.java
@@ -30,39 +30,37 @@ public class GridClickableRenderersTest extends MultiBrowserTest {
openTestURL();
Assert.assertTrue(isElementPresent(By.className("v-nativebutton")));
Assert.assertTrue(isElementPresent(By.className("gwt-Image")));
- Assert.assertTrue(isElementPresent(By.className("v-checkbox")));
}
@Test
public void buttonRendererReturnsCorrectItem() {
openTestURL();
- WebElement firstButton = findElements(By.className("v-nativebutton"))
+ WebElement firstRowButton = findElements(By.className("v-nativebutton"))
.get(0);
- WebElement secondButton = findElements(By.className("v-nativebutton"))
- .get(1);
+ WebElement secondRowButton = findElements(By.className("v-nativebutton"))
+ .get(2);
LabelElement label = $(LabelElement.class).get(1);
- firstButton.click();
+ firstRowButton.click();
Assert.assertEquals("first row clicked", label.getText());
- secondButton.click();
+ secondRowButton.click();
Assert.assertEquals("second row clicked", label.getText());
}
@Test
public void checkBoxRendererClick() {
openTestURL();
- WebElement firstCheckBox = findElements(
- By.cssSelector("input[type='checkbox']")).get(0);
- WebElement secondCheckBox = findElements(
- By.cssSelector("input[type='checkbox']")).get(1);
-
+ WebElement firstRowButton = findElements(By.className("v-nativebutton"))
+ .get(1);
+ WebElement secondRowButton = findElements(By.className("v-nativebutton"))
+ .get(3);
LabelElement label = $(LabelElement.class).get(2);
- firstCheckBox.click();
+ firstRowButton.click();
Assert.assertEquals("first row false", label.getText());
- secondCheckBox.click();
+ secondRowButton.click();
Assert.assertEquals("second row true", label.getText());
}
}