From ec4e470e401a1a8f55b427b04dee08c39ed63d8b Mon Sep 17 00:00:00 2001 From: Pekka Hyvönen Date: Wed, 22 Apr 2015 17:17:18 +0300 Subject: Fixed theming issues with Grid's Sidebar (#17412) - if columns hidable when grid rendered, sidebar button had invalid height - removed border radius from grid sidebar - inherit font color for grid sidebar button Change-Id: Ib35d917b35e701bd736a28f19b34dbece7fcbe71 --- .../grid/basicfeatures/GridBasicFeatures.java | 20 +++++++++++++----- .../grid/basicfeatures/GridSidebarFeatures.java | 24 ++++++++++++++++++++++ .../basicfeatures/server/GridSidebarThemeTest.java | 24 ++++++++++------------ 3 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 2abd603ae4..8c60deaf3c 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -291,7 +291,9 @@ public class GridBasicFeatures extends AbstractComponentTest { // Set varying column widths for (int col = 0; col < COLUMNS; col++) { - grid.getColumn(getColumnProperty(col)).setWidth(100 + col * 50); + Column column = grid.getColumn(getColumnProperty(col)); + column.setWidth(100 + col * 50); + column.setHidable(isColumnHidableByDefault(col)); } grid.addSortListener(new SortListener() { @@ -334,6 +336,14 @@ public class GridBasicFeatures extends AbstractComponentTest { return grid; } + protected boolean isColumnHidableByDefault(int col) { + return false; + } + + protected boolean isColumnHiddenByDefault(int col) { + return false; + } + private void addInternalActions() { createClickAction("Update column order without updating client", "Internals", new Command() { @@ -828,8 +838,8 @@ public class GridBasicFeatures extends AbstractComponentTest { } }, c); - createBooleanAction("Hidable", getColumnProperty(c), false, - new Command() { + createBooleanAction("Hidable", getColumnProperty(c), + isColumnHidableByDefault(c), new Command() { @Override public void execute(Grid c, Boolean hidable, Object propertyId) { @@ -837,8 +847,8 @@ public class GridBasicFeatures extends AbstractComponentTest { } }, getColumnProperty(c)); - createBooleanAction("Hidden", getColumnProperty(c), false, - new Command() { + createBooleanAction("Hidden", getColumnProperty(c), + isColumnHiddenByDefault(c), new Command() { @Override public void execute(Grid c, Boolean hidden, Object propertyId) { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java new file mode 100644 index 0000000000..9494988cf4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java @@ -0,0 +1,24 @@ +/* + * 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.grid.basicfeatures; + +public class GridSidebarFeatures extends GridBasicFeatures { + + @Override + protected boolean isColumnHidableByDefault(int col) { + return true; + } +} diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java index 79327993b0..5262156b41 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java @@ -19,13 +19,11 @@ import java.io.IOException; import java.util.List; import org.junit.Test; -import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.ExpectedConditions; -import com.vaadin.testbench.parallel.Browser; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; +import com.vaadin.tests.components.grid.basicfeatures.GridSidebarFeatures; public class GridSidebarThemeTest extends GridBasicFeaturesTest { @@ -34,18 +32,18 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest { runTestSequence("valo"); } + @Test + public void testValoDark() throws Exception { + runTestSequence("tests-valo-dark"); + } + + @Override + protected Class getUIClass() { + return GridSidebarFeatures.class; + } + private void runTestSequence(String theme) throws IOException { openTestURL("theme=" + theme); - if (getDesiredCapabilities().getBrowserName().equals( - Browser.CHROME.getDesiredCapabilities().getBrowserName())) { - waitUntil(ExpectedConditions.elementToBeClickable(By.id("menu")), 2); - getDriver().findElement(By.id("menu")).click(); - selectMenu("Columns"); - selectMenu("All columns hidable"); - waitUntilLoadingIndicatorNotVisible(); - } else { - selectMenuPath("Component", "Columns", "All columns hidable"); - } compareScreen(theme + "|SidebarClosed"); getSidebarOpenButton().click(); -- cgit v1.2.3