summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2014-11-07 00:00:24 +0200
committerVaadin Code Review <review@vaadin.com>2016-03-05 08:11:58 +0000
commit1b4a659d629b4e96cfa4c8118ba2cf2926303406 (patch)
treeb0955776360e57f848220d0720874b93e083de00 /uitest
parent4c4a65d03795c3141b5cfeb78e77f369f719eb90 (diff)
downloadvaadin-framework-1b4a659d629b4e96cfa4c8118ba2cf2926303406.tar.gz
vaadin-framework-1b4a659d629b4e96cfa4c8118ba2cf2926303406.zip
Don't set null value for unmapped client side keys. (#15181)
Change-Id: Icff63665d6cbef5a5dfd07c64a4535f6bf55de08
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemove.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/tree/SelectItemAfterRemoveTest.java49
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