diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-11-07 00:00:24 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-03-08 14:03:43 +0200 |
commit | 7c94854901dc862976f98bb527a3da43fa39bdbf (patch) | |
tree | a7d34e8be2cc972c1a12d28c2aeba0f9af8449dc /uitest | |
parent | be8e0baea2e2deff634e461f33f4359a47b33986 (diff) | |
download | vaadin-framework-7c94854901dc862976f98bb527a3da43fa39bdbf.tar.gz vaadin-framework-7c94854901dc862976f98bb527a3da43fa39bdbf.zip |
Don't set null value for unmapped client side keys. (#15181)
Change-Id: I7eab60daa74a9941e47a07fe7f9de0f94f155a78
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemove.java | 43 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemoveTest.java | 49 |
2 files changed, 92 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemove.java b/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemove.java new file mode 100644 index 0000000000..8002f5100e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemove.java @@ -0,0 +1,43 @@ +package com.vaadin.tests.components.tree; + +import com.vaadin.event.ItemClickEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Tree; + +public class SelectItemAfterRemove extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Tree tree = new Tree(); + + tree.setImmediate(true); + tree.addItemClickListener(new ItemClickEvent.ItemClickListener() { + @Override + public void itemClick(ItemClickEvent event) { + + tree.removeItem(tree.getValue()); + tree.select(event.getItemId()); + } + }); + + tree.addItem("first"); + tree.addItem("second"); + tree.addItem("third"); + + tree.select("first"); + + addComponent(tree); + } + + @Override + protected String getTestDescription() { + return "Clicking on an item should select the clicked item and remove " + + "the previously selected item."; + } + + @Override + protected Integer getTicketNumber() { + return 15181; + } +} diff --git a/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemoveTest.java b/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemoveTest.java new file mode 100644 index 0000000000..b048e185ea --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemoveTest.java @@ -0,0 +1,49 @@ +package com.vaadin.tests.components.tree; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class SelectItemAfterRemoveTest extends MultiBrowserTest { + + @Test + public void selectedItemIsSelected() { + openTestURL(); + + getSecondSpan().click(); + + assertThat(getNodes().size(), is(2)); + assertThat(getFirstNode().getAttribute("class"), + containsString("v-tree-node-selected")); + } + + private WebElement getFirstNode() { + return getNodes().get(0); + } + + private List<WebElement> getNodes() { + return findElements(By.className("v-tree-node-caption")); + } + + private WebElement getSecondSpan() { + for (WebElement e : getSpans()) { + if (e.getText().equals("second")) { + return e; + } + } + + return null; + } + + private List<WebElement> getSpans() { + return findElements(By.tagName("span")); + } +}
\ No newline at end of file |