summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java25
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java13
2 files changed, 37 insertions, 1 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java
index da449a2461..fe1bcd0a1a 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java
@@ -9,6 +9,8 @@ import com.vaadin.ui.TabSheet.Tab;
public class TabsheetScrolling extends TestBase {
+ public static final String SELECT_FIRST = "selFirst";
+ public static final String SELECT_LAST = "selLast";
private TabSheet fixedSizeTabSheet;
private TabSheet autoWideTabSheet;
@@ -60,7 +62,28 @@ public class TabsheetScrolling extends TestBase {
}
addComponent(autoWideTabSheet);
-
+ Button selectFirst = new Button("Select first tab in both tabsheets",
+ new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ fixedSizeTabSheet.setSelectedTab(0);
+ autoWideTabSheet.setSelectedTab(0);
+ }
+ });
+ selectFirst.setId(SELECT_FIRST);
+ addComponent(selectFirst);
+ Button selectLast = new Button("Select last tab in both tabsheets",
+ new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ int lastFixed = fixedSizeTabSheet.getComponentCount() - 1;
+ fixedSizeTabSheet.setSelectedTab(lastFixed);
+ int lastAuto = autoWideTabSheet.getComponentCount() - 1;
+ autoWideTabSheet.setSelectedTab(lastAuto);
+ }
+ });
+ selectLast.setId(SELECT_LAST);
+ addComponent(selectLast);
}
@Override
diff --git a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java
index 1da42bb1ce..47753e09d3 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/tabsheet/TabsheetScrollingTest.java
@@ -23,6 +23,7 @@ import org.openqa.selenium.interactions.Actions;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TabSheetElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class TabsheetScrollingTest extends MultiBrowserTest {
@@ -51,4 +52,16 @@ public class TabsheetScrollingTest extends MultiBrowserTest {
new Actions(getDriver()).sendKeys(key).perform();
}
+ @Test
+ public void serverChangeShouldShowTab() {
+ openTestURL();
+ $(ButtonElement.class).id(TabsheetScrolling.SELECT_LAST).click();
+ TabSheetElement tabsheetFixed = $(TabSheetElement.class).first();
+ Assert.assertTrue("Select last should scroll last tab into view",
+ tabsheetFixed.getTabCaptions().contains("Tab 99"));
+ $(ButtonElement.class).id(TabsheetScrolling.SELECT_FIRST).click();
+ Assert.assertTrue("Select first should scroll first tab into view",
+ tabsheetFixed.getTabCaptions().contains("Tab 1"));
+
+ }
}