summaryrefslogtreecommitdiffstats
path: root/tests/server-side
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-04-18 14:09:56 +0300
committerLeif Åstrand <leif@vaadin.com>2012-04-18 14:09:56 +0300
commit290f6b3a2b6b3eeadf3c9904fbaae0fa2f016595 (patch)
treee219c7615fa7aa14d89f274896a4eafb1f283cbb /tests/server-side
parentcf06923748ce75dc8113e66a40bb69297def7072 (diff)
parentc3e10ebbbc48d124a88d6e92e16faccdebe43223 (diff)
downloadvaadin-framework-290f6b3a2b6b3eeadf3c9904fbaae0fa2f016595.tar.gz
vaadin-framework-290f6b3a2b6b3eeadf3c9904fbaae0fa2f016595.zip
Merge remote branch 'origin/6.8'
Conflicts: src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java
Diffstat (limited to 'tests/server-side')
-rw-r--r--tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java b/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java
index 85c88e29bb..40d0ffd17d 100644
--- a/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java
+++ b/tests/server-side/com/vaadin/tests/server/component/tabsheet/TestTabSheet.java
@@ -119,6 +119,43 @@ public class TestTabSheet {
assertEquals(tab1, tabSheet.getTab(0));
assertEquals(tab2, tabSheet.getTab(1));
assertEquals(tab3, tabSheet.getTab(2));
+
+ assertEquals(null, tabSheet.getTab(3));
}
+ @Test
+ public void selectTab() {
+ TabSheet tabSheet = new TabSheet();
+ Tab tab1 = tabSheet.addTab(new Label("aaa"));
+ Tab tab2 = tabSheet.addTab(new Label("bbb"));
+ Tab tab3 = tabSheet.addTab(new Label("ccc"));
+ Label componentNotInSheet = new Label("ddd");
+ Tab tabNotInSheet = new TabSheet().addTab(new Label("eee"));
+
+ assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());
+
+ // Select tab by component...
+ tabSheet.setSelectedTab(tab2.getComponent());
+ assertEquals(tab2.getComponent(), tabSheet.getSelectedTab());
+
+ // by tab instance
+ tabSheet.setSelectedTab(tab3);
+ assertEquals(tab3.getComponent(), tabSheet.getSelectedTab());
+
+ // by index
+ tabSheet.setSelectedTab(0);
+ assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());
+
+ // Should be no-op...
+ tabSheet.setSelectedTab(componentNotInSheet);
+ assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());
+
+ // this as well
+ tabSheet.setSelectedTab(tabNotInSheet);
+ assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());
+
+ // and this
+ tabSheet.setSelectedTab(123);
+ assertEquals(tab1.getComponent(), tabSheet.getSelectedTab());
+ }
}