summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-09-18 14:26:50 +0300
committerHenri Sara <hesara@vaadin.com>2015-12-16 07:18:37 +0000
commit3aff803172dab49a6e0ac694b3b3d687dc7e976c (patch)
tree469ac91e564baf88852bb73460194b07cf381134 /uitest/src
parent61e83653330399f6ead49f74277410e43368a2cb (diff)
downloadvaadin-framework-3aff803172dab49a6e0ac694b3b3d687dc7e976c.tar.gz
vaadin-framework-3aff803172dab49a6e0ac694b3b3d687dc7e976c.zip
Make it possible to only show collapsible columns in menu (#9811)
Change-Id: I52cd2648d305f44d5688e7a2fcd222e6b167b97b
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractComponentTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java54
-rw-r--r--uitest/src/com/vaadin/tests/components/table/Tables.java17
3 files changed, 86 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
index aca617aa5a..d033443a2c 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
@@ -1,5 +1,6 @@
package com.vaadin.tests.components;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -603,6 +604,20 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>
}
+ protected <TYPE extends Enum<TYPE>> void createSelectAction(
+ String caption,
+ String category,
+ Class<TYPE> enumType,
+ TYPE initialValue,
+ com.vaadin.tests.components.ComponentTestCase.Command<T, TYPE> command) {
+ LinkedHashMap<String, TYPE> options = new LinkedHashMap<String, TYPE>();
+ for (TYPE value : EnumSet.allOf(enumType)) {
+ options.put(value.toString(), value);
+ }
+ createSelectAction(caption, category, options, initialValue.toString(),
+ command);
+ }
+
protected <TYPE> void createMultiClickAction(
String caption,
String category,
diff --git a/uitest/src/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java b/uitest/src/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java
new file mode 100644
index 0000000000..2b053a6d1c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.table.CollapseMenuContent;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class OnlyCollapsibleInMenu extends SingleBrowserTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return Tables.class;
+ }
+
+ @Test
+ public void testOnlyCollapsibleInMenu() {
+ openTestURL();
+ CustomTableElement table = $(CustomTableElement.class).first();
+
+ selectMenuPath("Component", "Columns", "Property 3", "Collapsible");
+ table.getCollapseMenuToggle().click();
+ Assert.assertEquals("Property 3 should still be in the context menu",
+ "Property 3", table.getContextMenu().getItem(2).getText());
+
+ selectMenuPath("Component", "Features", "Collapsible menu content",
+ CollapseMenuContent.COLLAPSIBLE_COLUMNS.toString());
+ table.getCollapseMenuToggle().click();
+ Assert.assertEquals("Property 3 should not be in the context menu",
+ "Property 4", table.getContextMenu().getItem(2).getText());
+
+ selectMenuPath("Component", "Features", "Collapsible menu content",
+ CollapseMenuContent.ALL_COLUMNS.toString());
+ table.getCollapseMenuToggle().click();
+ Assert.assertEquals("Property 3 should again be in the context menu",
+ "Property 3", table.getContextMenu().getItem(2).getText());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/Tables.java b/uitest/src/com/vaadin/tests/components/table/Tables.java
index c8d1061943..e82cb8321f 100644
--- a/uitest/src/com/vaadin/tests/components/table/Tables.java
+++ b/uitest/src/com/vaadin/tests/components/table/Tables.java
@@ -11,6 +11,8 @@ import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.server.Resource;
import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.shared.ui.table.CollapseMenuContent;
+import com.vaadin.shared.ui.table.TableConstants;
import com.vaadin.tests.components.select.AbstractSelectTestCase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
@@ -443,6 +445,8 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T>
createBooleanAction("Sort enabled", CATEGORY_FEATURES, true,
setSortEnabledCommand);
createColumnOptions(true);
+
+ createCollapsibleMenuContentSelect(CATEGORY_FEATURES);
}
private void createAddGeneratedColumnAction(String categoryFeatures) {
@@ -590,6 +594,19 @@ public class Tables<T extends Table> extends AbstractSelectTestCase<T>
});
}
+ private void createCollapsibleMenuContentSelect(String category) {
+ createSelectAction("Collapsible menu content", category,
+ CollapseMenuContent.class,
+ TableConstants.DEFAULT_COLLAPSE_MENU_CONTENT,
+ new Command<T, CollapseMenuContent>() {
+ @Override
+ public void execute(T c, CollapseMenuContent value,
+ Object data) {
+ c.setCollapseMenuContent(value);
+ }
+ });
+ }
+
private void createColumnOptions(boolean init) {
if (!init && !hasCategory(CATEGORY_COLUMNS)) {
return;