aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/grid
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2015-08-31 22:51:19 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-09-14 08:12:54 +0000
commit9e99e3e793ab14c3623f810b53471dde3d9f9816 (patch)
tree6cd00611dc83f101b9d46280c8d10ee8ab4dd634 /uitest/src/com/vaadin/tests/components/grid
parent47fe6d931ddd550d35ab87d8a38eed4f3e8c7fff (diff)
downloadvaadin-framework-9e99e3e793ab14c3623f810b53471dde3d9f9816.tar.gz
vaadin-framework-9e99e3e793ab14c3623f810b53471dde3d9f9816.zip
Disable sidebar button when grid is disabled. (#18696)
Change-Id: If334cebd85fcfe9b368b1b360181abaadd5cb4ef
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/grid')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridDisabledSideBarTest.java85
1 files changed, 85 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDisabledSideBarTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDisabledSideBarTest.java
new file mode 100644
index 0000000000..0f207b68f2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridDisabledSideBarTest.java
@@ -0,0 +1,85 @@
+package com.vaadin.tests.components.grid;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest;
+
+public class GridDisabledSideBarTest extends GridBasicClientFeaturesTest {
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
+ openTestURL();
+ }
+
+ private void makeColumnHidable() {
+ selectMenuPath("Component", "Columns", "Column 0", "Hidable");
+ }
+
+ private void toggleSideBarMenuAndDisable() {
+ selectMenuPath("Component", "Sidebar", "Open sidebar and disable grid");
+ waitUntil(new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ return !findElement(By.className("v-grid-sidebar-button")).isEnabled();
+ }
+ });
+ }
+ private void clickSideBarButton() {
+ findElement(By.cssSelector(".v-grid-sidebar-button")).click();
+ }
+
+ private void toggleEnabled() {
+ selectMenuPath("Component", "State", "Enabled");
+ }
+
+ private void assertSideBarContainsClass(String cssClass) {
+ assertThat(findElement(By.cssSelector(".v-grid-sidebar")).getAttribute("class"), containsString(cssClass));
+ }
+
+ @Test
+ public void sidebarButtonIsDisabledOnCreation() {
+ selectMenuPath("Component", "State", "Enabled");
+ makeColumnHidable();
+
+ clickSideBarButton();
+
+ assertSideBarContainsClass("closed");
+ }
+
+ @Test
+ public void sidebarButtonCanBeEnabled() {
+ makeColumnHidable();
+
+ clickSideBarButton();
+
+ assertSideBarContainsClass("open");
+ }
+
+ @Test
+ public void sidebarButtonCanBeDisabled() {
+ makeColumnHidable();
+ toggleEnabled();
+
+ clickSideBarButton();
+
+ assertSideBarContainsClass("closed");
+ }
+
+ @Test
+ public void sidebarIsClosedOnDisable() {
+ makeColumnHidable();
+
+ toggleSideBarMenuAndDisable();
+
+ assertSideBarContainsClass("closed");
+ }
+} \ No newline at end of file