summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-09-04 15:05:27 +0300
committerArtur Signell <artur@vaadin.com>2015-09-04 15:05:27 +0300
commitf46be1b2792755cb7d9b111068dd6cf202398c4a (patch)
tree74f7098faee688cc1f1ca1b6ffe9e912338bbcaf /uitest/src
parente603ea3cf91e5dd0893b766f27d400947527fba9 (diff)
parentebceef4d44bcd61605fa92fcf7be8d3678537599 (diff)
downloadvaadin-framework-f46be1b2792755cb7d9b111068dd6cf202398c4a.tar.gz
vaadin-framework-f46be1b2792755cb7d9b111068dd6cf202398c4a.zip
Merge remote-tracking branch 'origin/master' into reconnect-dialog
Change-Id: Ie622160a83116c83b255a26bec297f73f3223ac7
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractComponentTest.java41
-rw-r--r--uitest/src/com/vaadin/tests/components/OutOfSync.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/OutOfSyncTest.java89
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractembedded/EmbeddedWithNullSourceTest.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/button/Buttons2.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java30
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java60
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModel.java37
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModelTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java1
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java24
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java19
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java78
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridFastAsyncUpdate.java148
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java73
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java41
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java243
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDescriptionGeneratorTest.java74
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java20
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java37
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java264
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java296
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java223
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridFocusTest.java79
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java12
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java12
-rw-r--r--uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java75
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java64
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java112
-rw-r--r--uitest/src/com/vaadin/tests/components/table/CustomTableElement.java57
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java50
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java52
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java51
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/window/GridInWindow.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java36
-rw-r--r--uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java48
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowCloseShortcuts.java199
-rw-r--r--uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpen.java33
-rw-r--r--uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java47
-rw-r--r--uitest/src/com/vaadin/tests/debug/ProfilerZeroOverhead.java37
-rw-r--r--uitest/src/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java51
-rw-r--r--uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java14
-rw-r--r--uitest/src/com/vaadin/tests/integration/JSR286Portlet.java14
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java14
-rw-r--r--uitest/src/com/vaadin/tests/push/BasicPushTest.java8
-rw-r--r--uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java94
-rw-r--r--uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java54
-rw-r--r--uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java52
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java92
-rw-r--r--uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java10
-rw-r--r--uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChange.java6
-rw-r--r--uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java16
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Accordions.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java3
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java47
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java10
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java25
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java19
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CommonParts.java79
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/DateFields.java19
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Dragging.java15
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Forms.java31
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Labels.java27
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/MenuBars.java31
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Panels.java29
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/PopupViews.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Sliders.java15
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tables.java51
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java9
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFields.java73
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Trees.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java5
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java26
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java34
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java46
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml3
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/ProfilerCompilationCanary.java48
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/TestingWidgetsetEntryPoint.java83
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/grid/MySelectionModelConnector.java61
110 files changed, 4305 insertions, 694 deletions
diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
index c6ccd1bf4c..ed0f1a9b4f 100644
--- a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
+++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
@@ -40,7 +40,7 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
// Chrome version does not necessarily match the desired version
// because of auto updates...
browserIdentifier = getExpectedUserAgentString(getDesiredCapabilities())
- + "43";
+ + "44";
} else {
browserIdentifier = getExpectedUserAgentString(desiredCapabilities)
+ desiredCapabilities.getVersion();
diff --git a/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java
index ddef40b2d0..c8fc96f596 100644
--- a/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java
+++ b/uitest/src/com/vaadin/tests/application/VaadinSessionAttribute.java
@@ -35,9 +35,13 @@ public class VaadinSessionAttribute extends AbstractTestUI {
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- Notification.show(getSession().getAttribute(ATTR_NAME)
- + " & "
- + getSession().getAttribute(Integer.class));
+ Notification notification = new Notification(
+ getSession().getAttribute(ATTR_NAME)
+ + " & "
+ + getSession().getAttribute(
+ Integer.class));
+ notification.setDelayMsec(Notification.DELAY_FOREVER);
+ notification.show(getPage());
}
}));
}
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
index b289279b86..aca617aa5a 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
@@ -20,6 +20,7 @@ import com.vaadin.server.ThemeResource;
import com.vaadin.tests.util.Log;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component.Focusable;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.themes.BaseTheme;
@@ -242,16 +243,18 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>
createStyleNameSelect(CATEGORY_DECORATIONS);
+ createFocusActions();
}
protected Command<T, Boolean> focusListenerCommand = new Command<T, Boolean>() {
@Override
public void execute(T c, Boolean value, Object data) {
+ FocusNotifier fn = (FocusNotifier) c;
if (value) {
- ((FocusNotifier) c).addListener(AbstractComponentTest.this);
+ fn.addFocusListener(AbstractComponentTest.this);
} else {
- ((FocusNotifier) c).removeListener(AbstractComponentTest.this);
+ fn.removeFocusListener(AbstractComponentTest.this);
}
}
};
@@ -259,10 +262,11 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>
@Override
public void execute(T c, Boolean value, Object data) {
+ BlurNotifier bn = (BlurNotifier) c;
if (value) {
- ((BlurNotifier) c).addListener(AbstractComponentTest.this);
+ bn.addBlurListener(AbstractComponentTest.this);
} else {
- ((BlurNotifier) c).removeListener(AbstractComponentTest.this);
+ bn.removeBlurListener(AbstractComponentTest.this);
}
}
};
@@ -279,6 +283,35 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>
}
+ private void createFocusActions() {
+ if (FocusNotifier.class.isAssignableFrom(getTestClass())) {
+ createFocusListener(CATEGORY_LISTENERS);
+ }
+ if (BlurNotifier.class.isAssignableFrom(getTestClass())) {
+ createBlurListener(CATEGORY_LISTENERS);
+ }
+ if (Focusable.class.isAssignableFrom(getTestClass())) {
+ LinkedHashMap<String, Integer> tabIndexes = new LinkedHashMap<String, Integer>();
+ tabIndexes.put("0", 0);
+ tabIndexes.put("-1", -1);
+ tabIndexes.put("10", 10);
+ createSelectAction("Tab index", "State", tabIndexes, "0",
+ new Command<T, Integer>() {
+ @Override
+ public void execute(T c, Integer tabIndex, Object data) {
+ ((Focusable) c).setTabIndex(tabIndex);
+ }
+ });
+
+ createClickAction("Set focus", "State", new Command<T, Void>() {
+ @Override
+ public void execute(T c, Void value, Object data) {
+ ((Focusable) c).focus();
+ }
+ }, null);
+ }
+ }
+
private void createStyleNameSelect(String category) {
LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
options.put("-", null);
diff --git a/uitest/src/com/vaadin/tests/components/OutOfSync.java b/uitest/src/com/vaadin/tests/components/OutOfSync.java
new file mode 100644
index 0000000000..8cefffc9d1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/OutOfSync.java
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Notification;
+
+public class OutOfSync extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new Button("Click me after 1s to be out of sync");
+ b.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Notification.show("This code will never be reached");
+ }
+ });
+ setContent(b);
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // Remove button but prevent repaint -> causes out of sync
+ // issues
+ getSession().lock();
+ try {
+ setContent(null);
+ getConnectorTracker().markClean(OutOfSync.this);
+ } finally {
+ getSession().unlock();
+ }
+ }
+ });
+ t.start();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Click the button after 1s when it has been removed server side (causing synchronization problems)";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10780;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java
index 0efb519e8d..c6bab3c9b9 100644
--- a/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java
+++ b/uitest/src/com/vaadin/tests/components/OutOfSyncTest.java
@@ -1,55 +1,48 @@
+/*
+ * 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;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Notification;
-
-public class OutOfSyncTest extends AbstractTestUI {
-
- @Override
- protected void setup(VaadinRequest request) {
- Button b = new Button("Click me after 1s to be out of sync");
- b.addClickListener(new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- Notification.show("This code will never be reached");
- }
- });
- setContent(b);
- Thread t = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // Remove button but prevent repaint -> causes out of sync
- // issues
- getSession().lock();
- try {
- setContent(null);
- getConnectorTracker().markClean(OutOfSyncTest.this);
- } finally {
- getSession().unlock();
- }
- }
- });
- t.start();
- }
+import org.junit.Assert;
+import org.junit.Test;
- @Override
- protected String getTestDescription() {
- return "Click the button after 1s when it has been removed server side (causing synchronization problems)";
- }
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class OutOfSyncTest extends MultiBrowserTest {
+
+ @Test
+ public void testClientResync() throws InterruptedException {
+ openTestURL();
+
+ // Wait for server to get rid of the Button
+ sleep(1000);
+
+ // On the first round-trip after the component has been removed, the
+ // server assumes the client will remove the button. How ever (to force
+ // it to be out of sync) the test UI calls markClean() on the Button to
+ // make it not update with the response.
+ $(ButtonElement.class).first().click();
+ Assert.assertTrue(
+ "Button should not have disappeared on the first click.",
+ $(ButtonElement.class).exists());
- @Override
- protected Integer getTicketNumber() {
- return 10780;
+ // Truly out of sync, full resync is forced.
+ $(ButtonElement.class).first().click();
+ Assert.assertFalse("Button should disappear with the second click.",
+ $(ButtonElement.class).exists());
}
}
diff --git a/uitest/src/com/vaadin/tests/components/abstractembedded/EmbeddedWithNullSourceTest.java b/uitest/src/com/vaadin/tests/components/abstractembedded/EmbeddedWithNullSourceTest.java
new file mode 100644
index 0000000000..649ee42986
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/abstractembedded/EmbeddedWithNullSourceTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.abstractembedded;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class EmbeddedWithNullSourceTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ // No Flash on PhantomJS, IE 11 has a timeout issue, looks like a
+ // IEDriver problem, not reproduced running locally.
+ return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
+ Browser.CHROME, Browser.FIREFOX);
+ }
+
+ @Test
+ public void testEmbeddedWithNullSource() throws IOException {
+ openTestURL();
+
+ waitForElementPresent(By.className("v-image"));
+
+ compareScreen("nullSources");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
index 692ca25b07..496a44a6c1 100644
--- a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
+++ b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
@@ -13,8 +13,6 @@ import com.vaadin.data.Property;
import com.vaadin.data.Property.ReadOnlyStatusChangeEvent;
import com.vaadin.data.Property.ReadOnlyStatusChangeListener;
import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.event.FieldEvents.BlurNotifier;
-import com.vaadin.event.FieldEvents.FocusNotifier;
import com.vaadin.tests.components.AbstractComponentTest;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.MenuBar;
@@ -29,15 +27,9 @@ public abstract class AbstractFieldTest<T extends AbstractField> extends
@Override
protected void createActions() {
super.createActions();
+
createBooleanAction("Required", CATEGORY_STATE, false, requiredCommand);
createRequiredErrorSelect(CATEGORY_DECORATIONS);
- if (FocusNotifier.class.isAssignableFrom(getTestClass())) {
- createFocusListener(CATEGORY_LISTENERS);
- }
-
- if (BlurNotifier.class.isAssignableFrom(getTestClass())) {
- createBlurListener(CATEGORY_LISTENERS);
- }
createValueChangeListener(CATEGORY_LISTENERS);
createReadOnlyStatusChangeListener(CATEGORY_LISTENERS);
@@ -52,7 +44,6 @@ public abstract class AbstractFieldTest<T extends AbstractField> extends
// * invalidallowed
// * error indicator
//
- // * tabindex
// * validation visible
// * ShortcutListener
diff --git a/uitest/src/com/vaadin/tests/components/button/Buttons2.java b/uitest/src/com/vaadin/tests/components/button/Buttons2.java
index 7526e7dbc3..4f75dfbfef 100644
--- a/uitest/src/com/vaadin/tests/components/button/Buttons2.java
+++ b/uitest/src/com/vaadin/tests/components/button/Buttons2.java
@@ -42,9 +42,6 @@ public class Buttons2<T extends Button> extends AbstractComponentTest<T>
protected void createActions() {
super.createActions();
- createFocusListener(CATEGORY_LISTENERS);
- createBlurListener(CATEGORY_LISTENERS);
-
createBooleanAction("Disable on click", CATEGORY_FEATURES, false,
disableOnClickCommand);
addClickListener(CATEGORY_LISTENERS);
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
index c2dfdb26c1..40dd43abb2 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
@@ -5,17 +5,27 @@ import java.text.SimpleDateFormat;
import java.util.Locale;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Calendar;
import com.vaadin.ui.components.calendar.CalendarComponentEvents;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler;
import com.vaadin.ui.components.calendar.event.BasicEvent;
-public class NullEventMoveHandler extends AbstractTestUI {
+public class NullEventMoveHandler extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
Calendar calendar = getCalendar();
calendar.setHandler((CalendarComponentEvents.EventMoveHandler) null);
+ calendar.setHandler(new EventClickHandler() {
+
+ @Override
+ public void eventClick(EventClick event) {
+ log("Clicked on " + event.getCalendarEvent().getCaption());
+
+ }
+ });
addComponent(calendar);
}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
index c40cd9ce97..156100310c 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.calendar;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
+import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -23,11 +24,25 @@ public class NullEventMoveHandlerTest extends DndActionsTest {
}
@Test
+ public void eventIsClickableWhenNotMovableInMonthView() {
+ getEvent().click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
+ @Test
public void eventIsNotMovableInWeekView() {
openWeekView();
assertEventCannotBeMoved();
}
+ @Test
+ public void eventIsClickableWhenNotMovableInWeekView() {
+ openWeekView();
+ getEvent().findElement(By.className("v-calendar-event-caption"))
+ .click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
private void assertEventCannotBeMoved() {
int originalPosition = getEventXPosition();
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java
new file mode 100644
index 0000000000..2f96724db1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigation.java
@@ -0,0 +1,15 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxEmptyItemsKeyboardNavigation extends AbstractTestUI {
+ @Override
+ protected void setup(VaadinRequest request) {
+ ComboBox comboBox = new ComboBox();
+ comboBox.addItems("foo", "bar");
+
+ addComponent(comboBox);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java
new file mode 100644
index 0000000000..c5cbc5eea6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.combobox;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsEmptyCollection.empty;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.ComboBoxElement;
+
+public class ComboBoxEmptyItemsKeyboardNavigationTest extends MultiBrowserTest {
+
+ @Test
+ public void navigatingUpOnAnEmptyMenuDoesntThrowErrors() {
+ setDebug(true);
+ openTestURL();
+
+ ComboBoxElement combobox = $(ComboBoxElement.class).first();
+ combobox.sendKeys("a", Keys.ARROW_UP);
+
+ List<WebElement> errors = findElements(By.className("SEVERE"));
+
+ assertThat(errors, empty());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java
new file mode 100644
index 0000000000..407ab7aa04
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.combobox;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.NativeSelectElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.ComboBoxElement;
+
+public class ComboBoxLargeIconsTest extends MultiBrowserTest {
+ @Override
+ protected Class<?> getUIClass() {
+ return com.vaadin.tests.components.combobox.Comboboxes.class;
+ }
+
+ @Test
+ public void testComboBoxIcons() throws Exception {
+ openTestURL();
+ NativeSelectElement iconSelect = $(NativeSelectElement.class).first();
+ iconSelect.selectByText("16x16");
+
+ ComboBoxElement cb = $(ComboBoxElement.class).caption(
+ "Undefined wide select with 50 items").first();
+ cb.openPopup();
+ compareScreen("icons-16x16-page1");
+ cb.openNextPage();
+ compareScreen("icons-16x16-page2");
+ cb.findElement(By.vaadin("#popup/item0")).click();
+ compareScreen("icons-16x16-selected-1-3-5-9");
+
+ iconSelect.selectByText("32x32");
+ cb.openPopup();
+ compareScreen("icons-32x32-page2");
+
+ // Closes the popup
+ cb.openPopup();
+
+ iconSelect.selectByText("64x64");
+
+ ComboBoxElement pageLength0cb = $(ComboBoxElement.class).caption(
+ "Pagelength 0").first();
+ pageLength0cb.openPopup();
+ pageLength0cb.findElement(By.vaadin("#popup/item1")).click();
+
+ ComboBoxElement cb200px = $(ComboBoxElement.class).caption(
+ "200px wide select with 50 items").first();
+ cb200px.openPopup();
+ cb200px.findElement(By.vaadin("#popup/item1")).click();
+
+ ComboBoxElement cb150px = $(ComboBoxElement.class).caption(
+ "150px wide select with 5 items").first();
+ new Actions(driver).sendKeys(cb150px, Keys.DOWN).perform();
+
+ compareScreen("icons-64x64-page1-highlight-first");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java
new file mode 100644
index 0000000000..9f1c4b9e03
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.HorizontalLayout;
+
+@Theme("valo")
+public class ComboboxPopupScrolling extends AbstractTestUIWithLog {
+ @Override
+ protected void setup(VaadinRequest request) {
+ ComboBox combobox = new ComboBox("100px wide combobox");
+ combobox.setWidth("100px");
+ combobox.addItem("AMERICAN SAMOA");
+ combobox.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox2 = new ComboBox("250px wide combobox");
+ combobox2.setWidth("250px");
+ combobox2.addItem("AMERICAN SAMOA");
+ combobox2.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox3 = new ComboBox("Undefined wide combobox");
+ combobox3.setWidth(null);
+ combobox3.addItem("AMERICAN SAMOA");
+ combobox3.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox4 = new ComboBox("Another 100px wide combobox");
+ combobox4.setWidth("100px");
+ for (int i = 0; i < 10; i++) {
+ combobox4.addItem("AMERICAN SAMOA " + i);
+ combobox4.addItem("ANTIGUA AND BARBUDA " + i);
+ }
+
+ HorizontalLayout hl = new HorizontalLayout(combobox, combobox2,
+ combobox3, combobox4);
+ addComponent(hl);
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
new file mode 100644
index 0000000000..ec5bc088da
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.combobox;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ComboboxPopupScrollingTest extends MultiBrowserTest {
+
+ @Test
+ public void testNoScrollbarsValo() {
+ testNoScrollbars("valo");
+ }
+
+ @Test
+ public void testNoScrollbarsChameleon() {
+ testNoScrollbars("chameleon");
+ }
+
+ @Test
+ public void testNoScrollbarsRuno() {
+ testNoScrollbars("runo");
+ }
+
+ @Test
+ public void testNoScrollbarsReindeer() {
+ testNoScrollbars("reindeer");
+ }
+
+ private void testNoScrollbars(String theme) {
+ openTestURL("theme=" + theme);
+
+ for (CustomComboBoxElement cb : $(CustomComboBoxElement.class).all()) {
+ String caption = cb.getCaption();
+ cb.openPopup();
+ WebElement popup = cb.getSuggestionPopup();
+ WebElement scrollable = popup.findElement(By
+ .className("v-filterselect-suggestmenu"));
+ assertNoHorizontalScrollbar(scrollable, caption);
+ assertNoVerticalScrollbar(scrollable, caption);
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java b/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java
new file mode 100644
index 0000000000..697d5eb932
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java
@@ -0,0 +1,40 @@
+/*
+ * 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.combobox;
+
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.ui.ComboBox")
+public class CustomComboBoxElement extends ComboBoxElement {
+ private static org.openqa.selenium.By bySuggestionPopup = By
+ .vaadin("#popup");
+
+ public WebElement getSuggestionPopup() {
+ ensurePopupOpen();
+ return findElement(bySuggestionPopup);
+ }
+
+ private void ensurePopupOpen() {
+ if (!isElementPresent(bySuggestionPopup)) {
+ openPopup();
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java b/uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java
index 7d706ecd30..d5e01a9de8 100644
--- a/uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/CustomRendererTest.java
@@ -47,8 +47,8 @@ public class CustomRendererTest extends MultiBrowserTest {
.getText());
grid.getCell(0, 1).click();
- assertEquals("row: 0, key: 0", grid.getCell(0, 1).getText());
- assertEquals("key: 0, itemId: " + CustomRenderer.ITEM_ID,
+ assertEquals("row: 0, key: 1", grid.getCell(0, 1).getText());
+ assertEquals("key: 1, itemId: " + CustomRenderer.ITEM_ID,
findDebugLabel().getText());
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModel.java b/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModel.java
new file mode 100644
index 0000000000..008c24cdd3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModel.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.ui.Grid.MultiSelectionModel;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class GridCustomSelectionModel extends AbstractTestUI {
+
+ public static class MySelectionModel extends MultiSelectionModel {
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ PersonTestGrid grid = new PersonTestGrid(500);
+ grid.setSelectionModel(new MySelectionModel());
+ addComponent(grid);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModelTest.java b/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModelTest.java
new file mode 100644
index 0000000000..976e1e78fe
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridCustomSelectionModelTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridCustomSelectionModelTest extends MultiBrowserTest {
+
+ @Test
+ public void testCustomSelectionModel() {
+ setDebug(true);
+ openTestURL();
+
+ GridElement grid = $(GridElement.class).first();
+ GridCellElement cell = grid.getCell(0, 0);
+ assertTrue("First column of Grid should not have an input element",
+ cell.findElements(By.className("input")).isEmpty());
+
+ assertFalse("Row should not be selected initially", grid.getRow(0)
+ .isSelected());
+
+ cell.click(5, 5);
+ assertTrue("Click should select row", grid.getRow(0).isSelected());
+ cell.click(5, 5);
+ assertFalse("Click should deselect row", grid.getRow(0).isSelected());
+
+ grid.sendKeys(Keys.SPACE);
+ assertTrue("Space should select row", grid.getRow(0).isSelected());
+ grid.sendKeys(Keys.SPACE);
+ assertFalse("Space should deselect row", grid.getRow(0).isSelected());
+
+ assertNoErrorNotifications();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java
index 1032378a2d..3d7f6da587 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java
@@ -56,7 +56,6 @@ public class GridDetailsDetach extends AbstractTestUI {
layout.addComponent(new Button("Reattach Grid",
new Button.ClickListener() {
-
@Override
public void buttonClick(ClickEvent event) {
gridContainer.removeAllComponents();
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java
index fc79fd1b68..7406daeacd 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetachTest.java
@@ -70,4 +70,28 @@ public class GridDetailsDetachTest extends MultiBrowserTest {
Assert.assertEquals("Spacer content not visible",
"Extra data for Bean 5", spacers.get(1).getText());
}
+
+ @Test
+ public void testDetachAndImmediateReattach() {
+ setDebug(true);
+ openTestURL();
+
+ $(GridElement.class).first().getCell(3, 0).click();
+ $(GridElement.class).first().getCell(5, 0).click();
+
+ assertNoErrorNotifications();
+
+ // Detach and Re-attach Grid
+ $(ButtonElement.class).get(1).click();
+
+ assertNoErrorNotifications();
+
+ List<WebElement> spacers = findElements(By.className("v-grid-spacer"));
+ Assert.assertEquals("Not enough spacers in DOM", 2, spacers.size());
+ Assert.assertEquals("Spacer content not visible",
+ "Extra data for Bean 3", spacers.get(0).getText());
+ Assert.assertEquals("Spacer content not visible",
+ "Extra data for Bean 5", spacers.get(1).getText());
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
index 33f66d35be..a395d7e721 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
@@ -86,9 +86,7 @@ public class GridDetailsLocationTest extends MultiBrowserTest {
for (int rowIndex : params) {
- data.add(new Param(rowIndex, false, false));
data.add(new Param(rowIndex, true, false));
- data.add(new Param(rowIndex, false, true));
data.add(new Param(rowIndex, true, true));
}
@@ -138,23 +136,6 @@ public class GridDetailsLocationTest extends MultiBrowserTest {
}
@Test
- public void testDetailsHeightWithNoGenerator() {
- openTestURL();
- toggleAndScroll(5);
-
- verifyDetailsRowHeight(5, detailsDefaultHeight, 0);
- verifyDetailsDecoratorLocation(5, 0, 0);
-
- toggleAndScroll(0);
-
- verifyDetailsRowHeight(0, detailsDefaultHeight, 0);
- verifyDetailsDecoratorLocation(0, 0, 1);
-
- verifyDetailsRowHeight(5, detailsDefaultHeight, 1);
- verifyDetailsDecoratorLocation(5, 1, 0);
- }
-
- @Test
public void testDetailsHeightWithGenerator() {
openTestURL();
useGenerator(true);
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java
new file mode 100644
index 0000000000..d2414a8c40
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import com.vaadin.tests.util.PersonContainer;
+import com.vaadin.ui.Grid;
+
+public class GridEditorFrozenColumnsUI extends GridEditorUI {
+
+ @Override
+ protected Grid createGrid(PersonContainer container) {
+ Grid grid = super.createGrid(container);
+
+ grid.setFrozenColumnCount(2);
+
+ grid.setWidth("600px");
+
+ return grid;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 16727;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Frozen columns should also freeze cells in editor.";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
new file mode 100644
index 0000000000..75d71a3c40
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridEditorFrozenColumnsUITest extends MultiBrowserTest {
+
+ @Test
+ public void testEditorWithFrozenColumns() throws IOException {
+ openTestURL();
+
+ openEditor(10);
+
+ compareScreen("noscroll");
+
+ scrollGridHorizontallyTo(100);
+
+ compareScreen("scrolled");
+ }
+
+ private void openEditor(int rowIndex) {
+ GridElement grid = $(GridElement.class).first();
+
+ GridCellElement cell = grid.getCell(rowIndex, 1);
+
+ new Actions(driver).moveToElement(cell).doubleClick().build().perform();
+ }
+
+ private void scrollGridHorizontallyTo(double px) {
+ executeScript("arguments[0].scrollLeft = " + px,
+ getGridHorizontalScrollbar());
+ }
+
+ private Object executeScript(String script, WebElement element) {
+ final WebDriver driver = getDriver();
+ if (driver instanceof JavascriptExecutor) {
+ final JavascriptExecutor je = (JavascriptExecutor) driver;
+ return je.executeScript(script, element);
+ } else {
+ throw new IllegalStateException("current driver "
+ + getDriver().getClass().getName() + " is not a "
+ + JavascriptExecutor.class.getSimpleName());
+ }
+ }
+
+ private WebElement getGridHorizontalScrollbar() {
+ return getDriver()
+ .findElement(
+ By.xpath("//div[contains(@class, \"v-grid-scroller-horizontal\")]"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
index 60e241bae3..0a302967e8 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
@@ -28,6 +28,10 @@ public class GridEditorUI extends AbstractTestUI {
protected void setup(VaadinRequest request) {
PersonContainer container = PersonContainer.createWithTestData();
+ addComponent(createGrid(container));
+ }
+
+ protected Grid createGrid(PersonContainer container) {
Grid grid = new Grid(container);
// Don't use address since there's no converter
@@ -43,7 +47,7 @@ public class GridEditorUI extends AbstractTestUI {
grid.getColumn("phoneNumber").getEditorField().setReadOnly(true);
- addComponent(grid);
+ return grid;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
index 47dc90e33a..3d0b3bb071 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
@@ -45,7 +45,7 @@ public class GridEditorUITest extends MultiBrowserTest {
openEditor(10);
- assertTrue("Edtor should be opened with a password field",
+ assertTrue("Editor should be opened with a password field",
isElementPresent(PasswordFieldElement.class));
assertFalse("Notification was present",
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridFastAsyncUpdate.java b/uitest/src/com/vaadin/tests/components/grid/GridFastAsyncUpdate.java
new file mode 100644
index 0000000000..31fe0275a5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridFastAsyncUpdate.java
@@ -0,0 +1,148 @@
+package com.vaadin.tests.components.grid;
+
+import java.util.Calendar;
+import java.util.Random;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.logging.Level;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.annotations.Theme;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.event.SelectionEvent;
+import com.vaadin.event.SelectionEvent.SelectionListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.VerticalLayout;
+
+@Push
+@Theme("valo")
+@SuppressWarnings("serial")
+public class GridFastAsyncUpdate extends AbstractTestUI {
+
+ private final Runnable addRowsTask = new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("Logging...");
+ try {
+ Random random = new Random();
+ while (!Thread.currentThread().isInterrupted()) {
+ Thread.sleep(random.nextInt(100));
+
+ GridFastAsyncUpdate.this.access(new Runnable() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+
+ ++counter;
+ Item item = container.addItem(counter);
+ item.getItemProperty("sequenceNumber").setValue(
+ String.valueOf(counter));
+ item.getItemProperty("millis").setValue(
+ String.valueOf(Calendar.getInstance()
+ .getTimeInMillis() - loggingStart));
+ item.getItemProperty("level").setValue(
+ Level.INFO.toString());
+ item.getItemProperty("message").setValue("Message");
+ if (grid != null && !scrollLock) {
+ grid.scrollToEnd();
+ }
+ }
+ });
+ }
+ } catch (InterruptedException e) {
+ System.out.println("logging thread interrupted");
+ }
+ }
+ };
+
+ private int counter;
+
+ private Grid grid;
+ private IndexedContainer container;
+ private long loggingStart;
+ private volatile boolean scrollLock = false;
+
+ @Override
+ protected void setup(VaadinRequest vaadinRequest) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setSizeFull();
+ layout.setMargin(true);
+ addComponent(layout);
+
+ HorizontalLayout buttons = new HorizontalLayout();
+ layout.addComponent(buttons);
+
+ final ExecutorService logExecutor = Executors.newSingleThreadExecutor();
+
+ final Button logButton = new Button("Start logging");
+ logButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if ("Start logging".equals(logButton.getCaption())) {
+ loggingStart = Calendar.getInstance().getTimeInMillis();
+ logExecutor.submit(addRowsTask);
+ logButton.setCaption("Stop logging");
+ } else {
+ System.out.println("Stop logging...");
+ try {
+ logExecutor.shutdownNow();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ logButton.setCaption("Start logging");
+ }
+ }
+ });
+ buttons.addComponent(logButton);
+
+ final Button scrollButton = new Button("Stop scrolling");
+ scrollButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (!scrollLock) {
+ System.out.println("Stop scrolling");
+ scrollButton.setCaption("Start scrolling");
+ scrollLock = true;
+ } else {
+ System.out.println("Start scrolling");
+ scrollButton.setCaption("Stop scrolling");
+ scrollLock = false;
+ }
+ }
+ });
+ buttons.addComponent(scrollButton);
+
+ container = new IndexedContainer();
+ container.addContainerProperty("sequenceNumber", String.class, null);
+ container.addContainerProperty("millis", String.class, null);
+ container.addContainerProperty("level", String.class, null);
+ container.addContainerProperty("message", String.class, null);
+
+ grid = new Grid(container);
+ grid.setWidth("100%");
+ grid.setImmediate(true);
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ grid.addSelectionListener(new SelectionListener() {
+ @Override
+ public void select(final SelectionEvent event) {
+ if (grid.getSelectedRow() != null) {
+ disableScroll();
+ }
+ }
+ });
+
+ layout.addComponent(grid);
+ layout.setExpandRatio(grid, 1.0f);
+ }
+
+ protected void disableScroll() {
+ scrollLock = true;
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java
new file mode 100644
index 0000000000..194a9a3acc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.event.SelectionEvent;
+import com.vaadin.event.SelectionEvent.SelectionListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.VerticalSplitPanel;
+
+public class GridScrollToLineWhileResizing extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ final VerticalSplitPanel vsp = new VerticalSplitPanel();
+ vsp.setWidth(500, Unit.PIXELS);
+ vsp.setHeight(500, Unit.PIXELS);
+ vsp.setSplitPosition(100, Unit.PERCENTAGE);
+ addComponent(vsp);
+
+ IndexedContainer indexedContainer = new IndexedContainer();
+ indexedContainer.addContainerProperty("column1", String.class, "");
+
+ for (int i = 0; i < 100; i++) {
+ Item addItem = indexedContainer.addItem(i);
+ addItem.getItemProperty("column1").setValue("cell" + i);
+ }
+
+ final Grid grid = new Grid(indexedContainer);
+ grid.setSizeFull();
+
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ grid.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void select(SelectionEvent event) {
+ vsp.setSplitPosition(50, Unit.PERCENTAGE);
+ grid.scrollTo(event.getSelected().iterator().next());
+ }
+ });
+
+ vsp.setFirstComponent(grid);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests scrollToLine while moving SplitPanel split position to resize the Grid on the same round-trip.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java
new file mode 100644
index 0000000000..aee1db7a85
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridScrollToLineWhileResizingTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrollToLineWorksWhileMovingSplitProgrammatically() {
+ openTestURL();
+
+ $(GridElement.class).first().getCell(21, 0).click();
+
+ List<WebElement> cells = findElements(By.className("v-grid-cell"));
+ boolean foundCell21 = false;
+ for (WebElement cell : cells) {
+ if ("cell21".equals(cell.getText())) {
+ foundCell21 = true;
+ }
+ }
+
+ assertTrue(foundCell21);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java
new file mode 100644
index 0000000000..4d44eeb248
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import com.vaadin.server.ClassResource;
+import com.vaadin.server.Resource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.integration.FlagSeResource;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.renderers.ImageRenderer;
+
+public class GridWithBrokenRenderer extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid grid = new Grid();
+ grid.addColumn("short", String.class);
+ grid.addColumn("icon", Resource.class);
+ grid.addColumn("country", String.class);
+
+ grid.getColumn("icon").setRenderer(new ImageRenderer());
+ addComponent(grid);
+
+ grid.addRow("FI", new ClassResource("fi.gif"), "Finland");
+ grid.addRow("SE", new FlagSeResource(), "Sweden");
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java
new file mode 100644
index 0000000000..011c8c92ce
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class GridWithBrokenRendererTest extends SingleBrowserTest {
+
+ @Test
+ public void ensureRendered() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+ assertRow(grid, 0, "FI", "", "Finland");
+ assertRow(grid, 1, "SE", "", "Sweden");
+ }
+
+ private void assertRow(GridElement grid, int row, String... texts) {
+ for (int column = 0; column < texts.length; column++) {
+ Assert.assertEquals("Cell " + row + "," + column, texts[column],
+ grid.getCell(row, column).getText());
+ }
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java b/uitest/src/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java
index b38178b156..2e86053ef3 100644
--- a/uitest/src/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/JavaScriptRenderersTest.java
@@ -43,6 +43,6 @@ public class JavaScriptRenderersTest extends MultiBrowserTest {
// Verify onbrowserevent
cell_1_1.click();
Assert.assertTrue(cell_1_1.getText().startsWith(
- "Clicked 1 with key 1 at"));
+ "Clicked 1 with key 2 at"));
}
}
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 ef51cdf446..479ece71ca 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -29,6 +29,8 @@ import java.util.Random;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.data.sort.Sort;
import com.vaadin.data.sort.SortOrder;
@@ -48,7 +50,9 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Field;
import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.CellDescriptionGenerator;
import com.vaadin.ui.Grid.CellReference;
import com.vaadin.ui.Grid.CellStyleGenerator;
import com.vaadin.ui.Grid.Column;
@@ -57,10 +61,15 @@ import com.vaadin.ui.Grid.ColumnReorderListener;
import com.vaadin.ui.Grid.ColumnVisibilityChangeEvent;
import com.vaadin.ui.Grid.ColumnVisibilityChangeListener;
import com.vaadin.ui.Grid.DetailsGenerator;
+import com.vaadin.ui.Grid.EditorCloseEvent;
+import com.vaadin.ui.Grid.EditorListener;
+import com.vaadin.ui.Grid.EditorMoveEvent;
+import com.vaadin.ui.Grid.EditorOpenEvent;
import com.vaadin.ui.Grid.FooterCell;
import com.vaadin.ui.Grid.HeaderCell;
import com.vaadin.ui.Grid.HeaderRow;
import com.vaadin.ui.Grid.MultiSelectionModel;
+import com.vaadin.ui.Grid.RowDescriptionGenerator;
import com.vaadin.ui.Grid.RowReference;
import com.vaadin.ui.Grid.RowStyleGenerator;
import com.vaadin.ui.Grid.SelectionMode;
@@ -123,6 +132,45 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
};
+ private RowDescriptionGenerator rowDescriptionGenerator = new RowDescriptionGenerator() {
+
+ @Override
+ public String getDescription(RowReference row) {
+ return "Row tooltip for row " + row.getItemId();
+ }
+ };
+
+ private CellDescriptionGenerator cellDescriptionGenerator = new CellDescriptionGenerator() {
+
+ @Override
+ public String getDescription(CellReference cell) {
+ if ("Column 0".equals(cell.getPropertyId())) {
+ return "Cell tooltip for row " + cell.getItemId()
+ + ", column 0";
+ } else {
+ return null;
+ }
+ }
+ };
+
+ private ItemClickListener editorOpeningItemClickListener = new ItemClickListener() {
+
+ @Override
+ public void itemClick(ItemClickEvent event) {
+ grid.editItem(event.getItemId());
+ }
+ };
+
+ private ValueChangeListener reactiveValueChanger = new ValueChangeListener() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public void valueChange(ValueChangeEvent event) {
+ Object id = grid.getEditedItemId();
+ grid.getContainerDataSource().getContainerProperty(id, "Column 2")
+ .setValue("Modified");
+ }
+ };
+
private ColumnReorderListener columnReorderListener = new ColumnReorderListener() {
@Override
@@ -273,6 +321,7 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
new NumberRenderer(new DecimalFormat("0,000.00",
DecimalFormatSymbols.getInstance(new Locale("fi",
"FI")))));
+
grid.getColumn(getColumnProperty(col++)).setRenderer(
new DateRenderer(new SimpleDateFormat("dd.MM.yy HH:mm")));
grid.getColumn(getColumnProperty(col++)).setRenderer(
@@ -362,49 +411,58 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
private void addFilterActions() {
- createClickAction("Column 1 starts with \"(23\"", "Filter",
- new Command<Grid, Void>() {
- @Override
- public void execute(Grid grid, Void value, Object data) {
- ds.addContainerFilter(new Filter() {
+ createBooleanAction("Column 1 starts with \"(23\"", "Filter", false,
+ new Command<Grid, Boolean>() {
+ Filter filter = new Filter() {
+ @Override
+ public boolean passesFilter(Object itemId, Item item) {
+ return item.getItemProperty("Column 1").getValue()
+ .toString().startsWith("(23");
+ }
- @Override
- public boolean passesFilter(Object itemId, Item item)
- throws UnsupportedOperationException {
- return item.getItemProperty("Column 1")
- .getValue().toString()
- .startsWith("(23");
- }
+ @Override
+ public boolean appliesToProperty(Object propertyId) {
+ return propertyId.equals("Column 1");
+ }
+ };
- @Override
- public boolean appliesToProperty(Object propertyId) {
- return propertyId.equals("Column 1");
- }
- });
+ @Override
+ public void execute(Grid grid, Boolean value, Object data) {
+ if (value) {
+ ds.addContainerFilter(filter);
+ } else {
+ ds.removeContainerFilter(filter);
+ }
}
- }, null);
+ });
- createClickAction("Add impassable filter", "Filter",
- new Command<Grid, Void>() {
- @Override
- public void execute(Grid c, Void value, Object data) {
- ds.addContainerFilter(new Filter() {
- @Override
- public boolean passesFilter(Object itemId, Item item)
- throws UnsupportedOperationException {
- return false;
- }
+ createBooleanAction("Impassable filter", "Filter", false,
+ new Command<Grid, Boolean>() {
+ Filter filter = new Filter() {
+ @Override
+ public boolean passesFilter(Object itemId, Item item) {
+ return false;
+ }
- @Override
- public boolean appliesToProperty(Object propertyId) {
- return true;
- }
- });
+ @Override
+ public boolean appliesToProperty(Object propertyId) {
+ return true;
+ }
+ };
+
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ if (value) {
+ ds.addContainerFilter(filter);
+ } else {
+ ds.removeContainerFilter(filter);
+ }
}
- }, null);
+ });
}
protected void createGridActions() {
+
LinkedHashMap<String, String> primaryStyleNames = new LinkedHashMap<String, String>();
primaryStyleNames.put("v-grid", "v-grid");
primaryStyleNames.put("v-escalator", "v-escalator");
@@ -594,6 +652,25 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+ createBooleanAction("Row description generator", "State", false,
+ new Command<Grid, Boolean>() {
+
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ c.setRowDescriptionGenerator(value ? rowDescriptionGenerator
+ : null);
+ }
+ });
+
+ createBooleanAction("Cell description generator", "State", false,
+ new Command<Grid, Boolean>() {
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ c.setCellDescriptionGenerator(value ? cellDescriptionGenerator
+ : null);
+ }
+ });
+
LinkedHashMap<String, Integer> frozenOptions = new LinkedHashMap<String, Integer>();
for (int i = -1; i <= COLUMNS; i++) {
frozenOptions.put(String.valueOf(i), Integer.valueOf(i));
@@ -638,6 +715,39 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+
+ createBooleanAction("EditorOpeningItemClickListener", "State", false,
+ new Command<Grid, Boolean>() {
+
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ if (!value) {
+ c.removeItemClickListener(editorOpeningItemClickListener);
+ } else {
+ c.addItemClickListener(editorOpeningItemClickListener);
+ }
+ }
+
+ });
+ createBooleanAction("ReactiveValueChanger", "State", false,
+ new Command<Grid, Boolean>() {
+
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ Field<?> targetField = grid.getEditorFieldGroup()
+ .getField("Column 0");
+ if (targetField != null) {
+ if (!value) {
+ targetField
+ .removeValueChangeListener(reactiveValueChanger);
+ } else {
+ targetField
+ .addValueChangeListener(reactiveValueChanger);
+ }
+ }
+ }
+
+ });
createBooleanAction("ColumnReorderListener", "State", false,
new Command<Grid, Boolean>() {
@@ -661,7 +771,6 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
}
});
-
createBooleanAction("Single select allow deselect", "State",
singleSelectAllowDeselect, new Command<Grid, Boolean>() {
@Override
@@ -683,6 +792,26 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
c.setColumnReorderingAllowed(value);
}
});
+
+ createClickAction("Select all", "State", new Command<Grid, String>() {
+ @Override
+ public void execute(Grid c, String value, Object data) {
+ SelectionModel selectionModel = c.getSelectionModel();
+ if (selectionModel instanceof SelectionModel.Multi) {
+ ((SelectionModel.Multi) selectionModel).selectAll();
+ }
+ }
+ }, null);
+
+ createClickAction("Select none", "State", new Command<Grid, String>() {
+ @Override
+ public void execute(Grid c, String value, Object data) {
+ SelectionModel selectionModel = c.getSelectionModel();
+ if (selectionModel instanceof SelectionModel.Multi) {
+ ((SelectionModel.Multi) selectionModel).deselectAll();
+ }
+ }
+ }, null);
}
protected void createHeaderActions() {
@@ -1045,6 +1174,18 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+
+ createClickAction("All columns expanding, Col 0 has max width of 30px",
+ "Columns", new Command<Grid, Boolean>() {
+
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ for (Column col : grid.getColumns()) {
+ col.setWidthUndefined();
+ }
+ grid.getColumns().get(0).setMaximumWidth(30);
+ }
+ }, null);
}
private static String getColumnProperty(int c) {
@@ -1218,6 +1359,14 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
}
});
+ createBooleanAction("Buffered mode", "Editor", true,
+ new Command<Grid, Boolean>() {
+ @Override
+ public void execute(Grid c, Boolean value, Object data) {
+ c.setEditorBuffered(value);
+ }
+ });
+
createClickAction("Edit item 5", "Editor", new Command<Grid, String>() {
@Override
public void execute(Grid c, String value, Object data) {
@@ -1265,6 +1414,30 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
c.setEditorCancelCaption("ʃǝɔuɐↃ");
}
}, null);
+
+ createClickAction("Add editor state listener", "Editor",
+ new Command<Grid, String>() {
+ @Override
+ public void execute(Grid grid, String value, Object data) {
+ grid.addEditorListener(new EditorListener() {
+ @Override
+ public void editorOpened(EditorOpenEvent e) {
+ log("Editor opened");
+ }
+
+ @Override
+ public void editorMoved(EditorMoveEvent e) {
+ log("Editor moved");
+ }
+
+ @Override
+ public void editorClosed(EditorCloseEvent e) {
+ log("Editor closed");
+ }
+ });
+ }
+ }, null);
+
}
@SuppressWarnings("boxing")
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
index a307aaca16..a169e701c0 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridColumnHidingTest.java
@@ -823,6 +823,7 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest {
@Test
public void testColumnHiding_detailsRowIsOpen_renderedCorrectly() {
+ selectMenuPath("Component", "Row details", "Set generator");
selectMenuPath("Component", "Row details", "Toggle details for...",
"Row 1");
assertColumnHeaderOrder(0, 1, 2, 3, 4);
@@ -870,7 +871,10 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest {
selectMenuPath("Component", "Columns", "Column 0", "Hidable");
getSidebarOpenButton().click();
verifySidebarOpened();
- findElement(By.className("v-app")).click();
+ // Click somewhere far from Grid.
+ new Actions(getDriver())
+ .moveToElement(findElement(By.className("v-app")), 600, 600)
+ .click().perform();
verifySidebarClosed();
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDescriptionGeneratorTest.java
new file mode 100644
index 0000000000..ed712361a6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDescriptionGeneratorTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+public class GridDescriptionGeneratorTest extends GridBasicFeaturesTest {
+
+ @Test
+ public void testCellDescription() {
+ openTestURL();
+ selectMenuPath("Component", "State", "Cell description generator");
+
+ getGridElement().getCell(1, 0).showTooltip();
+ String tooltipText = findElement(By.className("v-tooltip-text"))
+ .getText();
+ assertEquals("Tooltip text", "Cell tooltip for row 1, column 0",
+ tooltipText);
+
+ getGridElement().getCell(1, 1).showTooltip();
+ assertTrue("Tooltip should not be present in cell (1, 1) ",
+ findElement(By.className("v-tooltip-text")).getText().isEmpty());
+ }
+
+ @Test
+ public void testRowDescription() {
+ openTestURL();
+ selectMenuPath("Component", "State", "Row description generator");
+
+ getGridElement().getCell(5, 3).showTooltip();
+ String tooltipText = findElement(By.className("v-tooltip-text"))
+ .getText();
+ assertEquals("Tooltip text", "Row tooltip for row 5", tooltipText);
+
+ getGridElement().getCell(15, 3).showTooltip();
+ tooltipText = findElement(By.className("v-tooltip-text")).getText();
+ assertEquals("Tooltip text", "Row tooltip for row 15", tooltipText);
+ }
+
+ @Test
+ public void testRowAndCellDescription() {
+ openTestURL();
+ selectMenuPath("Component", "State", "Row description generator");
+ selectMenuPath("Component", "State", "Cell description generator");
+
+ getGridElement().getCell(5, 0).showTooltip();
+ String tooltipText = findElement(By.className("v-tooltip-text"))
+ .getText();
+ assertEquals("Tooltip text", "Cell tooltip for row 5, column 0",
+ tooltipText);
+
+ getGridElement().getCell(5, 3).showTooltip();
+ tooltipText = findElement(By.className("v-tooltip-text")).getText();
+ assertEquals("Tooltip text", "Row tooltip for row 5", tooltipText);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java
index 88158c7f6f..01e7e52923 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java
@@ -35,8 +35,8 @@ import com.vaadin.shared.ui.grid.ScrollDestination;
import com.vaadin.testbench.By;
import com.vaadin.testbench.ElementQuery;
import com.vaadin.testbench.TestBenchElement;
-import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest;
+import com.vaadin.tests.tb3.newelements.FixedNotificationElement;
public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
@@ -59,14 +59,10 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
getGridElement().getDetails(1));
}
- @Test
- public void nullRendererShowsDetailsPlaceholder() {
+ @Test(expected = NoSuchElementException.class)
+ public void nullRendererDoesNotShowDetailsPlaceholder() {
toggleDetailsFor(1);
- TestBenchElement details = getGridElement().getDetails(1);
- assertNotNull("details for row 1 should not exist at the start",
- details);
- assertTrue("details should've been empty for null renderer", details
- .getText().isEmpty());
+ getGridElement().getDetails(1);
}
@Test
@@ -79,14 +75,12 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
details.getText().startsWith("Row: 1."));
}
- @Test
- public void openDetailsThenAppyRenderer() {
+ @Test(expected = NoSuchElementException.class)
+ public void openDetailsThenAppyRendererShouldNotShowDetails() {
toggleDetailsFor(1);
selectMenuPath(SET_GENERATOR);
- TestBenchElement details = getGridElement().getDetails(1);
- assertTrue("Unexpected details content",
- details.getText().startsWith("Row: 1."));
+ getGridElement().getDetails(1);
}
@Test
@@ -112,12 +106,12 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
@Test
public void errorUpdaterShowsErrorNotification() {
assertFalse("No notifications should've been at the start",
- $(NotificationElement.class).exists());
+ $(FixedNotificationElement.class).exists());
- toggleDetailsFor(1);
selectMenuPath(SET_FAULTY_GENERATOR);
+ toggleDetailsFor(1);
- ElementQuery<NotificationElement> notification = $(NotificationElement.class);
+ ElementQuery<FixedNotificationElement> notification = $(FixedNotificationElement.class);
assertTrue("Was expecting an error notification here",
notification.exists());
notification.first().close();
@@ -126,13 +120,25 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
getGridElement().getDetails(1).getText());
}
- @Test
- public void updaterStillWorksAfterError() {
+ @Test(expected = NoSuchElementException.class)
+ public void detailsClosedWhenResettingGenerator() {
+
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(1);
selectMenuPath(SET_FAULTY_GENERATOR);
- $(NotificationElement.class).first().close();
+ getGridElement().getDetails(1);
+ }
+
+ @Test
+ public void settingNewGeneratorStillWorksAfterError() {
+ selectMenuPath(SET_FAULTY_GENERATOR);
+ toggleDetailsFor(1);
+ $(FixedNotificationElement.class).first().close();
+ toggleDetailsFor(1);
+
selectMenuPath(SET_GENERATOR);
+ toggleDetailsFor(1);
assertNotEquals(
"New details should've been generated even after error", "",
@@ -184,6 +190,7 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
@Test
public void rowElementClassNames() {
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(0);
toggleDetailsFor(1);
@@ -196,25 +203,28 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
@Test
public void scrollDownToRowWithDetails() {
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(100);
scrollToRow(100, ScrollDestination.ANY);
- Range validScrollRange = Range.between(1700, 1715);
+ Range validScrollRange = Range.between(1691, 1706);
assertTrue(validScrollRange.contains(getGridVerticalScrollPos()));
}
@Test
public void scrollUpToRowWithDetails() {
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(100);
scrollGridVerticallyTo(999999);
scrollToRow(100, ScrollDestination.ANY);
- Range validScrollRange = Range.between(1990, 2010);
+ Range validScrollRange = Range.between(1981, 2001);
assertTrue(validScrollRange.contains(getGridVerticalScrollPos()));
}
@Test
public void cannotScrollBeforeTop() {
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(1);
scrollToRow(0, ScrollDestination.END);
assertEquals(0, getGridVerticalScrollPos());
@@ -222,10 +232,11 @@ public class GridDetailsClientTest extends GridBasicClientFeaturesTest {
@Test
public void cannotScrollAfterBottom() {
+ selectMenuPath(SET_GENERATOR);
toggleDetailsFor(999);
scrollToRow(999, ScrollDestination.START);
- Range expectedRange = Range.withLength(19680, 20);
+ Range expectedRange = Range.withLength(19671, 20);
assertTrue(expectedRange.contains(getGridVerticalScrollPos()));
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
index f437589a39..0dd137db48 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
@@ -81,9 +81,19 @@ public class GridEditorClientTest extends GridBasicClientFeaturesTest {
getGridElement().getCell(4, 0).doubleClick();
assertNotNull(getEditor());
- getCancelButton().click();
+ // Move focus to the third input field
+ getEditor().findElements(By.className("gwt-TextBox")).get(2).click();
+
+ // Press save button
+ getSaveButton().click();
+
+ // Make sure the editor went away
assertNull(getEditor());
+ // Check that focus has moved to cell 4,2 - the last one that was
+ // focused in Editor
+ assertTrue(getGridElement().getCell(4, 2).isFocused());
+
// Disable editor
selectMenuPath("Component", "Editor", "Enabled");
@@ -134,14 +144,16 @@ public class GridEditorClientTest extends GridBasicClientFeaturesTest {
@Test
public void testWithSelectionColumn() throws Exception {
selectMenuPath("Component", "State", "Selection mode", "multi");
+ selectMenuPath("Component", "State", "Frozen column count",
+ "-1 columns");
selectMenuPath(EDIT_ROW_5);
- WebElement editorCells = findElement(By
- .className("v-grid-editor-cells"));
+ WebElement editorCells = findElements(
+ By.className("v-grid-editor-cells")).get(1);
List<WebElement> selectorDivs = editorCells.findElements(By
.cssSelector("div"));
- assertTrue("selector column cell should've been empty", selectorDivs
+ assertFalse("selector column cell should've had contents", selectorDivs
.get(0).getAttribute("innerHTML").isEmpty());
assertFalse("normal column cell shoul've had contents", selectorDivs
.get(1).getAttribute("innerHTML").isEmpty());
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java
new file mode 100644
index 0000000000..7f19559aec
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnMaxWidthTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.server;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
+
+public class GridColumnMaxWidthTest extends GridBasicFeaturesTest {
+
+ @Test
+ public void testMaxWidthAffectsColumnWidth() {
+ setDebug(true);
+ openTestURL();
+
+ selectMenuPath("Component", "Columns",
+ "All columns expanding, Col 0 has max width of 30px");
+
+ assertEquals("Column 0 did not obey max width of 30px.", 30,
+ getGridElement().getCell(0, 0).getSize().getWidth());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java
index 4ea64073f3..a9ab7027db 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
@@ -59,7 +58,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
openTestURL();
}
- @Test
+ @Test(expected = NoSuchElementException.class)
public void openVisibleDetails() {
try {
getGridElement().getDetails(0);
@@ -68,8 +67,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
// expected
}
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
- assertNotNull("details should've opened", getGridElement()
- .getDetails(0));
+ getGridElement().getDetails(0);
}
@Test(expected = NoSuchElementException.class)
@@ -99,6 +97,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
@Test
public void openDetailsOutsideOfActiveRange() throws InterruptedException {
getGridElement().scroll(10000);
+ selectMenuPath(DETAILS_GENERATOR_WATCHING);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
getGridElement().scroll(0);
Thread.sleep(50);
@@ -196,14 +195,11 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
assertEquals("Two", getGridElement().getDetails(0).getText());
}
- @Ignore("This use case is not currently supported by Grid. If the detail "
- + "is out of view, the component is detached from the UI and a "
- + "new instance is generated when scrolled back. Support will "
- + "maybe be incorporated at a later time")
@Test
public void hierarchyChangesWorkInDetailsWhileOutOfView() {
selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
+ assertEquals("One", getGridElement().getDetails(0).getText());
scrollGridVerticallyTo(10000);
selectMenuPath(CHANGE_HIERARCHY);
scrollGridVerticallyTo(0);
@@ -219,13 +215,15 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
@Test
public void swappingDetailsGenerators_shownDetails() {
+ selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
- assertTrue("Details should be empty at the start", getGridElement()
- .getDetails(0).getText().isEmpty());
+ assertTrue("Details should contain 'One' at first", getGridElement()
+ .getDetails(0).getText().contains("One"));
selectMenuPath(DETAILS_GENERATOR_WATCHING);
- assertFalse("Details should not be empty after swapping generator",
- getGridElement().getDetails(0).getText().isEmpty());
+ assertFalse(
+ "Details should contain 'Watching' after swapping generator",
+ getGridElement().getDetails(0).getText().contains("Watching"));
}
@Test
@@ -239,6 +237,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
@Test
public void swappingDetailsGenerators_whileDetailsScrolledOut_showAfter() {
scrollGridVerticallyTo(1000);
+ selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
selectMenuPath(DETAILS_GENERATOR_WATCHING);
scrollGridVerticallyTo(0);
@@ -250,6 +249,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
@Test
public void swappingDetailsGenerators_whileDetailsScrolledOut_showBefore() {
+ selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
selectMenuPath(DETAILS_GENERATOR_WATCHING);
scrollGridVerticallyTo(1000);
@@ -261,6 +261,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
@Test
public void swappingDetailsGenerators_whileDetailsScrolledOut_showBeforeAndAfter() {
+ selectMenuPath(DETAILS_GENERATOR_HIERARCHICAL);
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
selectMenuPath(DETAILS_GENERATOR_WATCHING);
scrollGridVerticallyTo(1000);
@@ -272,24 +273,6 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest {
}
@Test
- public void nullDetailComponentToggling() {
- selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
- selectMenuPath(DETAILS_GENERATOR_WATCHING);
- selectMenuPath(DETAILS_GENERATOR_NULL);
-
- try {
- assertTrue("Details should be empty with null component",
- getGridElement().getDetails(0).getText().isEmpty());
- } catch (NoSuchElementException e) {
- fail("Expected to find a details row with empty content");
- }
-
- selectMenuPath(DETAILS_GENERATOR_WATCHING);
- assertFalse("Details should be not empty with details component",
- getGridElement().getDetails(0).getText().isEmpty());
- }
-
- @Test
public void noAssertErrorsOnEmptyDetailsAndScrollDown() {
selectMenuPath(OPEN_FIRST_ITEM_DETAILS);
scrollGridVerticallyTo(500);
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java
new file mode 100644
index 0000000000..57f4b877df
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java
@@ -0,0 +1,264 @@
+/*
+ * 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.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.shared.ui.grid.GridConstants;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.elements.GridElement.GridEditorElement;
+import com.vaadin.testbench.elements.NotificationElement;
+
+public class GridEditorBufferedTest extends GridEditorTest {
+
+ @Override
+ @Before
+ public void setUp() {
+ super.setUp();
+ }
+
+ @Test
+ public void testSave() {
+ selectMenuPath(EDIT_ITEM_100);
+
+ WebElement textField = getEditorWidgets().get(0);
+
+ textField.click();
+
+ textField.sendKeys(" changed");
+
+ WebElement saveButton = getEditor().findElement(
+ By.className("v-grid-editor-save"));
+
+ saveButton.click();
+
+ assertEquals("(100, 0) changed", getGridElement().getCell(100, 0)
+ .getText());
+ }
+
+ @Test
+ public void testProgrammaticSave() {
+ selectMenuPath(EDIT_ITEM_100);
+
+ WebElement textField = getEditorWidgets().get(0);
+
+ textField.click();
+
+ textField.sendKeys(" changed");
+
+ selectMenuPath("Component", "Editor", "Save");
+
+ assertEquals("(100, 0) changed", getGridElement().getCell(100, 0)
+ .getText());
+ }
+
+ @Test
+ public void testInvalidEdition() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertFalse(logContainsText("Exception occured, java.lang.IllegalStateException"));
+
+ GridEditorElement editor = getGridElement().getEditor();
+
+ assertFalse(
+ "Field 7 should not have been marked with an error before error",
+ editor.isFieldErrorMarked(7));
+
+ WebElement intField = editor.getField(7);
+ intField.clear();
+ intField.sendKeys("banana phone");
+ editor.save();
+
+ assertEquals("Column 7: Could not convert value to Integer",
+ editor.getErrorMessage());
+ assertTrue("Field 7 should have been marked with an error after error",
+ editor.isFieldErrorMarked(7));
+ editor.cancel();
+
+ selectMenuPath(EDIT_ITEM_100);
+ assertFalse("Exception should not exist",
+ isElementPresent(NotificationElement.class));
+ assertEquals("There should be no editor error message", null,
+ getGridElement().getEditor().getErrorMessage());
+ }
+
+ @Test
+ public void testEditorInDisabledGrid() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
+
+ selectMenuPath("Component", "State", "Enabled");
+ assertEditorOpen();
+
+ GridEditorElement editor = getGridElement().getEditor();
+ editor.save();
+ assertEditorOpen();
+
+ editor.cancel();
+ assertEditorOpen();
+
+ selectMenuPath("Component", "State", "Enabled");
+
+ scrollGridVerticallyTo(100);
+ assertEquals(
+ "Grid shouldn't scroll vertically while editing in buffered mode",
+ originalScrollPos, getGridVerticalScrollPos());
+ }
+
+ @Test
+ public void testCaptionChange() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEquals("Save button caption should've been \""
+ + GridConstants.DEFAULT_SAVE_CAPTION + "\" to begin with",
+ GridConstants.DEFAULT_SAVE_CAPTION, getSaveButton().getText());
+ assertEquals("Cancel button caption should've been \""
+ + GridConstants.DEFAULT_CANCEL_CAPTION + "\" to begin with",
+ GridConstants.DEFAULT_CANCEL_CAPTION, getCancelButton()
+ .getText());
+
+ selectMenuPath("Component", "Editor", "Change save caption");
+ assertNotEquals(
+ "Save button caption should've changed while editor is open",
+ GridConstants.DEFAULT_SAVE_CAPTION, getSaveButton().getText());
+
+ getCancelButton().click();
+
+ selectMenuPath("Component", "Editor", "Change cancel caption");
+ selectMenuPath(EDIT_ITEM_5);
+ assertNotEquals(
+ "Cancel button caption should've changed while editor is closed",
+ GridConstants.DEFAULT_CANCEL_CAPTION, getCancelButton()
+ .getText());
+ }
+
+ @Test(expected = NoSuchElementException.class)
+ public void testVerticalScrollLocking() {
+ selectMenuPath(EDIT_ITEM_5);
+ getGridElement().getCell(200, 0);
+ }
+
+ @Test
+ public void testScrollDisabledOnProgrammaticOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ selectMenuPath(EDIT_ITEM_5);
+
+ scrollGridVerticallyTo(100);
+ assertEquals(
+ "Grid shouldn't scroll vertically while editing in buffered mode",
+ originalScrollPos, getGridVerticalScrollPos());
+ }
+
+ @Test
+ public void testScrollDisabledOnMouseOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
+ new Actions(getDriver()).doubleClick(cell_5_0).perform();
+
+ scrollGridVerticallyTo(100);
+ assertEquals(
+ "Grid shouldn't scroll vertically while editing in buffered mode",
+ originalScrollPos, getGridVerticalScrollPos());
+ }
+
+ @Test
+ public void testScrollDisabledOnKeyboardOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
+ cell_5_0.click();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+
+ scrollGridVerticallyTo(100);
+ assertEquals(
+ "Grid shouldn't scroll vertically while editing in buffered mode",
+ originalScrollPos, getGridVerticalScrollPos());
+ }
+
+ @Test
+ public void testMouseOpeningClosing() {
+
+ getGridElement().getCell(4, 0).doubleClick();
+ assertEditorOpen();
+
+ getCancelButton().click();
+ assertEditorClosed();
+
+ selectMenuPath(TOGGLE_EDIT_ENABLED);
+ getGridElement().getCell(4, 0).doubleClick();
+ assertEditorClosed();
+ }
+
+ @Test
+ public void testMouseOpeningDisabledWhenOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ getGridElement().getCell(4, 0).doubleClick();
+
+ assertEquals("Editor should still edit row 5", "(5, 0)",
+ getEditorWidgets().get(0).getAttribute("value"));
+ }
+
+ @Test
+ public void testKeyboardOpeningDisabledWhenOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ new Actions(getDriver()).click(getGridElement().getCell(4, 0))
+ .sendKeys(Keys.ENTER).perform();
+
+ assertEquals("Editor should still edit row 5", "(5, 0)",
+ getEditorWidgets().get(0).getAttribute("value"));
+ }
+
+ @Test
+ public void testProgrammaticOpeningDisabledWhenOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
+ assertEquals("Editor should edit row 5", "(5, 0)", getEditorWidgets()
+ .get(0).getAttribute("value"));
+
+ selectMenuPath(EDIT_ITEM_100);
+ boolean thrown = logContainsText("Exception occured, java.lang.IllegalStateException");
+ assertTrue("IllegalStateException thrown", thrown);
+
+ assertEditorOpen();
+ assertEquals("Editor should still edit row 5", "(5, 0)",
+ getEditorWidgets().get(0).getAttribute("value"));
+ }
+
+ @Test
+ public void testUserSortDisabledWhenOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ getGridElement().getHeaderCell(0, 0).click();
+
+ assertEditorOpen();
+ assertEquals("(2, 0)", getGridElement().getCell(2, 0).getText());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
index 0c39b3e509..0cba2ce34b 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
@@ -17,7 +17,6 @@ package com.vaadin.tests.components.grid.basicfeatures.server;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -28,24 +27,26 @@ import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
-import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
-import com.vaadin.shared.ui.grid.GridConstants;
+import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.GridElement.GridEditorElement;
-import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
-public class GridEditorTest extends GridBasicFeaturesTest {
+public abstract class GridEditorTest extends GridBasicFeaturesTest {
- private static final String[] EDIT_ITEM_5 = new String[] { "Component",
+ protected static final By BY_EDITOR_CANCEL = By
+ .className("v-grid-editor-cancel");
+ protected static final By BY_EDITOR_SAVE = By
+ .className("v-grid-editor-save");
+ protected static final String[] EDIT_ITEM_5 = new String[] { "Component",
"Editor", "Edit item 5" };
- private static final String[] EDIT_ITEM_100 = new String[] { "Component",
+ protected static final String[] EDIT_ITEM_100 = new String[] { "Component",
"Editor", "Edit item 100" };
- private static final String[] TOGGLE_EDIT_ENABLED = new String[] {
+ protected static final String[] TOGGLE_EDIT_ENABLED = new String[] {
"Component", "Editor", "Enabled" };
@Before
@@ -88,26 +89,6 @@ public class GridEditorTest extends GridBasicFeaturesTest {
assertEditorOpen();
}
- @Test(expected = NoSuchElementException.class)
- public void testVerticalScrollLocking() {
- selectMenuPath(EDIT_ITEM_5);
- getGridElement().getCell(200, 0);
- }
-
- @Test
- public void testMouseOpeningClosing() {
-
- getGridElement().getCell(4, 0).doubleClick();
- assertEditorOpen();
-
- getCancelButton().click();
- assertEditorClosed();
-
- selectMenuPath(TOGGLE_EDIT_ENABLED);
- getGridElement().getCell(4, 0).doubleClick();
- assertEditorClosed();
- }
-
@Test
public void testKeyboardOpeningClosing() {
@@ -141,237 +122,180 @@ public class GridEditorTest extends GridBasicFeaturesTest {
assertEquals("<b>100</b>", widgets.get(8).getAttribute("value"));
}
- @Test
- public void testSave() {
- selectMenuPath(EDIT_ITEM_100);
-
- WebElement textField = getEditorWidgets().get(0);
-
- textField.click();
-
- textField.sendKeys(" changed");
+ protected void assertEditorOpen() {
+ assertEquals("Unexpected number of widgets",
+ GridBasicFeatures.EDITABLE_COLUMNS, getEditorWidgets().size());
+ }
- WebElement saveButton = getEditor().findElement(
- By.className("v-grid-editor-save"));
+ protected void assertEditorClosed() {
+ assertNull("Editor is supposed to be closed", getEditor());
+ }
- saveButton.click();
+ protected List<WebElement> getEditorWidgets() {
+ assertNotNull("Editor is supposed to be open", getEditor());
+ return getEditor().findElements(By.className("v-textfield"));
- assertEquals("(100, 0) changed", getGridElement().getCell(100, 0)
- .getText());
}
@Test
- public void testProgrammaticSave() {
- selectMenuPath(EDIT_ITEM_100);
-
- WebElement textField = getEditorWidgets().get(0);
+ public void testFocusOnMouseOpen() {
- textField.click();
+ GridCellElement cell = getGridElement().getCell(4, 2);
- textField.sendKeys(" changed");
+ cell.doubleClick();
- selectMenuPath("Component", "Editor", "Save");
+ WebElement focused = getFocusedElement();
- assertEquals("(100, 0) changed", getGridElement().getCell(100, 0)
- .getText());
+ assertEquals("", "input", focused.getTagName());
+ assertEquals("", cell.getText(), focused.getAttribute("value"));
}
@Test
- public void testCaptionChange() {
- selectMenuPath(EDIT_ITEM_5);
- assertEquals("Save button caption should've been \""
- + GridConstants.DEFAULT_SAVE_CAPTION + "\" to begin with",
- GridConstants.DEFAULT_SAVE_CAPTION, getSaveButton().getText());
- assertEquals("Cancel button caption should've been \""
- + GridConstants.DEFAULT_CANCEL_CAPTION + "\" to begin with",
- GridConstants.DEFAULT_CANCEL_CAPTION, getCancelButton()
- .getText());
-
- selectMenuPath("Component", "Editor", "Change save caption");
- assertNotEquals(
- "Save button caption should've changed while editor is open",
- GridConstants.DEFAULT_SAVE_CAPTION, getSaveButton().getText());
-
- getCancelButton().click();
-
- selectMenuPath("Component", "Editor", "Change cancel caption");
- selectMenuPath(EDIT_ITEM_5);
- assertNotEquals(
- "Cancel button caption should've changed while editor is closed",
- GridConstants.DEFAULT_CANCEL_CAPTION, getCancelButton()
- .getText());
- }
+ public void testFocusOnKeyboardOpen() {
- private void assertEditorOpen() {
- assertNotNull("Editor is supposed to be open", getEditor());
- assertEquals("Unexpected number of widgets",
- GridBasicFeatures.EDITABLE_COLUMNS, getEditorWidgets().size());
- }
+ GridCellElement cell = getGridElement().getCell(4, 2);
- private void assertEditorClosed() {
- assertNull("Editor is supposed to be closed", getEditor());
- }
+ cell.click();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
- private List<WebElement> getEditorWidgets() {
- assertNotNull(getEditor());
- return getEditor().findElements(By.className("v-textfield"));
+ WebElement focused = getFocusedElement();
+ assertEquals("", "input", focused.getTagName());
+ assertEquals("", cell.getText(), focused.getAttribute("value"));
}
@Test
- public void testInvalidEdition() {
- selectMenuPath(EDIT_ITEM_5);
- assertFalse(logContainsText("Exception occured, java.lang.IllegalStateException"));
+ public void testFocusOnProgrammaticOpenOnItemClick() {
+ selectMenuPath("Component", "State", "EditorOpeningItemClickListener");
- GridEditorElement editor = getGridElement().getEditor();
-
- assertFalse(
- "Field 7 should not have been marked with an error before error",
- editor.isFieldErrorMarked(7));
+ GridCellElement cell = getGridElement().getCell(4, 2);
- WebElement intField = editor.getField(7);
- intField.clear();
- intField.sendKeys("banana phone");
- editor.save();
+ cell.click();
- assertEquals("Column 7: Could not convert value to Integer",
- editor.getErrorMessage());
- assertTrue("Field 7 should have been marked with an error after error",
- editor.isFieldErrorMarked(7));
- editor.cancel();
+ WebElement focused = getFocusedElement();
- selectMenuPath(EDIT_ITEM_100);
- assertFalse("Exception should not exist",
- isElementPresent(NotificationElement.class));
- assertEquals("There should be no editor error message", null,
- getGridElement().getEditor().getErrorMessage());
+ assertEquals("", "input", focused.getTagName());
+ assertEquals("", cell.getText(), focused.getAttribute("value"));
}
@Test
- public void testNoScrollAfterProgrammaticOpen() {
- int originalScrollPos = getGridVerticalScrollPos();
+ public void testNoFocusOnProgrammaticOpen() {
selectMenuPath(EDIT_ITEM_5);
- scrollGridVerticallyTo(100);
- assertEquals("Grid shouldn't scroll vertically while editing",
- originalScrollPos, getGridVerticalScrollPos());
+ WebElement focused = getFocusedElement();
+
+ assertEquals("Focus should remain in the menu", "menu",
+ focused.getAttribute("id"));
}
@Test
- public void testNoScrollAfterMouseOpen() {
- int originalScrollPos = getGridVerticalScrollPos();
+ public void testUneditableColumn() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
- GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
- new Actions(getDriver()).doubleClick(cell_5_0).perform();
+ GridEditorElement editor = getGridElement().getEditor();
+ assertFalse("Uneditable column should not have an editor widget",
+ editor.isEditable(3));
- scrollGridVerticallyTo(100);
- assertEquals("Grid shouldn't scroll vertically while editing",
- originalScrollPos, getGridVerticalScrollPos());
- }
+ String classNames = editor
+ .findElements(By.className("v-grid-editor-cells")).get(1)
+ .findElements(By.xpath("./div")).get(3).getAttribute("class");
- @Test
- public void testNoScrollAfterKeyboardOpen() {
- int originalScrollPos = getGridVerticalScrollPos();
+ assertTrue("Noneditable cell should contain not-editable classname",
+ classNames.contains("not-editable"));
- GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
- cell_5_0.click();
- new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+ assertTrue("Noneditable cell should contain v-grid-cell classname",
+ classNames.contains("v-grid-cell"));
- scrollGridVerticallyTo(100);
- assertEquals("Grid shouldn't scroll vertically while editing",
- originalScrollPos, getGridVerticalScrollPos());
+ assertNoErrorNotifications();
}
@Test
- public void testEditorInDisabledGrid() {
- int originalScrollPos = getGridVerticalScrollPos();
+ public void testNoOpenFromHeaderOrFooter() {
+ selectMenuPath("Component", "Footer", "Visible");
- selectMenuPath(EDIT_ITEM_5);
- assertEditorOpen();
+ getGridElement().getHeaderCell(0, 0).doubleClick();
+ assertEditorClosed();
- selectMenuPath("Component", "State", "Enabled");
- assertEditorOpen();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+ assertEditorClosed();
- GridEditorElement editor = getGridElement().getEditor();
- editor.save();
- assertEditorOpen();
+ getGridElement().getFooterCell(0, 0).doubleClick();
+ assertEditorClosed();
- editor.cancel();
- assertEditorOpen();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+ assertEditorClosed();
+ }
- selectMenuPath("Component", "State", "Enabled");
+ public void testEditorMoveOnResize() {
+ selectMenuPath("Component", "Size", "Height", "500px");
+ getGridElement().getCell(22, 0).doubleClick();
+ assertEditorOpen();
- scrollGridVerticallyTo(100);
- assertEquals("Grid shouldn't scroll vertically while editing",
- originalScrollPos, getGridVerticalScrollPos());
- }
+ GridEditorElement editor = getGridElement().getEditor();
+ TestBenchElement tableWrapper = getGridElement().getTableWrapper();
- @Test
- public void testFocusOnMouseOpen() {
+ int tableWrapperBottom = tableWrapper.getLocation().getY()
+ + tableWrapper.getSize().getHeight();
+ int editorBottom = editor.getLocation().getY()
+ + editor.getSize().getHeight();
- GridCellElement cell = getGridElement().getCell(4, 2);
+ assertTrue("Editor should not be initially outside grid",
+ tableWrapperBottom - editorBottom <= 2);
- cell.doubleClick();
+ selectMenuPath("Component", "Size", "Height", "300px");
+ assertEditorOpen();
- WebElement focused = getFocusedElement();
+ tableWrapperBottom = tableWrapper.getLocation().getY()
+ + tableWrapper.getSize().getHeight();
+ editorBottom = editor.getLocation().getY()
+ + editor.getSize().getHeight();
- assertEquals("", "input", focused.getTagName());
- assertEquals("", cell.getText(), focused.getAttribute("value"));
+ assertTrue("Editor should not be outside grid after resize",
+ tableWrapperBottom - editorBottom <= 2);
}
- @Test
- public void testFocusOnKeyboardOpen() {
+ public void testEditorDoesNotMoveOnResizeIfNotNeeded() {
+ selectMenuPath("Component", "Size", "Height", "500px");
- GridCellElement cell = getGridElement().getCell(4, 2);
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
- cell.click();
- new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+ GridEditorElement editor = getGridElement().getEditor();
- WebElement focused = getFocusedElement();
+ int editorPos = editor.getLocation().getY();
- assertEquals("", "input", focused.getTagName());
- assertEquals("", cell.getText(), focused.getAttribute("value"));
+ selectMenuPath("Component", "Size", "Height", "300px");
+ assertEditorOpen();
+
+ assertTrue("Editor should not have moved due to resize",
+ editorPos == editor.getLocation().getY());
}
@Test
- public void testNoFocusOnProgrammaticOpen() {
-
+ public void testEditorClosedOnSort() {
selectMenuPath(EDIT_ITEM_5);
- WebElement focused = getFocusedElement();
-
- assertEquals("Focus should remain in the menu", "menu",
- focused.getAttribute("id"));
- }
+ selectMenuPath("Component", "State", "Sort by column", "Column 0, ASC");
- @Override
- protected WebElement getFocusedElement() {
- return (WebElement) executeScript("return document.activeElement;");
+ assertEditorClosed();
}
@Test
- public void testUneditableColumn() {
+ public void testEditorClosedOnFilter() {
selectMenuPath(EDIT_ITEM_5);
- assertEditorOpen();
- GridEditorElement editor = getGridElement().getEditor();
- assertFalse("Uneditable column should not have an editor widget",
- editor.isEditable(3));
- assertEquals(
- "Not editable cell did not contain correct classname",
- "not-editable",
- editor.findElement(By.className("v-grid-editor-cells"))
- .findElements(By.xpath("./div")).get(3)
- .getAttribute("class"));
+ selectMenuPath("Component", "Filter", "Column 1 starts with \"(23\"");
+ assertEditorClosed();
}
- private WebElement getSaveButton() {
- return getDriver().findElement(By.className("v-grid-editor-save"));
+ protected WebElement getSaveButton() {
+ return getDriver().findElement(BY_EDITOR_SAVE);
}
- private WebElement getCancelButton() {
- return getDriver().findElement(By.className("v-grid-editor-cancel"));
+ protected WebElement getCancelButton() {
+ return getDriver().findElement(BY_EDITOR_CANCEL);
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java
new file mode 100644
index 0000000000..08094b57e3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java
@@ -0,0 +1,223 @@
+/*
+ * 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.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+
+public class GridEditorUnbufferedTest extends GridEditorTest {
+
+ private static final String[] TOGGLE_EDITOR_BUFFERED = new String[] {
+ "Component", "Editor", "Buffered mode" };
+ private static final String[] CANCEL_EDIT = new String[] { "Component",
+ "Editor", "Cancel edit" };
+
+ @Override
+ @Before
+ public void setUp() {
+ super.setUp();
+ selectMenuPath(TOGGLE_EDITOR_BUFFERED);
+ }
+
+ @Test
+ public void testEditorShowsNoButtons() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ assertEditorOpen();
+
+ assertFalse("Save button should not be visible in unbuffered mode.",
+ isElementPresent(BY_EDITOR_SAVE));
+
+ assertFalse("Cancel button should not be visible in unbuffered mode.",
+ isElementPresent(BY_EDITOR_CANCEL));
+ }
+
+ @Test
+ public void testToggleEditorUnbufferedWhileOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
+ selectMenuPath(TOGGLE_EDITOR_BUFFERED);
+ boolean thrown = logContainsText("Exception occured, java.lang.IllegalStateException");
+ assertTrue("IllegalStateException thrown", thrown);
+ }
+
+ @Test
+ public void testEditorMove() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ assertEditorOpen();
+
+ String firstFieldValue = getEditorWidgets().get(0)
+ .getAttribute("value");
+ assertEquals("Editor should be at row 5", "(5, 0)", firstFieldValue);
+
+ getGridElement().getCell(10, 0).click();
+ firstFieldValue = getEditorWidgets().get(0).getAttribute("value");
+
+ assertEquals("Editor should be at row 10", "(10, 0)", firstFieldValue);
+ }
+
+ @Test
+ public void testValidationErrorPreventsMove() {
+ // Because of "out of view" issues, we need to move this for easy access
+ selectMenuPath("Component", "Columns", "Column 7", "Column 7 Width",
+ "50px");
+ for (int i = 0; i < 6; ++i) {
+ selectMenuPath("Component", "Columns", "Column 7", "Move left");
+ }
+
+ selectMenuPath(EDIT_ITEM_5);
+
+ getEditorWidgets().get(1).click();
+ getEditorWidgets().get(1).sendKeys("not a number");
+
+ getGridElement().getCell(10, 0).click();
+
+ assertEquals("Editor should not move from row 5", "(5, 0)",
+ getEditorWidgets().get(0).getAttribute("value"));
+ }
+
+ @Test
+ public void testErrorMessageWrapperHidden() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ assertEditorOpen();
+
+ WebElement editorFooter = getEditor().findElement(
+ By.className("v-grid-editor-footer"));
+
+ assertTrue("Editor footer should not be visible when there's no error",
+ editorFooter.getCssValue("display").equalsIgnoreCase("none"));
+ }
+
+ @Test
+ public void testScrollEnabledOnProgrammaticOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ selectMenuPath(EDIT_ITEM_5);
+
+ scrollGridVerticallyTo(100);
+ assertGreater(
+ "Grid should scroll vertically while editing in unbuffered mode",
+ getGridVerticalScrollPos(), originalScrollPos);
+ }
+
+ @Test
+ public void testScrollEnabledOnMouseOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
+ new Actions(getDriver()).doubleClick(cell_5_0).perform();
+
+ scrollGridVerticallyTo(100);
+ assertGreater(
+ "Grid should scroll vertically while editing in unbuffered mode",
+ getGridVerticalScrollPos(), originalScrollPos);
+ }
+
+ @Test
+ public void testScrollEnabledOnKeyboardOpen() {
+ int originalScrollPos = getGridVerticalScrollPos();
+
+ GridCellElement cell_5_0 = getGridElement().getCell(5, 0);
+ cell_5_0.click();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+
+ scrollGridVerticallyTo(100);
+ assertGreater(
+ "Grid should scroll vertically while editing in unbuffered mode",
+ getGridVerticalScrollPos(), originalScrollPos);
+ }
+
+ @Test
+ public void testEditorInDisabledGrid() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ selectMenuPath("Component", "State", "Enabled");
+ assertEditorOpen();
+
+ assertTrue("Editor text field should be disabled",
+ null != getEditorWidgets().get(2).getAttribute("disabled"));
+
+ selectMenuPath("Component", "State", "Enabled");
+ assertEditorOpen();
+
+ assertFalse("Editor text field should not be disabled",
+ null != getEditorWidgets().get(2).getAttribute("disabled"));
+ }
+
+ @Test
+ public void testMouseOpeningClosing() {
+
+ getGridElement().getCell(4, 0).doubleClick();
+ assertEditorOpen();
+
+ selectMenuPath(CANCEL_EDIT);
+ selectMenuPath(TOGGLE_EDIT_ENABLED);
+
+ getGridElement().getCell(4, 0).doubleClick();
+ assertEditorClosed();
+ }
+
+ @Test
+ public void testProgrammaticOpeningWhenOpen() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
+ assertEquals("Editor should edit row 5", "(5, 0)", getEditorWidgets()
+ .get(0).getAttribute("value"));
+
+ selectMenuPath(EDIT_ITEM_100);
+ assertEditorOpen();
+ assertEquals("Editor should edit row 100", "(100, 0)",
+ getEditorWidgets().get(0).getAttribute("value"));
+ }
+
+ @Test
+ public void testExternalValueChangePassesToEditor() {
+ selectMenuPath(EDIT_ITEM_5);
+ assertEditorOpen();
+
+ selectMenuPath("Component", "State", "ReactiveValueChanger");
+
+ getEditorWidgets().get(0).click();
+ getEditorWidgets().get(0).sendKeys("changing value");
+
+ // Focus another field to cause the value to be sent to the server
+ getEditorWidgets().get(2).click();
+
+ assertEquals("Value of Column 2 in the editor was not changed",
+ "Modified", getEditorWidgets().get(2).getAttribute("value"));
+ }
+
+ @Test
+ public void testEditorClosedOnUserSort() {
+ selectMenuPath(EDIT_ITEM_5);
+
+ getGridElement().getHeaderCell(0, 0).click();
+
+ assertEditorClosed();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridFocusTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridFocusTest.java
new file mode 100644
index 0000000000..ca9d78409c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridFocusTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
+
+/**
+ * Test for server-side Grid focus features.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class GridFocusTest extends GridBasicFeaturesTest {
+
+ @Before
+ public void setUp() {
+ openTestURL();
+ }
+
+ @Test
+ public void testFocusListener() {
+ selectMenuPath("Component", "Listeners", "Focus listener");
+
+ getGridElement().click();
+
+ assertTrue("Focus listener should be invoked",
+ getLogRow(0).contains("FocusEvent"));
+ }
+
+ @Test
+ public void testBlurListener() {
+ selectMenuPath("Component", "Listeners", "Blur listener");
+
+ getGridElement().click();
+ $(MenuBarElement.class).first().click();
+
+ assertTrue("Blur listener should be invoked",
+ getLogRow(0).contains("BlurEvent"));
+ }
+
+ @Test
+ public void testProgrammaticFocus() {
+ selectMenuPath("Component", "State", "Set focus");
+
+ assertTrue("Grid cell (0, 0) should be focused", getGridElement()
+ .getCell(0, 0).isFocused());
+ }
+
+ @Test
+ public void testTabIndex() {
+ assertEquals(getGridElement().getAttribute("tabindex"), "0");
+
+ selectMenuPath("Component", "State", "Tab index", "-1");
+ assertEquals(getGridElement().getAttribute("tabindex"), "-1");
+
+ selectMenuPath("Component", "State", "Tab index", "10");
+ assertEquals(getGridElement().getAttribute("tabindex"), "10");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
index 9953bbcae0..8bf8639d76 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
@@ -20,8 +20,10 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.GridElement;
@@ -335,6 +337,62 @@ public class GridSelectionTest extends GridBasicFeaturesTest {
getRow(5).isSelected());
}
+ @Test
+ public void testSelectionCheckBoxesHaveStyleNames() {
+ openTestURL();
+
+ setSelectionModelMulti();
+
+ assertTrue(
+ "Selection column CheckBox should have the proper style name set",
+ getGridElement().getCell(0, 0).findElement(By.tagName("span"))
+ .getAttribute("class")
+ .contains("v-grid-selection-checkbox"));
+
+ GridCellElement header = getGridElement().getHeaderCell(0, 0);
+ assertTrue("Select all CheckBox should have the proper style name set",
+ header.findElement(By.tagName("span")).getAttribute("class")
+ .contains("v-grid-select-all-checkbox"));
+ }
+
+ @Test
+ public void testServerSideSelectTogglesSelectAllCheckBox() {
+ openTestURL();
+
+ setSelectionModelMulti();
+ GridCellElement header = getGridElement().getHeaderCell(0, 0);
+
+ WebElement selectAll = header.findElement(By.tagName("input"));
+
+ selectMenuPath("Component", "State", "Select all");
+ waitUntilCheckBoxValue(selectAll, true);
+ assertTrue("Select all CheckBox wasn't selected as expected",
+ selectAll.isSelected());
+
+ selectMenuPath("Component", "State", "Select none");
+ waitUntilCheckBoxValue(selectAll, false);
+ assertFalse("Select all CheckBox was selected unexpectedly",
+ selectAll.isSelected());
+
+ selectMenuPath("Component", "State", "Select all");
+ waitUntilCheckBoxValue(selectAll, true);
+ getGridElement().getCell(5, 0).click();
+ waitUntilCheckBoxValue(selectAll, false);
+ assertFalse("Select all CheckBox was selected unexpectedly",
+ selectAll.isSelected());
+ }
+
+ private void waitUntilCheckBoxValue(final WebElement checkBoxElememnt,
+ final boolean expectedValue) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return expectedValue ? checkBoxElememnt.isSelected()
+ : !checkBoxElememnt.isSelected();
+ }
+ }, 5);
+ }
+
private void setSelectionModelMulti() {
selectMenuPath("Component", "State", "Selection mode", "multi");
}
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 0e5dd32989..238b470feb 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
@@ -45,15 +45,15 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest {
private void runTestSequence(String theme) throws IOException {
openTestURL("theme=" + theme);
- compareScreen(theme + "_SidebarClosed");
+ compareScreen(theme + "-SidebarClosed");
getSidebarOpenButton().click();
- compareScreen(theme + "_SidebarOpen");
+ compareScreen(theme + "-SidebarOpen");
new Actions(getDriver()).moveToElement(getColumnHidingToggle(2), 5, 5)
.perform();
- compareScreen(theme + "_OnMouseOverNotHiddenToggle");
+ compareScreen(theme + "-OnMouseOverNotHiddenToggle");
getColumnHidingToggle(2).click();
getColumnHidingToggle(3).click();
@@ -63,17 +63,17 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest {
.perform();
;
- compareScreen(theme + "_TogglesTriggered");
+ compareScreen(theme + "-TogglesTriggered");
new Actions(getDriver()).moveToElement(getColumnHidingToggle(2))
.perform();
;
- compareScreen(theme + "_OnMouseOverHiddenToggle");
+ compareScreen(theme + "-OnMouseOverHiddenToggle");
getSidebarOpenButton().click();
- compareScreen(theme + "_SidebarClosed2");
+ compareScreen(theme + "-SidebarClosed2");
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java
index 5d72d481c7..f44f39689c 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridStructureTest.java
@@ -274,7 +274,7 @@ public class GridStructureTest extends GridBasicFeaturesTest {
@Test
public void testBareItemSetChangeRemovingAllRows() throws Exception {
openTestURL();
- selectMenuPath("Component", "Filter", "Add impassable filter");
+ selectMenuPath("Component", "Filter", "Impassable filter");
assertFalse("A notification shouldn't have been displayed",
$(NotificationElement.class).exists());
assertTrue("No body cells should've been found", getGridElement()
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java
index 3005365c47..6155820990 100644
--- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewShortcutActionHandlerTest.java
@@ -15,13 +15,15 @@
*/
package com.vaadin.tests.components.popupview;
-import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
/**
* Check availability of shortcut action listener in the popup view.
*
@@ -29,6 +31,14 @@ import org.openqa.selenium.WebElement;
*/
public class PopupViewShortcutActionHandlerTest extends MultiBrowserTest {
+ @Override
+ protected boolean requireWindowFocusForIE() {
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ return false;
+ }
+ return true;
+ }
+
@Test
public void testShortcutHandling() {
openTestURL();
diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java b/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java
new file mode 100644
index 0000000000..0dc371e57c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.splitpanel;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.FieldEvents.TextChangeEvent;
+import com.vaadin.event.FieldEvents.TextChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+@Theme("reindeer")
+public class GridLayoutWithCheckbox extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ GridLayout grid = new GridLayout(2, 3);
+ grid.setWidth(500, Unit.PIXELS);
+
+ Label l = new Label("Textfield 1:");
+ grid.addComponent(l, 0, 0);
+ TextField textfield = new TextField();
+ textfield.addTextChangeListener(new TextChangeListener() {
+
+ @Override
+ public void textChange(TextChangeEvent event) {
+
+ }
+ });
+ textfield.setTextChangeEventMode(TextChangeEventMode.EAGER);
+ grid.addComponent(textfield, 1, 0);
+
+ l = new Label("CheckBox:");
+ grid.addComponent(l, 0, 1);
+ CheckBox checkBox = new CheckBox();
+ grid.addComponent(checkBox, 1, 2);
+ checkBox.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+
+ }
+ });
+ Window window = new Window();
+ window.setWidth(300.0f, Unit.PIXELS);
+ window.setContent(grid);
+ window.setResizable(false);
+ window.setWidth(550, Unit.PIXELS);
+
+ // grid.setColumnExpandRatio(1, 1);
+ addWindow(window);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java b/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java
new file mode 100644
index 0000000000..fee46c155a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckboxTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.splitpanel;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class GridLayoutWithCheckboxTest extends MultiBrowserTest {
+
+ private TextFieldElement tf;
+ private WebElement tfSlot;
+ private CheckBoxElement cb;
+ private WebElement cbSlot;
+ private Dimension tfSize;
+ private Dimension tfSlotSize;
+ private Dimension cbSize;
+ private Dimension cbSlotSize;
+
+ @Test
+ public void layoutShouldStayTheSame() {
+ openTestURL();
+ tf = $(TextFieldElement.class).first();
+ tfSlot = tf.findElement(By.xpath(".."));
+ cb = $(CheckBoxElement.class).first();
+ cbSlot = cb.findElement(By.xpath(".."));
+
+ // Doing anything with the textfield or checkbox should not affect
+ // layout
+
+ tf.setValue("a");
+ assertSizes();
+ cb.click();
+ assertSizes();
+ tf.setValue("b");
+ assertSizes();
+ cb.click();
+ assertSizes();
+
+ }
+
+ private void assertSizes() {
+ if (tfSize == null) {
+ tfSize = tf.getSize();
+ tfSlotSize = tfSlot.getSize();
+ cbSize = cb.getSize();
+ cbSlotSize = cbSlot.getSize();
+ } else {
+ Assert.assertEquals(tfSize, tf.getSize());
+ Assert.assertEquals(tfSlotSize, tfSlot.getSize());
+ Assert.assertEquals(cbSize, cb.getSize());
+ Assert.assertEquals(cbSlotSize, cbSlot.getSize());
+ }
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java
index 08b65e2ef5..8d1a9fc7df 100644
--- a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java
+++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java
@@ -2,21 +2,22 @@ package com.vaadin.tests.components.table;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Alignment;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
+import com.vaadin.ui.Table.ColumnCollapseEvent;
+import com.vaadin.ui.Table.ColumnCollapseListener;
-public class ColumnCollapsingAndColumnExpansion extends TestBase {
+public class ColumnCollapsingAndColumnExpansion extends AbstractTestUIWithLog {
private Table table;
@Override
- public void setup() {
+ protected void setup(VaadinRequest request) {
table = new Table();
@@ -50,41 +51,44 @@ public class ColumnCollapsingAndColumnExpansion extends TestBase {
"cell " + 2 + "-" + y, "cell " + 3 + "-" + y, },
new Object());
}
-
- addComponent(table);
-
- HorizontalLayout hl = new HorizontalLayout();
- final TextField tf = new TextField("Column name (ColX)");
- Button hide = new Button("Collapse", new ClickListener() {
+ table.addColumnCollapseListener(new ColumnCollapseListener() {
@Override
- public void buttonClick(ClickEvent event) {
- table.setColumnCollapsed(tf.getValue(), true);
- }
-
- });
+ public void columnCollapseStateChange(ColumnCollapseEvent event) {
+ log("Collapse state for " + event.getPropertyId()
+ + " changed to "
+ + table.isColumnCollapsed(event.getPropertyId()));
- Button show = new Button("Show", new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- table.setColumnCollapsed(tf.getValue(), false);
}
-
});
+ addComponent(table);
- hl.addComponent(tf);
- hl.addComponent(hide);
- hl.addComponent(show);
- hl.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
- hl.setComponentAlignment(hide, Alignment.BOTTOM_LEFT);
- hl.setComponentAlignment(show, Alignment.BOTTOM_LEFT);
- addComponent(hl);
+ for (int i = 1; i <= 3; i++) {
+ HorizontalLayout hl = new HorizontalLayout();
+ final String id = "Col" + i;
+ Button hide = new Button("Collapse " + id, new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ table.setColumnCollapsed(id, true);
+ }
+ });
+
+ Button show = new Button("Show " + id, new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ table.setColumnCollapsed(id, false);
+ }
+ });
+
+ hl.addComponent(hide);
+ hl.addComponent(show);
+ addComponent(hl);
+ }
}
@Override
- protected String getDescription() {
+ protected String getTestDescription() {
return "After hiding column 2 the remaining columns (1 and 3) should use all available space in the table";
}
diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java
new file mode 100644
index 0000000000..739851de2f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansionTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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 java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.parallel.BrowserUtil;
+import com.vaadin.tests.components.table.CustomTableElement.ContextMenuElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ColumnCollapsingAndColumnExpansionTest extends MultiBrowserTest {
+
+ @Test
+ public void expandCorrectlyAfterCollapse() throws IOException {
+ openTestURL();
+
+ CustomTableElement table = $(CustomTableElement.class).first();
+
+ // Hide col2 through UI
+ table.openCollapseMenu().getItem(1).click();
+ compareScreen(table, "col1-col3");
+
+ // Hide col1 using button
+ ButtonElement hide1 = $(ButtonElement.class).caption("Collapse Col1")
+ .first();
+ hide1.click();
+ compareScreen(table, "col3");
+
+ // Show column 2 using context menu (first action)
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ // IE8 can context click but the popup is off screen so it can't be
+ // interacted with...
+ ButtonElement show2 = $(ButtonElement.class).caption("Show Col2")
+ .first();
+ show2.click();
+ } else {
+ contextClick(table.getCell(0, 0));
+ ContextMenuElement contextMenu = table.getContextMenu();
+ WebElement i = contextMenu.getItem(0);
+ i.click();
+ }
+ compareScreen(table, "col2-col3");
+
+ // Show column 1 again
+ ButtonElement show1 = $(ButtonElement.class).caption("Show Col1")
+ .first();
+ show1.click();
+
+ compareScreen(table, "col1-col2-col3");
+ }
+
+ private void contextClick(TestBenchElement e) {
+ if (e.isPhantomJS()) {
+ JavascriptExecutor js = e.getCommandExecutor();
+ String scr = "var element=arguments[0];"
+ + "var ev = document.createEvent('HTMLEvents');"
+ + "ev.initEvent('contextmenu', true, false);"
+ + "element.dispatchEvent(ev);";
+ js.executeScript(scr, e);
+ } else {
+ e.contextClick();
+ }
+
+ }
+
+ @Test
+ public void collapseEvents() {
+ openTestURL();
+ CustomTableElement table = $(CustomTableElement.class).first();
+
+ // Through menu
+ table.openCollapseMenu().getItem(0).click();
+ Assert.assertEquals("1. Collapse state for Col1 changed to true",
+ getLogRow(0));
+
+ // Through button
+ $(ButtonElement.class).caption("Collapse Col2").first().click();
+ Assert.assertEquals("2. Collapse state for Col2 changed to true",
+ getLogRow(0));
+
+ // Show through menu
+ table.openCollapseMenu().getItem(1).click();
+ Assert.assertEquals("3. Collapse state for Col1 changed to false",
+ getLogRow(0));
+
+ // Show through button
+ $(ButtonElement.class).caption("Show Col2").first().click();
+ Assert.assertEquals("4. Collapse state for Col2 changed to false",
+ getLogRow(0));
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/CustomTableElement.java b/uitest/src/com/vaadin/tests/components/table/CustomTableElement.java
new file mode 100644
index 0000000000..f1df98fb38
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/CustomTableElement.java
@@ -0,0 +1,57 @@
+/*
+ * 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.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.testbench.elementsbase.AbstractElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.ui.Table")
+public class CustomTableElement extends TableElement {
+
+ public CollapseMenu openCollapseMenu() {
+ getCollapseMenuToggle().click();
+ WebElement cm = getDriver().findElement(
+ By.xpath("//*[@id='PID_VAADIN_CM']"));
+ return wrapElement(cm, getCommandExecutor()).wrap(CollapseMenu.class);
+ }
+
+ public static class CollapseMenu extends ContextMenuElement {
+ }
+
+ public WebElement getCollapseMenuToggle() {
+ return findElement(By.className("v-table-column-selector"));
+ }
+
+ public static class ContextMenuElement extends AbstractElement {
+
+ public WebElement getItem(int index) {
+ return findElement(By.xpath(".//table//tr[" + (index + 1)
+ + "]//td/*"));
+ }
+
+ }
+
+ public ContextMenuElement getContextMenu() {
+ WebElement cm = getDriver().findElement(By.className("v-contextmenu"));
+ return wrapElement(cm, getCommandExecutor()).wrap(
+ ContextMenuElement.class);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java
new file mode 100644
index 0000000000..8f0a8803f3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSorting.java
@@ -0,0 +1,50 @@
+/*
+ * 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 com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.fieldgroup.ComplexPerson;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Table;
+
+@Theme("valo")
+public class TableColumnWidthsAndSorting extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Table t = new Table();
+ t.setContainerDataSource(ComplexPerson.createContainer(100));
+ t.setVisibleColumns("firstName", "lastName", "age", "gender", "salary");
+ t.setColumnWidth("firstName", 200);
+ t.setColumnWidth("lastName", 200);
+ t.setSelectable(true);
+ addComponent(t);
+
+ Button b = new Button("Sort according to gender", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ t.sort(new Object[] { "gender" }, new boolean[] { true });
+ }
+ });
+
+ addComponent(b);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java
new file mode 100644
index 0000000000..9c49b3d0b6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndSortingTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TableColumnWidthsAndSortingTest extends MultiBrowserTest {
+
+ @Test
+ public void testHeaderHeight() {
+ openTestURL();
+ TableElement t = $(TableElement.class).first();
+
+ assertHeaderCellHeight(t);
+
+ // Sort according to age
+ t.getHeaderCell(2).click();
+ assertHeaderCellHeight(t);
+
+ // Sort again according to age
+ t.getHeaderCell(2).click();
+ assertHeaderCellHeight(t);
+
+ }
+
+ private void assertHeaderCellHeight(TableElement t) {
+ // Assert all headers are correct height (37px according to default
+ // Valo)
+ for (int i = 0; i < 5; i++) {
+ Assert.assertEquals("Height of header cell " + i + " is wrong", 37,
+ t.getHeaderCell(0).getSize().getHeight());
+ }
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java
new file mode 100644
index 0000000000..b2313020a3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tabsheet;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalSplitPanel;
+import com.vaadin.ui.themes.ValoTheme;
+
+@Theme("valo")
+public class TabSheetInSplitPanel extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalSplitPanel verticalSplitter = new VerticalSplitPanel();
+ setContent(verticalSplitter);
+ verticalSplitter.setSizeFull();
+ TabSheet t = new TabSheet();
+ t.setHeight("100%");
+ t.addTab(new Label("Hello in tab"), "Hello tab");
+ t.setStyleName(ValoTheme.TABSHEET_FRAMED);
+ verticalSplitter.addComponent(t);
+ verticalSplitter.addComponent(new Label("Hello"));
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java
new file mode 100644
index 0000000000..8070133bde
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.tabsheet;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TabSheetElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TabSheetInSplitPanelTest extends MultiBrowserTest {
+
+ @Test
+ public void ensureNoScrollbars() {
+ openTestURL();
+ TabSheetElement ts = $(TabSheetElement.class).first();
+ List<WebElement> scrollables = ts.findElements(By
+ .xpath("//*[contains(@class,'v-scrollable')]"));
+ for (WebElement scrollable : scrollables) {
+ assertNoHorizontalScrollbar(scrollable,
+ "Element should not have a horizontal scrollbar");
+ assertNoVerticalScrollbar(scrollable,
+ "Element should not have a vertical scrollbar");
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
new file mode 100644
index 0000000000..07cf7f8c2e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
@@ -0,0 +1,51 @@
+/*
+ * 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.treetable;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableScrollOnExpand extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TreeTable t = new TreeTable();
+ t.setSelectable(true);
+ t.setImmediate(true);
+ t.setSizeFull();
+ t.addContainerProperty("Name", String.class, "null");
+ for (int i = 1; i <= 100; i++) {
+ String parentID = "Item " + i;
+ Object parent = t.addItem(new Object[] { parentID }, parentID);
+ String childID = "Item " + (100 + i);
+ Object child = t.addItem(new Object[] { childID }, childID);
+ t.getContainerDataSource().setParent(childID, parentID);
+ }
+ addComponent(t);
+ }
+
+ @Override
+ public Integer getTicketNumber() {
+ return 18247;
+ }
+
+ @Override
+ public String getTestDescription() {
+ return "After selecting an item and scrolling it out of view, TreeTable should not scroll to the "
+ + "selected item when expanding an item.";
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java
new file mode 100644
index 0000000000..a17559cc81
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TreeTableScrollOnExpandTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrollOnExpand() throws InterruptedException, IOException {
+ openTestURL();
+ TreeTableElement tt = $(TreeTableElement.class).first();
+ tt.getRow(0).click();
+ tt.scroll(300);
+ sleep(1000);
+ tt.getRow(20).toggleExpanded();
+ // Need to wait a bit to avoid accepting the case where the TreeTable is
+ // in the desired state only for a short while.
+ sleep(1000);
+ WebElement focusedRow = getDriver().findElement(
+ By.className("v-table-focus"));
+ assertEquals("Item 21", focusedRow.getText());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindow.java b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java
new file mode 100644
index 0000000000..918a991cc1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java
@@ -0,0 +1,49 @@
+/*
+ * 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.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Window;
+
+public class GridInWindow extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid grid = new Grid();
+
+ grid.addColumn("Hidable column").setHidable(true);
+ grid.addRow("Close and reopen and it vanishes");
+
+ Button popupButton = new Button("Open PopUp",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ Window subWindow = new Window("Sub-window");
+ subWindow.setContent(grid);
+ subWindow.setWidth(600, Unit.PIXELS);
+ subWindow.setWidth(400, Unit.PIXELS);
+ getUI().addWindow(subWindow);
+ }
+ });
+
+ addComponent(popupButton);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java
new file mode 100644
index 0000000000..301a7c60e4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.window;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+import com.vaadin.tests.tb3.newelements.WindowElement;
+
+public class GridInWindowTest extends SingleBrowserTest {
+
+ @Test
+ public void ensureAttachInHierachyChange() {
+ openTestURL("debug");
+ $(ButtonElement.class).first().click();
+ assertNoErrorNotifications();
+ $(WindowElement.class).first().close();
+ assertNoErrorNotifications();
+ $(ButtonElement.class).first().click();
+ assertNoErrorNotifications();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java
new file mode 100644
index 0000000000..1c82a3de02
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java
@@ -0,0 +1,62 @@
+/*
+ * 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.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.Window;
+
+public class OpenModalWindowAndFocusField extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button button = new Button("Open modal and focus textarea");
+ button.setId("openFocus");
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ open(true);
+ }
+ });
+ addComponent(button);
+
+ button = new Button("Only open modal");
+ button.setId("open");
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ open(false);
+ }
+
+ });
+ addComponent(button);
+
+ }
+
+ private void open(boolean focus) {
+ Window wind = new Window();
+ wind.setModal(true);
+ TextArea ta = new TextArea();
+ wind.setContent(ta);
+ addWindow(wind);
+ if (focus) {
+ ta.focus();
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java
new file mode 100644
index 0000000000..5dba1c3285
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.window;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class OpenModalWindowAndFocusFieldTest extends MultiBrowserTest {
+
+ @Test
+ public void openModalAndFocusField() {
+ openTestURL();
+ $(ButtonElement.class).id("openFocus").click();
+ TextAreaElement textArea = $(TextAreaElement.class).first();
+
+ assertElementsEquals(textArea, getActiveElement());
+ }
+
+ @Test
+ public void openModal() {
+ openTestURL();
+ $(ButtonElement.class).id("open").click();
+ // WindowElement window = $(WindowElement.class).first();
+ WebElement windowFocusElement = findElement(By
+ .xpath("//div[@class='v-window-contents']/div[@class='v-scrollable']"));
+
+ assertElementsEquals(windowFocusElement, getActiveElement());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowCloseShortcuts.java b/uitest/src/com/vaadin/tests/components/window/WindowCloseShortcuts.java
new file mode 100644
index 0000000000..d9c22a26ee
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/WindowCloseShortcuts.java
@@ -0,0 +1,199 @@
+/*
+ * 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.window;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Attribute;
+import org.jsoup.nodes.Element;
+import org.jsoup.nodes.Node;
+import org.jsoup.nodes.TextNode;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.declarative.Design;
+import com.vaadin.ui.declarative.DesignContext;
+
+@Theme("valo")
+@SuppressWarnings("serial")
+public class WindowCloseShortcuts extends AbstractTestUI {
+
+ private Window window;
+ private Label designLabel;
+ private VerticalLayout buttonLayout;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ getLayout().setSpacing(true);
+
+ window = new Window("Test window");
+ window.setVisible(true);
+ window.setModal(true);
+ window.setContent(new RichTextArea());
+
+ Panel buttonPanel = new Panel();
+ buttonLayout = new VerticalLayout();
+ buttonLayout.setSizeFull();
+ buttonPanel.setCaption("Demo controls");
+
+ addButton(new Button("Open window", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ UI.getCurrent().addWindow(window);
+ window.center();
+ updateDesign();
+ }
+ }));
+
+ addButton(new Button("Add ENTER close shortcut", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ window.addCloseShortcut(KeyCode.ENTER);
+ updateDesign();
+ }
+ }));
+
+ addButton(new Button("Add TAB close shortcut", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ window.addCloseShortcut(KeyCode.TAB);
+ updateDesign();
+ }
+ }));
+
+ addButton(new Button("Remove ESC close shortcut", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ window.removeCloseShortcut(KeyCode.ESCAPE);
+ updateDesign();
+ }
+ }));
+
+ addButton(new Button("Clear all close shortcuts", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ window.removeAllCloseShortcuts();
+ updateDesign();
+ }
+ }));
+
+ addButton(new Button("Reset to default state", new ClickListener() {
+ @Override
+ @SuppressWarnings("deprecation")
+ public void buttonClick(ClickEvent event) {
+ window.removeCloseShortcut();
+ updateDesign();
+ }
+ }));
+
+ buttonPanel.setContent(buttonLayout);
+ buttonPanel.setSizeUndefined();
+ addComponent(buttonPanel);
+ buttonPanel.setWidth("400px");
+
+ Panel designPanel = new Panel();
+ designPanel.setCaption("Window design");
+ designLabel = new Label("");
+ VerticalLayout designLayout = new VerticalLayout();
+ designLayout.addComponent(designLabel);
+ designPanel.setContent(designLayout);
+ addComponent(designPanel);
+
+ updateDesign();
+ }
+
+ private void addButton(Button b) {
+ b.setWidth("100%");
+ buttonLayout.addComponent(b);
+ }
+
+ //
+ // The following code is adapted from DeclarativeTestBaseBase.java
+ // (that's not a typo)
+ //
+
+ private void updateDesign() {
+ String design = "";
+ try {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ DesignContext dc = new DesignContext();
+ dc.setRootComponent(window);
+ Design.write(dc, outputStream);
+ design = outputStream.toString("UTF-8");
+ } catch (Exception e) {
+ return;
+ }
+ Element producedElem = Jsoup.parse(design).body().child(0);
+ design = elementToHtml(producedElem);
+ designLabel.setCaption(design);
+ }
+
+ //
+ // The following code is copied directly from DeclarativeTestBaseBase.java
+ // (that's not a typo, either)
+ //
+
+ private String elementToHtml(Element producedElem) {
+ StringBuilder stringBuilder = new StringBuilder();
+ elementToHtml(producedElem, stringBuilder);
+ return stringBuilder.toString();
+ }
+
+ private String elementToHtml(Element producedElem, StringBuilder sb) {
+ ArrayList<String> names = new ArrayList<String>();
+ for (Attribute a : producedElem.attributes().asList()) {
+ names.add(a.getKey());
+ }
+ Collections.sort(names);
+
+ sb.append("<" + producedElem.tagName() + "");
+ for (String attrName : names) {
+ sb.append(" ").append(attrName).append("=").append("\'")
+ .append(producedElem.attr(attrName)).append("\'");
+ }
+ sb.append(">");
+ for (Node child : producedElem.childNodes()) {
+ if (child instanceof Element) {
+ elementToHtml((Element) child, sb);
+ } else if (child instanceof TextNode) {
+ String text = ((TextNode) child).text();
+ sb.append(text.trim());
+ }
+ }
+ sb.append("</").append(producedElem.tagName()).append(">");
+ return sb.toString();
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17383;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpen.java b/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpen.java
new file mode 100644
index 0000000000..0ac2e87510
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpen.java
@@ -0,0 +1,33 @@
+/*
+ * 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.debug;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.ui.Label;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class PreserveCustomDebugSectionOpen extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new Label(
+ "UI for testing that a custom debug window section remains open after refreshging."));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java b/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java
new file mode 100644
index 0000000000..01b73ded92
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/debug/PreserveCustomDebugSectionOpenTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.debug;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class PreserveCustomDebugSectionOpenTest extends SingleBrowserTest {
+ @Test
+ public void testPreserveSection() {
+ setDebug(true);
+ openTestURL();
+
+ findElement(
+ By.cssSelector(".v-debugwindow-tabs button[title=\"Dummy debug window section\"]"))
+ .click();
+
+ WebElement content = findElement(By
+ .cssSelector(".v-debugwindow-content"));
+
+ // Sanity check
+ Assert.assertEquals("Dummy debug window section", content.getText());
+
+ // Open page again, should still have the same section open
+ openTestURL();
+
+ content = findElement(By.cssSelector(".v-debugwindow-content"));
+ Assert.assertEquals("Dummy debug window section", content.getText());
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverhead.java b/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverhead.java
new file mode 100644
index 0000000000..7daf38a0e5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverhead.java
@@ -0,0 +1,37 @@
+/*
+ * 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.debug;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.tests.widgetset.client.ProfilerCompilationCanary;
+import com.vaadin.tests.widgetset.server.TestWidgetComponent;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class ProfilerZeroOverhead extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new TestWidgetComponent(ProfilerCompilationCanary.class));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test UI for verifying that Profiler.isEnabled() causes no side effects in generated javascript";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java b/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java
new file mode 100644
index 0000000000..659823e49a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/debug/ProfilerZeroOverheadTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.debug;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class ProfilerZeroOverheadTest extends SingleBrowserTest {
+ @Test
+ public void testZeroOverhead() {
+ openTestURL();
+
+ /*
+ * This will get the compiled JS for the
+ * ProfilerCompilationCanary.canaryWithProfiler method. Expected to be
+ * something like "function canaryWithProfiler(){\n}" with a PRETTY
+ * non-draft widgetset.
+ */
+ String canaryMethodString = findElement(By.className("gwt-Label"))
+ .getText();
+
+ // Only look at the method body to avoid false negatives if e.g.
+ // obfuscation changes
+ int bodyStart = canaryMethodString.indexOf('{');
+ int bodyEnd = canaryMethodString.lastIndexOf('}');
+
+ String methodBody = canaryMethodString
+ .substring(bodyStart + 1, bodyEnd);
+
+ // Method body shouldn't contain anything else than whitespace
+ if (!methodBody.replaceAll("\\s", "").isEmpty()) {
+ Assert.fail("Canary method is not empty: " + canaryMethodString);
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java
index f611325719..2562412480 100644
--- a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java
+++ b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonFormTest.java
@@ -20,18 +20,25 @@ import org.junit.Assert;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.CheckBoxElement;
-import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.testbench.elements.TableElement;
import com.vaadin.testbench.elements.TableRowElement;
import com.vaadin.testbench.elements.TextAreaElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.data.bean.Sex;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.FixedNotificationElement;
public abstract class BasicPersonFormTest extends MultiBrowserTest {
private static final String BEAN_VALUES = "Person [firstName=John, lastName=Doe, email=john@doe.com, age=64, sex=Male, address=Address [streetAddress=John street, postalCode=11223, city=John's town, country=USA], deceased=false, salary=null, salaryDouble=null, rent=null]";
- private int logCounter = 0;
+ private int logCounter;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+
+ logCounter = 0;
+ }
@Override
protected Class<?> getUIClass() {
@@ -75,7 +82,7 @@ public abstract class BasicPersonFormTest extends MultiBrowserTest {
}
protected void closeNotification() {
- $(NotificationElement.class).first().close();
+ $(FixedNotificationElement.class).first().close();
}
protected CheckBoxElement getPostCommitFailsCheckBox() {
@@ -169,5 +176,4 @@ public abstract class BasicPersonFormTest extends MultiBrowserTest {
assertSelectedSex(Sex.MALE);
assertDeceasedValue("NAAAAAH");
}
-
}
diff --git a/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
index 37f8e21c50..800a056041 100644
--- a/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
+++ b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java
@@ -110,10 +110,16 @@ public class JSR286Portlet extends UI {
}
private void possiblyChangedModeOrState() {
- VaadinPortletRequest request = (VaadinPortletRequest) VaadinPortletService
- .getCurrentRequest();
-
- userAgent.setValue(getPage().getWebBrowser().getBrowserApplication());
+ VaadinPortletRequest request = VaadinPortletService.getCurrentRequest();
+
+ String censoredUserAgent = getPage().getWebBrowser()
+ .getBrowserApplication();
+ if (censoredUserAgent != null && censoredUserAgent.contains("Chrome/")) {
+ // Censor version info as it tends to change
+ censoredUserAgent = censoredUserAgent.replaceAll("Chrome/[^ ]* ",
+ "Chrome/xyz ");
+ }
+ userAgent.setValue(censoredUserAgent);
screenWidth.setValue(String.valueOf(getPage().getBrowserWindowWidth()));
screenHeight.setValue(String
.valueOf(getPage().getBrowserWindowHeight()));
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java b/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java
index b404747c80..a060d5a57a 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPushLongPollingTest.java
@@ -15,5 +15,19 @@
*/
package com.vaadin.tests.push;
+import org.junit.Test;
+
public class BasicPushLongPollingTest extends BasicPushTest {
+
+ @Test
+ public void pushAfterServerTimeout() throws InterruptedException {
+ getDriver().get(
+ getTestUrl().replace("/run/", "/run-push-timeout/")
+ + "?debug=push");
+ sleep(11000); // Wait for server timeout (10s)
+
+ getServerCounterStartButton().click();
+ waitUntilServerCounterChanges();
+ }
+
}
diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java
index 0e86902b50..157e3f74ae 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPushTest.java
@@ -58,11 +58,11 @@ public abstract class BasicPushTest extends MultiBrowserTest {
return Integer.parseInt(clientCounterElem.getText());
}
- private WebElement getIncrementButton() {
+ protected WebElement getIncrementButton() {
return getIncrementButton(this);
}
- private WebElement getServerCounterStartButton() {
+ protected WebElement getServerCounterStartButton() {
return getServerCounterStartButton(this);
}
@@ -84,7 +84,7 @@ public abstract class BasicPushTest extends MultiBrowserTest {
return t.findElement(By.id(BasicPush.INCREMENT_BUTTON_ID));
}
- private void waitUntilClientCounterChanges(final int expectedValue) {
+ protected void waitUntilClientCounterChanges(final int expectedValue) {
waitUntil(new ExpectedCondition<Boolean>() {
@Override
@@ -94,7 +94,7 @@ public abstract class BasicPushTest extends MultiBrowserTest {
}, 10);
}
- private void waitUntilServerCounterChanges() {
+ protected void waitUntilServerCounterChanges() {
final int counter = BasicPushTest.getServerCounter(this);
waitUntil(new ExpectedCondition<Boolean>() {
diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java
new file mode 100644
index 0000000000..190f6daa24
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java
@@ -0,0 +1,94 @@
+/*
+ * 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.push;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.communication.PushMode;
+import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+@Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING)
+public class ManualLongPollingPushUI extends AbstractTestUIWithLog {
+
+ ExecutorService executor = Executors.newFixedThreadPool(1);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new Button("Manual push after 1s",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ executor.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ access(new Runnable() {
+
+ @Override
+ public void run() {
+ log("Logged after 1s, followed by manual push");
+ push();
+ }
+ });
+
+ }
+ });
+ }
+ });
+ addComponent(b);
+
+ b = new Button("Double manual push after 1s",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ executor.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ access(new Runnable() {
+
+ @Override
+ public void run() {
+ log("First message logged after 1s, followed by manual push");
+ push();
+ log("Second message logged after 1s, followed by manual push");
+ push();
+ }
+ });
+
+ }
+ });
+ }
+ });
+ addComponent(b);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java
new file mode 100644
index 0000000000..096204ff75
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.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.push;
+
+import org.junit.Test;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class ManualLongPollingPushUITest extends SingleBrowserTest {
+
+ @Test
+ public void doubleManualPushDoesNotFreezeApplication() {
+ openTestURL();
+ $(ButtonElement.class).caption("Double manual push after 1s").first()
+ .click();
+ waitUntilLogText("2. Second message logged after 1s, followed by manual push");
+ $(ButtonElement.class).caption("Manual push after 1s").first().click();
+ waitUntilLogText("3. Logged after 1s, followed by manual push");
+ }
+
+ private void waitUntilLogText(final String expected) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ private String actual;
+
+ @Override
+ public Boolean apply(WebDriver arg0) {
+ actual = getLogRow(0);
+ return expected.equals(actual);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("log text to become '%s' (was: '%s')",
+ expected, actual);
+ }
+ });
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java b/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java
new file mode 100644
index 0000000000..e584ec73cc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java
@@ -0,0 +1,52 @@
+/*
+ * 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.resources;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class SpecialCharsInThemeResources extends SingleBrowserTest {
+
+ @Test
+ public void loadThemeResource() {
+ loadResource("/VAADIN/themes/tests-tickets/ordinary.txt");
+ checkSource();
+ }
+
+ @Test
+ public void loadThemeResourceWithPercentage() {
+ loadResource("/VAADIN/themes/tests-tickets/percentagein%2520name.txt");
+ checkSource();
+ }
+
+ @Test
+ public void loadThemeResourceWithSpecialChars() {
+ loadResource("/VAADIN/themes/tests-tickets/folder%20with%20space/resource%20with%20special%20$chars@.txt");
+ checkSource();
+ }
+
+ private void loadResource(String path) {
+ getDriver().get(getBaseURL() + path);
+ }
+
+ private void checkSource() {
+ String source = getDriver().getPageSource();
+ Assert.assertTrue("Incorrect contents (was: " + source + ")",
+ source.contains("Just ordinary contents here"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 665f1668b2..a58575890e 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -51,6 +51,7 @@ import org.openqa.selenium.interactions.Keyboard;
import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.internal.Locatable;
+import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
@@ -384,7 +385,7 @@ public abstract class AbstractTB3Test extends ParallelTest {
* @return
*/
public WebElement vaadinElementById(String id) {
- return driver.findElement(vaadinLocatorById(id));
+ return driver.findElement(By.id(id));
}
/**
@@ -1118,4 +1119,93 @@ public abstract class AbstractTB3Test extends ParallelTest {
return isElementPresent(By.className("v-debugwindow"));
}
+ protected void assertNoHorizontalScrollbar(WebElement element,
+ String errorMessage) {
+ // IE rounds clientWidth/clientHeight down and scrollHeight/scrollWidth
+ // up, so using clientWidth/clientHeight will fail if the element height
+ // is not an integer
+ int clientWidth = getClientWidth(element);
+ int scrollWidth = getScrollWidth(element);
+ boolean hasScrollbar = scrollWidth > clientWidth;
+
+ Assert.assertFalse(
+ "The element should not have a horizontal scrollbar (scrollWidth: "
+ + scrollWidth + ", clientWidth: " + clientWidth + "): "
+ + errorMessage, hasScrollbar);
+ }
+
+ protected void assertNoVerticalScrollbar(WebElement element,
+ String errorMessage) {
+ // IE rounds clientWidth/clientHeight down and scrollHeight/scrollWidth
+ // up, so using clientWidth/clientHeight will fail if the element height
+ // is not an integer
+ int clientHeight = getClientHeight(element);
+ int scrollHeight = getScrollHeight(element);
+ boolean hasScrollbar = scrollHeight > clientHeight;
+
+ Assert.assertFalse(
+ "The element should not have a vertical scrollbar (scrollHeight: "
+ + scrollHeight + ", clientHeight: " + clientHeight
+ + "): " + errorMessage, hasScrollbar);
+ }
+
+ protected int getScrollHeight(WebElement element) {
+ return ((Number) executeScript("return arguments[0].scrollHeight;",
+ element)).intValue();
+ }
+
+ protected int getScrollWidth(WebElement element) {
+ return ((Number) executeScript("return arguments[0].scrollWidth;",
+ element)).intValue();
+ }
+
+ /**
+ * Returns client height rounded up instead of as double because of IE9
+ * issues: https://dev.vaadin.com/ticket/18469
+ */
+ protected int getClientHeight(WebElement e) {
+ String script;
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ script = "return arguments[0].clientHeight;"; //
+ } else {
+ script = "var cs = window.getComputedStyle(arguments[0]);"
+ + "return Math.ceil(parseFloat(cs.height)+parseFloat(cs.paddingTop)+parseFloat(cs.paddingBottom));";
+ }
+ return ((Number) executeScript(script, e)).intValue();
+ }
+
+ /**
+ * Returns client width rounded up instead of as double because of IE9
+ * issues: https://dev.vaadin.com/ticket/18469
+ */
+ protected int getClientWidth(WebElement e) {
+ String script;
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ script = "return arguments[0].clientWidth;";
+ } else {
+ script = "var cs = window.getComputedStyle(arguments[0]);"
+ + "var h = parseFloat(cs.width)+parseFloat(cs.paddingLeft)+parseFloat(cs.paddingRight);"
+ + "return Math.ceil(h);";
+ }
+
+ return ((Number) executeScript(script, e)).intValue();
+ }
+
+ protected void assertElementsEquals(WebElement expectedElement,
+ WebElement actualElement) {
+ while (expectedElement instanceof WrapsElement) {
+ expectedElement = ((WrapsElement) expectedElement)
+ .getWrappedElement();
+ }
+ while (actualElement instanceof WrapsElement) {
+ actualElement = ((WrapsElement) actualElement).getWrappedElement();
+ }
+
+ Assert.assertEquals(expectedElement, actualElement);
+ }
+
+ protected WebElement getActiveElement() {
+ return (WebElement) executeScript("return document.activeElement;");
+
+ }
}
diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
index 16df2ace74..23ead80fce 100644
--- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
+++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java
@@ -84,6 +84,8 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration {
@Override
public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
+ super.setDesiredCapabilities(desiredCapabilities);
+
if (BrowserUtil.isIE(desiredCapabilities)) {
if (requireWindowFocusForIE()) {
desiredCapabilities.setCapability(
@@ -103,8 +105,6 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration {
"name",
String.format("%s.%s", getClass().getCanonicalName(),
testName.getMethodName()));
-
- super.setDesiredCapabilities(desiredCapabilities);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
index 34344324d0..784d203ab0 100644
--- a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
+++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
@@ -14,6 +14,7 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
private final String restoreBoxClass = "v-window-restorebox";
private final String maximizeBoxClass = "v-window-maximizebox";
+ private final String closeBoxClass = "v-window-closebox";
public void restore() {
if (isMaximized()) {
@@ -63,4 +64,13 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
public String getCaption() {
return findElement(By.className("v-window-header")).getText();
}
+
+ private WebElement getCloseButton() {
+ return findElement(By.className(closeBoxClass));
+ }
+
+ public void close() {
+ getCloseButton().click();
+
+ }
}
diff --git a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChange.java b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChange.java
index 4582123f5f..0a57b77aa3 100644
--- a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChange.java
+++ b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChange.java
@@ -29,6 +29,7 @@ import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.MenuBar;
+import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
@@ -60,7 +61,10 @@ public class LegacyComponentThemeChange extends AbstractTestUIWithLog {
ThemeResource varyingIcon = new ThemeResource("menubar-theme-icon.png");
MenuBar bar = new MenuBar();
bar.addItem("runo", alwaysTheSameIconImage, null);
- bar.addItem("seletedtheme", varyingIcon, null);
+ bar.addItem("selectedtheme", varyingIcon, null);
+ MenuItem sub = bar.addItem("sub menu", null);
+ sub.addItem("runo", alwaysTheSameIconImage, null);
+ sub.addItem("selectedtheme", varyingIcon, null);
vl.addComponent(bar);
diff --git a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
index c6593104da..3c992f3af5 100644
--- a/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
+++ b/uitest/src/com/vaadin/tests/themes/LegacyComponentThemeChangeTest.java
@@ -122,8 +122,22 @@ public class LegacyComponentThemeChangeTest extends MultiBrowserTest {
// The other image should change with the theme
WebElement themeImage = $(MenuBarElement.class).first().findElement(
- By.xpath(".//span[text()='seletedtheme']/img"));
+ By.xpath(".//span[text()='selectedtheme']/img"));
assertAttributePrefix(themeImage, "src", theme);
+
+ WebElement subMenuItem = $(MenuBarElement.class).first().findElement(
+ By.xpath(".//span[text()='sub menu']"));
+ subMenuItem.click();
+
+ WebElement subMenu = findElement(By.className("v-menubar-popup"));
+ WebElement subMenuRuno = subMenu.findElement(By
+ .xpath(".//span[text()='runo']/img"));
+ String subMenuRunoImageSrc = subMenuRuno.getAttribute("src");
+ Assert.assertEquals(getThemeURL("runo") + "icons/16/ok.png",
+ subMenuRunoImageSrc);
+ WebElement subMenuThemeImage = subMenu.findElement(By
+ .xpath(".//span[text()='selectedtheme']/img"));
+ assertAttributePrefix(subMenuThemeImage, "src", theme);
}
private void assertAttributePrefix(WebElement element, String attribute,
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
index c32be01d8d..3c7ad2ad33 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java
@@ -21,13 +21,14 @@ import com.vaadin.ui.Accordion;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Accordions extends VerticalLayout implements View {
public Accordions() {
setMargin(true);
Label h1 = new Label("Accordions");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
@@ -38,7 +39,7 @@ public class Accordions extends VerticalLayout implements View {
row.addComponent(getAccordion("Normal"));
Accordion ac = getAccordion("Borderless");
- ac.addStyleName("borderless");
+ ac.addStyleName(ValoTheme.ACCORDION_BORDERLESS);
row.addComponent(ac);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java
index dc257fb3ec..eb4be8e0d8 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButton.java
@@ -20,6 +20,7 @@ import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
+import com.vaadin.ui.themes.ValoTheme;
/**
* Test UI for image icon in button with 'icon-align-top' style.
@@ -34,7 +35,7 @@ public class AlignTopIconInButton extends AbstractTestUI {
Button button = new Button();
button.setIcon(new ThemeResource("../runo/icons/16/document.png"));
addComponent(button);
- button.addStyleName("icon-align-top");
+ button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.setCaption("caption");
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
index 9ed48896eb..ee88595ba7 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ButtonsAndLinks.java
@@ -25,6 +25,7 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
/**
*
@@ -39,11 +40,11 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
setMargin(true);
Label h1 = new Label("Buttons");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -55,30 +56,30 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
row.addComponent(button);
button = new Button("Primary");
- button.addStyleName("primary");
+ button.addStyleName(ValoTheme.BUTTON_PRIMARY);
row.addComponent(button);
button = new Button("Friendly");
- button.addStyleName("friendly");
+ button.addStyleName(ValoTheme.BUTTON_FRIENDLY);
row.addComponent(button);
button = new Button("Danger");
- button.addStyleName("danger");
+ button.addStyleName(ValoTheme.BUTTON_DANGER);
row.addComponent(button);
TestIcon testIcon = new TestIcon(10);
button = new Button("Small");
- button.addStyleName("small");
+ button.addStyleName(ValoTheme.BUTTON_SMALL);
button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Large");
- button.addStyleName("large");
+ button.addStyleName(ValoTheme.BUTTON_LARGE);
button.setIcon(testIcon.get());
row.addComponent(button);
button = new Button("Top");
- button.addStyleName("icon-align-top");
+ button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.setIcon(testIcon.get());
row.addComponent(button);
@@ -87,7 +88,7 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
row.addComponent(button);
button = new Button("Image icon");
- button.addStyleName("icon-align-right");
+ button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT);
button.setIcon(testIcon.get(true));
row.addComponent(button);
@@ -97,36 +98,36 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
button = new Button();
button.setIcon(testIcon.get());
- button.addStyleName("icon-only");
+ button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
row.addComponent(button);
button = new Button("Borderless");
button.setIcon(testIcon.get());
- button.addStyleName("borderless");
+ button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
row.addComponent(button);
button = new Button("Borderless, colored");
button.setIcon(testIcon.get());
- button.addStyleName("borderless-colored");
+ button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
row.addComponent(button);
button = new Button("Quiet");
button.setIcon(testIcon.get());
- button.addStyleName("quiet");
+ button.addStyleName(ValoTheme.BUTTON_QUIET);
row.addComponent(button);
button = new Button("Link style");
button.setIcon(testIcon.get());
- button.addStyleName("link");
+ button.addStyleName(ValoTheme.BUTTON_LINK);
row.addComponent(button);
button = new Button("Icon on right");
button.setIcon(testIcon.get());
- button.addStyleName("icon-align-right");
+ button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT);
row.addComponent(button);
CssLayout group = new CssLayout();
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
row.addComponent(group);
button = new Button("One");
@@ -137,22 +138,22 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
group.addComponent(button);
button = new Button("Tiny");
- button.addStyleName("tiny");
+ button.addStyleName(ValoTheme.BUTTON_TINY);
row.addComponent(button);
button = new Button("Huge");
- button.addStyleName("huge");
+ button.addStyleName(ValoTheme.BUTTON_HUGE);
row.addComponent(button);
NativeButton nbutton = new NativeButton("Native");
row.addComponent(nbutton);
h1 = new Label("Links");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -167,16 +168,16 @@ public class ButtonsAndLinks extends VerticalLayout implements View {
row.addComponent(link);
link = new Link("Small", new ExternalResource("https://vaadin.com"));
- link.addStyleName("small");
+ link.addStyleName(ValoTheme.LINK_SMALL);
row.addComponent(link);
link = new Link("Large", new ExternalResource("https://vaadin.com"));
- link.addStyleName("large");
+ link.addStyleName(ValoTheme.LINK_LARGE);
row.addComponent(link);
link = new Link(null, new ExternalResource("https://vaadin.com"));
link.setIcon(testIcon.get());
- link.addStyleName("large");
+ link.addStyleName(ValoTheme.LINK_LARGE);
row.addComponent(link);
link = new Link("Disabled", new ExternalResource("https://vaadin.com"));
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
index 280ddf98b7..e18665f2fa 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CalendarTest.java
@@ -286,7 +286,7 @@ public class CalendarTest extends GridLayout implements View {
hl.addComponent(captionLabel);
CssLayout group = new CssLayout();
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
group.addComponent(dayButton);
group.addComponent(weekButton);
group.addComponent(monthButton);
@@ -922,7 +922,7 @@ public class CalendarTest extends GridLayout implements View {
scheduleEventPopup.setModal(true);
scheduleEventPopup.center();
- scheduleEventFieldLayout.addStyleName("light");
+ scheduleEventFieldLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
scheduleEventFieldLayout.setMargin(false);
layout.addComponent(scheduleEventFieldLayout);
@@ -939,7 +939,7 @@ public class CalendarTest extends GridLayout implements View {
}
}
});
- applyEventButton.addStyleName("primary");
+ applyEventButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
Button cancel = new Button("Cancel", new ClickListener() {
private static final long serialVersionUID = 1L;
@@ -958,7 +958,7 @@ public class CalendarTest extends GridLayout implements View {
deleteCalendarEvent();
}
});
- deleteEventButton.addStyleName("borderless");
+ deleteEventButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
scheduleEventPopup.addCloseListener(new Window.CloseListener() {
private static final long serialVersionUID = 1L;
@@ -970,7 +970,7 @@ public class CalendarTest extends GridLayout implements View {
});
HorizontalLayout buttons = new HorizontalLayout();
- buttons.addStyleName("v-window-bottom-toolbar");
+ buttons.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
buttons.setWidth("100%");
buttons.setSpacing(true);
buttons.addComponent(deleteEventButton);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
index 9a889b3bda..f77cf9a315 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CheckBoxes.java
@@ -23,17 +23,18 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class CheckBoxes extends VerticalLayout implements View {
public CheckBoxes() {
setMargin(true);
Label h1 = new Label("Check Boxes");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -72,11 +73,11 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(check);
check = new CheckBox("Small", true);
- check.addStyleName("small");
+ check.addStyleName(ValoTheme.CHECKBOX_SMALL);
row.addComponent(check);
check = new CheckBox("Large", true);
- check.addStyleName("large");
+ check.addStyleName(ValoTheme.CHECKBOX_LARGE);
row.addComponent(check);
check = new CheckBox("Disabled", true);
@@ -90,11 +91,11 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(check);
h1 = new Label("Option Groups");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -124,7 +125,7 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(options);
options = new OptionGroup("Choose one, small");
- options.addStyleName("small");
+ options.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
options.setMultiSelect(false);
options.addItem("Option One");
options.addItem("Option Two");
@@ -136,7 +137,7 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(options);
options = new OptionGroup("Choose many, small");
- options.addStyleName("small");
+ options.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
options.setMultiSelect(true);
options.addItem("Option One");
options.addItem("Option Two");
@@ -148,7 +149,7 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(options);
options = new OptionGroup("Choose one, large");
- options.addStyleName("large");
+ options.addStyleName(ValoTheme.OPTIONGROUP_LARGE);
options.setMultiSelect(false);
options.addItem("Option One");
options.addItem("Option Two");
@@ -160,7 +161,7 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(options);
options = new OptionGroup("Choose many, large");
- options.addStyleName("large");
+ options.addStyleName(ValoTheme.OPTIONGROUP_LARGE);
options.setMultiSelect(true);
options.addItem("Option One");
options.addItem("Option Two");
@@ -172,7 +173,7 @@ public class CheckBoxes extends VerticalLayout implements View {
row.addComponent(options);
options = new OptionGroup("Horizontal items");
- options.addStyleName("horizontal");
+ options.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
options.addItem("Option One");
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
@@ -185,7 +186,7 @@ public class CheckBoxes extends VerticalLayout implements View {
options = new OptionGroup("Horizontal items, explicit width");
options.setMultiSelect(true);
options.setWidth("500px");
- options.addStyleName("horizontal");
+ options.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
options.addItem("Option One");
two = options.addItem("Option Two, with a longer caption");
options.addItem("Option Three");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
index a7fd60ea51..8e32b07ebd 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ColorPickers.java
@@ -23,17 +23,18 @@ import com.vaadin.ui.ColorPicker;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class ColorPickers extends VerticalLayout implements View {
public ColorPickers() {
setMargin(true);
Label h1 = new Label("Color Pickers");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
index 98a9cad83c..4a88d87cd2 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java
@@ -25,17 +25,18 @@ import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class ComboBoxes extends VerticalLayout implements View {
public ComboBoxes() {
setMargin(true);
Label h1 = new Label("Combo Boxes");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -52,7 +53,7 @@ public class ComboBoxes extends VerticalLayout implements View {
CssLayout group = new CssLayout();
group.setCaption("Grouped with a Button");
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
row.addComponent(group);
combo = new ComboBox();
@@ -104,7 +105,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.setNullSelectionAllowed(false);
combo.select("Option One");
combo.setComponentError(new UserError("Fix it, now!"));
- combo.addStyleName("borderless");
+ combo.addStyleName(ValoTheme.COMBOBOX_BORDERLESS);
row.addComponent(combo);
combo = new ComboBox("Disabled");
@@ -144,7 +145,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
- combo.addStyleName("small");
+ combo.addStyleName(ValoTheme.COMBOBOX_SMALL);
row.addComponent(combo);
combo = new ComboBox("Large");
@@ -152,7 +153,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
- combo.addStyleName("large");
+ combo.addStyleName(ValoTheme.COMBOBOX_LARGE);
row.addComponent(combo);
combo = new ComboBox("Borderless");
@@ -160,7 +161,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.addItem("Option One");
combo.addItem("Option Two");
combo.addItem("Option Three");
- combo.addStyleName("borderless");
+ combo.addStyleName(ValoTheme.COMBOBOX_BORDERLESS);
row.addComponent(combo);
combo = new ComboBox("Tiny");
@@ -168,7 +169,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
- combo.addStyleName("tiny");
+ combo.addStyleName(ValoTheme.COMBOBOX_TINY);
row.addComponent(combo);
combo = new ComboBox("Huge");
@@ -176,7 +177,7 @@ public class ComboBoxes extends VerticalLayout implements View {
combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false));
combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY);
combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY);
- combo.addStyleName("huge");
+ combo.addStyleName(ValoTheme.COMBOBOX_HUGE);
row.addComponent(combo);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
index 52cc43ac28..ea7c42ba2e 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
@@ -51,13 +51,14 @@ import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.CloseEvent;
import com.vaadin.ui.Window.CloseListener;
+import com.vaadin.ui.themes.ValoTheme;
public class CommonParts extends VerticalLayout implements View {
public CommonParts() {
setMargin(true);
Label h1 = new Label("Common UI Elements");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
GridLayout row = new GridLayout(2, 3);
@@ -83,7 +84,7 @@ public class CommonParts extends VerticalLayout implements View {
CssLayout group = new CssLayout();
group.setCaption("Show the loading indicator for…");
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
content.addComponent(group);
Button loading = new Button("0.8");
loading.addClickListener(new ClickListener() {
@@ -127,13 +128,13 @@ public class CommonParts extends VerticalLayout implements View {
Label spinnerDesc = new Label(
"The theme also provides a mixin that you can use to include a spinner anywhere in your application. Below is a Label with a custom style name, for which the spinner mixin is added.");
- spinnerDesc.addStyleName("small");
+ spinnerDesc.addStyleName(ValoTheme.LABEL_SMALL);
spinnerDesc.setCaption("Spinner");
content.addComponent(spinnerDesc);
if (!ValoThemeUI.isTestMode()) {
Label spinner = new Label();
- spinner.addStyleName("spinner");
+ spinner.addStyleName(ValoTheme.LABEL_SPINNER);
content.addComponent(spinner);
}
@@ -172,7 +173,7 @@ public class CommonParts extends VerticalLayout implements View {
addComponent(title);
description.setInputPrompt("Description for the notification");
- description.addStyleName("small");
+ description.addStyleName(ValoTheme.TEXTAREA_SMALL);
description.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
@@ -217,7 +218,7 @@ public class CommonParts extends VerticalLayout implements View {
type.addItem("Error", typeCommand).setCheckable(true);
type.addItem("System", typeCommand).setCheckable(true);
addComponent(type);
- type.addStyleName("small");
+ type.addStyleName(ValoTheme.MENUBAR_SMALL);
Command styleCommand = new Command() {
@Override
@@ -249,16 +250,16 @@ public class CommonParts extends VerticalLayout implements View {
style.addItem("Small", styleCommand).setCheckable(true);
style.addItem("Closable", styleCommand).setCheckable(true);
addComponent(style);
- style.addStyleName("small");
+ style.addStyleName(ValoTheme.MENUBAR_SMALL);
CssLayout group = new CssLayout();
group.setCaption("Fade delay");
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
addComponent(group);
delay.setInputPrompt("Infinite");
- delay.addStyleName("align-right");
- delay.addStyleName("small");
+ delay.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT);
+ delay.addStyleName(ValoTheme.TEXTFIELD_SMALL);
delay.setWidth("7em");
delay.addValueChangeListener(new ValueChangeListener() {
@Override
@@ -284,8 +285,8 @@ public class CommonParts extends VerticalLayout implements View {
});
clear.setIcon(FontAwesome.TIMES_CIRCLE);
clear.addStyleName("last");
- clear.addStyleName("small");
- clear.addStyleName("icon-only");
+ clear.addStyleName(ValoTheme.BUTTON_SMALL);
+ clear.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
group.addComponent(clear);
group.addComponent(new Label("&nbsp; msec", ContentMode.HTML));
@@ -301,7 +302,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -311,7 +312,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -321,7 +322,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -331,7 +332,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -341,7 +342,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -351,7 +352,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -361,7 +362,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -371,7 +372,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@@ -381,7 +382,7 @@ public class CommonParts extends VerticalLayout implements View {
notification.show(Page.getCurrent());
}
});
- pos.addStyleName("small");
+ pos.addStyleName(ValoTheme.BUTTON_SMALL);
grid.addComponent(pos);
}
@@ -397,35 +398,35 @@ public class CommonParts extends VerticalLayout implements View {
{
setSpacing(true);
setMargin(true);
- addStyleName("wrapping");
+ addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
addComponent(new Label(
"Try out different tooltips/descriptions by hovering over the labels."));
Label label = new Label("Simple");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setDescription("Simple tooltip message");
addComponent(label);
label = new Label("Long");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setDescription("Long tooltip message. Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue.");
addComponent(label);
label = new Label("HTML tooltip");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setDescription("<div><h1>Ut enim ad minim veniam, quis nostrud exercitation</h1><p><span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>Donec sed odio operae, eu vulputate felis rhoncus.</span> <span>At nos hinc posthac, sitientis piros Afros.</span> <span>Tu quoque, Brute, fili mi, nihil timor populi, nihil!</span></p><p><span>Gallia est omnis divisa in partes tres, quarum.</span> <span>Praeterea iter est quasdam res quas ex communi.</span> <span>Cum ceteris in veneratione tui montes, nascetur mus.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span> <span>Idque Caesaris facere voluntate liceret: sese habere.</span></p></div>");
addComponent(label);
label = new Label("With an error message");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setDescription("Simple tooltip message");
label.setComponentError(new UserError(
"Something terrible has happened"));
addComponent(label);
label = new Label("With a long error message");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setDescription("Simple tooltip message");
label.setComponentError(new UserError(
"<h2>Contra legem facit qui id facit quod lex prohibet <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span> <span>Prima luce, cum quibus mons aliud consensu ab eo.</span> <span>Quid securi etiam tamquam eu fugiat nulla pariatur.</span> <span>Fabio vel iudice vincam, sunt in culpa qui officia.</span> <span>Nihil hic munitissimus habendi senatus locus, nihil horum?</span></p><p><span>Plura mihi bona sunt, inclinet, amari petere vellent.</span> <span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Nec dubitamus multa iter quae et nos invenerat.</span> <span>Quisque ut dolor gravida, placerat libero vel, euismod.</span> <span>Quae vero auctorem tractata ab fiducia dicuntur.</span></h2>",
@@ -434,7 +435,7 @@ public class CommonParts extends VerticalLayout implements View {
addComponent(label);
label = new Label("Error message only");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
label.setComponentError(new UserError(
"Something terrible has happened"));
addComponent(label);
@@ -479,7 +480,7 @@ public class CommonParts extends VerticalLayout implements View {
Alignment.TOP_RIGHT);
toolbar = toolbarLayout;
}
- toolbar.addStyleName("v-window-top-toolbar");
+ toolbar.addStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
root.addComponent(toolbar);
}
@@ -498,7 +499,7 @@ public class CommonParts extends VerticalLayout implements View {
"Another");
tabs.addTab(new Label("&nbsp;", ContentMode.HTML),
"One more");
- tabs.addStyleName("padded-tabbar");
+ tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() {
@Override
public void selectedTabChange(
@@ -514,9 +515,9 @@ public class CommonParts extends VerticalLayout implements View {
} else if (!autoHeight) {
Panel p = new Panel();
p.setSizeFull();
- p.addStyleName("borderless");
+ p.addStyleName(ValoTheme.PANEL_BORDERLESS);
if (!toolbarVisible || !toolbarLayout) {
- p.addStyleName("scroll-divider");
+ p.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
}
VerticalLayout l = new VerticalLayout();
l.addComponent(new Label(
@@ -538,13 +539,13 @@ public class CommonParts extends VerticalLayout implements View {
HorizontalLayout footer = new HorizontalLayout();
footer.setWidth("100%");
footer.setSpacing(true);
- footer.addStyleName("v-window-bottom-toolbar");
+ footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
Label footerText = new Label("Footer text");
footerText.setSizeUndefined();
Button ok = new Button("OK");
- ok.addStyleName("primary");
+ ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
Button cancel = new Button("Cancel");
@@ -614,7 +615,7 @@ public class CommonParts extends VerticalLayout implements View {
if (selectedItem.getText()
.equals("Borderless Toolbars")) {
- toolbarStyle = selectedItem.isChecked() ? "borderless"
+ toolbarStyle = selectedItem.isChecked() ? ValoTheme.MENUBAR_BORDERLESS
: null;
}
@@ -630,7 +631,7 @@ public class CommonParts extends VerticalLayout implements View {
MenuItem option = options.addItem("Footer", optionsCommand);
option.setCheckable(true);
option.setChecked(true);
- options.addStyleName("small");
+ options.addStyleName(ValoTheme.MENUBAR_SMALL);
addComponent(options);
options = new MenuBar();
@@ -643,7 +644,7 @@ public class CommonParts extends VerticalLayout implements View {
.setCheckable(true);
options.addItem("Borderless Toolbars", optionsCommand)
.setCheckable(true);
- options.addStyleName("small");
+ options.addStyleName(ValoTheme.MENUBAR_SMALL);
addComponent(options);
Command optionsCommand2 = new Command() {
@@ -671,7 +672,7 @@ public class CommonParts extends VerticalLayout implements View {
options.addItem("Resizable", optionsCommand2)
.setCheckable(true);
options.addItem("Modal", optionsCommand2).setCheckable(true);
- options.addStyleName("small");
+ options.addStyleName(ValoTheme.MENUBAR_SMALL);
addComponent(options);
final Button show = new Button("Open Window",
@@ -684,7 +685,7 @@ public class CommonParts extends VerticalLayout implements View {
event.getButton().setEnabled(false);
}
});
- show.addStyleName("primary");
+ show.addStyleName(ValoTheme.BUTTON_PRIMARY);
addComponent(show);
final CheckBox hidden = new CheckBox("Hidden");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
index 4b29f83621..9c95b7400c 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java
@@ -35,17 +35,18 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class DateFields extends VerticalLayout implements View {
public DateFields() {
setMargin(true);
Label h1 = new Label("Date Fields");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -61,12 +62,12 @@ public class DateFields extends VerticalLayout implements View {
date = new DateField("Error, borderless");
setDate(date);
date.setComponentError(new UserError("Fix it, now!"));
- date.addStyleName("borderless");
+ date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
row.addComponent(date);
CssLayout group = new CssLayout();
group.setCaption("Grouped with a Button");
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
row.addComponent(group);
final DateField date2 = new DateField();
@@ -143,19 +144,19 @@ public class DateFields extends VerticalLayout implements View {
date = new DateField("Small");
setDate(date);
date.setResolution(Resolution.DAY);
- date.addStyleName("small");
+ date.addStyleName(ValoTheme.DATEFIELD_SMALL);
row.addComponent(date);
date = new DateField("Large");
setDate(date);
date.setResolution(Resolution.DAY);
- date.addStyleName("large");
+ date.addStyleName(ValoTheme.DATEFIELD_LARGE);
row.addComponent(date);
date = new DateField("Borderless");
setDate(date);
date.setResolution(Resolution.DAY);
- date.addStyleName("borderless");
+ date.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
row.addComponent(date);
date = new DateField("Week numbers");
@@ -179,13 +180,13 @@ public class DateFields extends VerticalLayout implements View {
date = new DateField("Tiny");
setDate(date);
date.setResolution(Resolution.DAY);
- date.addStyleName("tiny");
+ date.addStyleName(ValoTheme.DATEFIELD_TINY);
row.addComponent(date);
date = new DateField("Huge");
setDate(date);
date.setResolution(Resolution.DAY);
- date.addStyleName("huge");
+ date.addStyleName(ValoTheme.DATEFIELD_HUGE);
row.addComponent(date);
date = new InlineDateField("Date picker");
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Dragging.java b/uitest/src/com/vaadin/tests/themes/valo/Dragging.java
index 27bdea7d8a..8de518be23 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Dragging.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Dragging.java
@@ -46,6 +46,7 @@ import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
/**
*
@@ -61,7 +62,7 @@ public class Dragging extends VerticalLayout implements View {
setSpacing(true);
Label h1 = new Label("Dragging Components");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
MenuBar options = new MenuBar();
@@ -74,9 +75,9 @@ public class Dragging extends VerticalLayout implements View {
@Override
public void menuSelected(MenuItem selectedItem) {
if (selectedItem.isChecked()) {
- sample.removeStyleName("no-vertical-drag-hints");
+ sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS);
} else {
- sample.addStyleName("no-vertical-drag-hints");
+ sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS);
}
}
});
@@ -87,9 +88,9 @@ public class Dragging extends VerticalLayout implements View {
@Override
public void menuSelected(MenuItem selectedItem) {
if (selectedItem.isChecked()) {
- sample.removeStyleName("no-horizontal-drag-hints");
+ sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS);
} else {
- sample.addStyleName("no-horizontal-drag-hints");
+ sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS);
}
}
});
@@ -100,9 +101,9 @@ public class Dragging extends VerticalLayout implements View {
@Override
public void menuSelected(MenuItem selectedItem) {
if (selectedItem.isChecked()) {
- sample.removeStyleName("no-box-drag-hints");
+ sample.removeStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_BOX_DRAG_HINTS);
} else {
- sample.addStyleName("no-box-drag-hints");
+ sample.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_BOX_DRAG_HINTS);
}
}
});
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
index 90a6c51496..91fe473d60 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java
@@ -36,6 +36,7 @@ import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
/**
*
@@ -48,18 +49,18 @@ public class Forms extends VerticalLayout implements View {
setMargin(true);
Label title = new Label("Forms");
- title.addStyleName("h1");
+ title.addStyleName(ValoTheme.LABEL_H1);
addComponent(title);
final FormLayout form = new FormLayout();
form.setMargin(false);
form.setWidth("800px");
- form.addStyleName("light");
+ form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
addComponent(form);
Label section = new Label("Personal Info");
- section.addStyleName("h2");
- section.addStyleName("colored");
+ section.addStyleName(ValoTheme.LABEL_H2);
+ section.addStyleName(ValoTheme.LABEL_COLORED);
form.addComponent(section);
StringGenerator sg = new StringGenerator();
@@ -81,12 +82,12 @@ public class Forms extends VerticalLayout implements View {
sex.addItem("Female");
sex.addItem("Male");
sex.select("Male");
- sex.addStyleName("horizontal");
+ sex.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
form.addComponent(sex);
section = new Label("Contact Info");
- section.addStyleName("h3");
- section.addStyleName("colored");
+ section.addStyleName(ValoTheme.LABEL_H3);
+ section.addStyleName(ValoTheme.LABEL_COLORED);
form.addComponent(section);
TextField email = new TextField("Email");
@@ -120,14 +121,14 @@ public class Forms extends VerticalLayout implements View {
period.addItem("Montly");
period.setNullSelectionAllowed(false);
period.select("Weekly");
- period.addStyleName("small");
+ period.addStyleName(ValoTheme.COMBOBOX_SMALL);
period.setWidth("10em");
wrap.addComponent(period);
form.addComponent(wrap);
section = new Label("Additional Info");
- section.addStyleName("h4");
- section.addStyleName("colored");
+ section.addStyleName(ValoTheme.LABEL_H4);
+ section.addStyleName(ValoTheme.LABEL_COLORED);
form.addComponent(section);
TextField website = new TextField("Website");
@@ -156,15 +157,15 @@ public class Forms extends VerticalLayout implements View {
if (readOnly) {
bio.setReadOnly(false);
form.setReadOnly(false);
- form.removeStyleName("light");
+ form.removeStyleName(ValoTheme.FORMLAYOUT_LIGHT);
event.getButton().setCaption("Save");
- event.getButton().addStyleName("primary");
+ event.getButton().addStyleName(ValoTheme.BUTTON_PRIMARY);
} else {
bio.setReadOnly(true);
form.setReadOnly(true);
- form.addStyleName("light");
+ form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
event.getButton().setCaption("Edit");
- event.getButton().removeStyleName("primary");
+ event.getButton().removeStyleName(ValoTheme.BUTTON_PRIMARY);
}
}
});
@@ -177,7 +178,7 @@ public class Forms extends VerticalLayout implements View {
footer.addComponent(edit);
Label lastModified = new Label("Last modified by you a minute ago");
- lastModified.addStyleName("light");
+ lastModified.addStyleName(ValoTheme.LABEL_LIGHT);
footer.addComponent(lastModified);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Labels.java b/uitest/src/com/vaadin/tests/themes/valo/Labels.java
index b5bab3a1d3..9954979d50 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Labels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Labels.java
@@ -23,6 +23,7 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
/**
*
@@ -34,7 +35,7 @@ public class Labels extends VerticalLayout implements View {
setMargin(true);
Label h1 = new Label("Labels");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout split = new HorizontalLayout();
@@ -46,16 +47,16 @@ public class Labels extends VerticalLayout implements View {
split.addComponent(left);
Label huge = new Label("Huge type for display text.");
- huge.addStyleName("huge");
+ huge.addStyleName(ValoTheme.LABEL_HUGE);
left.addComponent(huge);
Label large = new Label(
"Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
- large.addStyleName("large");
+ large.addStyleName(ValoTheme.LABEL_LARGE);
left.addComponent(large);
Label h2 = new Label("Subtitle");
- h2.addStyleName("h2");
+ h2.addStyleName(ValoTheme.LABEL_H2);
left.addComponent(h2);
Label normal = new Label(
@@ -64,20 +65,20 @@ public class Labels extends VerticalLayout implements View {
left.addComponent(normal);
Label h3 = new Label("Small Title");
- h3.addStyleName("h3");
+ h3.addStyleName(ValoTheme.LABEL_H3);
left.addComponent(h3);
Label small = new Label(
"Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
- small.addStyleName("small");
+ small.addStyleName(ValoTheme.LABEL_SMALL);
left.addComponent(small);
Label tiny = new Label("Tiny type for minor text.");
- tiny.addStyleName("tiny");
+ tiny.addStyleName(ValoTheme.LABEL_TINY);
left.addComponent(tiny);
Label h4 = new Label("Section Title");
- h4.addStyleName("h4");
+ h4.addStyleName(ValoTheme.LABEL_H4);
left.addComponent(h4);
normal = new Label(
@@ -94,25 +95,25 @@ public class Labels extends VerticalLayout implements View {
Label label = new Label(
"Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
right.addComponent(label);
label = new Label(
"Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
- label.addStyleName("light");
+ label.addStyleName(ValoTheme.LABEL_LIGHT);
right.addComponent(label);
label = new Label(
"Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.");
- label.addStyleName("colored");
+ label.addStyleName(ValoTheme.LABEL_COLORED);
right.addComponent(label);
label = new Label("A label for success");
- label.addStyleName("success");
+ label.addStyleName(ValoTheme.LABEL_SUCCESS);
right.addComponent(label);
label = new Label("A label for failure");
- label.addStyleName("failure");
+ label.addStyleName(ValoTheme.LABEL_FAILURE);
right.addComponent(label);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
index 4a0130931e..fc74166b29 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/MenuBars.java
@@ -25,6 +25,7 @@ import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class MenuBars extends VerticalLayout implements View {
public MenuBars() {
@@ -32,7 +33,7 @@ public class MenuBars extends VerticalLayout implements View {
setSpacing(true);
Label h1 = new Label("Menu Bars");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
MenuBar menuBar = getMenuBar();
@@ -41,37 +42,37 @@ public class MenuBars extends VerticalLayout implements View {
menuBar = getMenuBar();
menuBar.setCaption("Small style");
- menuBar.addStyleName("small");
+ menuBar.addStyleName(ValoTheme.MENUBAR_SMALL);
addComponent(menuBar);
menuBar = getMenuBar();
menuBar.setCaption("Borderless style");
- menuBar.addStyleName("borderless");
+ menuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
addComponent(menuBar);
menuBar = getMenuBar();
menuBar.setCaption("Small borderless style");
- menuBar.addStyleName("borderless");
- menuBar.addStyleName("small");
+ menuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
+ menuBar.addStyleName(ValoTheme.MENUBAR_SMALL);
addComponent(menuBar);
Label h2 = new Label("Drop Down Button");
- h2.addStyleName("h2");
+ h2.addStyleName(ValoTheme.LABEL_H2);
addComponent(h2);
HorizontalLayout wrap = new HorizontalLayout();
- wrap.addStyleName("wrapping");
+ wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
wrap.setSpacing(true);
addComponent(wrap);
wrap.addComponent(getMenuButton("Normal", false));
MenuBar split = getMenuButton("Small", false);
- split.addStyleName("small");
+ split.addStyleName(ValoTheme.MENUBAR_SMALL);
wrap.addComponent(split);
split = getMenuButton("Borderless", false);
- split.addStyleName("borderless");
+ split.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
wrap.addComponent(split);
split = getMenuButton("Themed", false);
@@ -80,26 +81,26 @@ public class MenuBars extends VerticalLayout implements View {
split = getMenuButton("Small", false);
split.addStyleName("color1");
- split.addStyleName("small");
+ split.addStyleName(ValoTheme.MENUBAR_SMALL);
wrap.addComponent(split);
h2 = new Label("Split Button");
- h2.addStyleName("h2");
+ h2.addStyleName(ValoTheme.LABEL_H2);
addComponent(h2);
wrap = new HorizontalLayout();
- wrap.addStyleName("wrapping");
+ wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
wrap.setSpacing(true);
addComponent(wrap);
wrap.addComponent(getMenuButton("Normal", true));
split = getMenuButton("Small", true);
- split.addStyleName("small");
+ split.addStyleName(ValoTheme.MENUBAR_SMALL);
wrap.addComponent(split);
split = getMenuButton("Borderless", true);
- split.addStyleName("borderless");
+ split.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
wrap.addComponent(split);
split = getMenuButton("Themed", true);
@@ -108,7 +109,7 @@ public class MenuBars extends VerticalLayout implements View {
split = getMenuButton("Small", true);
split.addStyleName("color1");
- split.addStyleName("small");
+ split.addStyleName(ValoTheme.MENUBAR_SMALL);
wrap.addComponent(split);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java b/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java
index 284f7c8d6e..e9c1c78049 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/NativeSelects.java
@@ -23,17 +23,18 @@ import com.vaadin.ui.ListSelect;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.TwinColSelect;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class NativeSelects extends VerticalLayout implements View {
public NativeSelects() {
setMargin(true);
Label h1 = new Label("Selects");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java b/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java
index 7adae9ce65..5f9542b6f3 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/NotificationStyleTest.java
@@ -27,6 +27,7 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.ui.themes.ValoTheme;
/**
* Test for H1 and P elements styles in Notifications.
@@ -45,7 +46,8 @@ public class NotificationStyleTest extends MultiBrowserTest {
waitUntil(notificationPresentCondition(), 2);
WebElement notification = findElement(By.className("v-Notification"));
- List<WebElement> headers = notification.findElements(By.tagName("h1"));
+ List<WebElement> headers = notification.findElements(By
+ .tagName(ValoTheme.LABEL_H1));
String textAlign = headers.get(0).getCssValue("text-align");
String textAlignInnerHeader = headers.get(1).getCssValue("text-align");
Assert.assertNotEquals("Styles for notification defined h1 tag "
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Panels.java b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
index 8a17244693..d98daf7b05 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Panels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Panels.java
@@ -27,17 +27,18 @@ import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Panels extends VerticalLayout implements View {
public Panels() {
setMargin(true);
Label h1 = new Label("Panels & Layout panels");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
TestIcon testIcon = new TestIcon(60);
@@ -74,33 +75,33 @@ public class Panels extends VerticalLayout implements View {
panel = new Panel("Borderless style");
panel.setIcon(testIcon.get());
- panel.addStyleName("borderless");
+ panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
panel.setContent(panelContent());
row.addComponent(panel);
panel = new Panel("Borderless + scroll divider");
panel.setIcon(testIcon.get());
- panel.addStyleName("borderless");
- panel.addStyleName("scroll-divider");
+ panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
+ panel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
panel.setContent(panelContentScroll());
panel.setHeight("17em");
row.addComponent(panel);
panel = new Panel("Well style");
panel.setIcon(testIcon.get());
- panel.addStyleName("well");
+ panel.addStyleName(ValoTheme.PANEL_WELL);
panel.setContent(panelContent());
row.addComponent(panel);
CssLayout layout = new CssLayout();
layout.setIcon(testIcon.get());
layout.setCaption("Panel style layout");
- layout.addStyleName("card");
+ layout.addStyleName(ValoTheme.LAYOUT_CARD);
layout.addComponent(panelContent());
row.addComponent(layout);
layout = new CssLayout();
- layout.addStyleName("card");
+ layout.addStyleName(ValoTheme.LAYOUT_CARD);
row.addComponent(layout);
HorizontalLayout panelCaption = new HorizontalLayout();
panelCaption.addStyleName("v-panel-caption");
@@ -112,13 +113,13 @@ public class Panels extends VerticalLayout implements View {
Button action = new Button();
action.setIcon(FontAwesome.PENCIL);
- action.addStyleName("borderless-colored");
- action.addStyleName("small");
- action.addStyleName("icon-only");
+ action.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
+ action.addStyleName(ValoTheme.BUTTON_SMALL);
+ action.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
panelCaption.addComponent(action);
MenuBar dropdown = new MenuBar();
- dropdown.addStyleName("borderless");
- dropdown.addStyleName("small");
+ dropdown.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
+ dropdown.addStyleName(ValoTheme.MENUBAR_SMALL);
MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null);
addItem.setStyleName("icon-only");
addItem.addItem("Settings", null);
@@ -134,7 +135,7 @@ public class Panels extends VerticalLayout implements View {
layout = new CssLayout();
layout.setIcon(testIcon.get());
layout.setCaption("Well style layout");
- layout.addStyleName("well");
+ layout.addStyleName(ValoTheme.LAYOUT_WELL);
layout.addComponent(panelContent());
row.addComponent(layout);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java b/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java
index c15270400c..58988c06d6 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/PopupViews.java
@@ -24,17 +24,18 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.PopupView.Content;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class PopupViews extends VerticalLayout implements View {
public PopupViews() {
setMargin(true);
Label h1 = new Label("Popup Views");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
index 8ed846e39f..9642cb5ccf 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
@@ -23,17 +23,18 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.ProgressBar;
import com.vaadin.ui.Slider;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Sliders extends VerticalLayout implements View {
public Sliders() {
setMargin(true);
Label h1 = new Label("Sliders");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -67,7 +68,7 @@ public class Sliders extends VerticalLayout implements View {
slider = new Slider("No indicator");
slider.setValue(50.0);
slider.setWidth("200px");
- slider.addStyleName("no-indicator");
+ slider.addStyleName(ValoTheme.SLIDER_NO_INDICATOR);
row.addComponent(slider);
slider = new Slider("With ticks (not in IE8 & IE9)");
@@ -119,7 +120,7 @@ public class Sliders extends VerticalLayout implements View {
slider = new Slider("No indicator");
slider.setValue(50.0);
slider.setHeight("200px");
- slider.addStyleName("no-indicator");
+ slider.addStyleName(ValoTheme.SLIDER_NO_INDICATOR);
slider.setOrientation(SliderOrientation.VERTICAL);
row.addComponent(slider);
@@ -137,11 +138,11 @@ public class Sliders extends VerticalLayout implements View {
row.addComponent(slider);
h1 = new Label("Progress Bars");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -154,7 +155,7 @@ public class Sliders extends VerticalLayout implements View {
pb2 = new ProgressBar();
pb2.setCaption("Point style");
pb2.setWidth("300px");
- pb2.addStyleName("point");
+ pb2.addStyleName(ValoTheme.PROGRESSBAR_POINT);
// pb2.setValue(0.6f);
row.addComponent(pb2);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java b/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java
index 9a6d86ae04..4983bc5813 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/SplitPanels.java
@@ -23,20 +23,21 @@ import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.VerticalSplitPanel;
+import com.vaadin.ui.themes.ValoTheme;
public class SplitPanels extends VerticalLayout implements View {
public SplitPanels() {
setMargin(true);
Label h1 = new Label("Split Panels");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
addComponent(new Label(
"Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style."));
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
row.setMargin(new MarginInfo(true, false, false, false));
addComponent(row);
@@ -61,7 +62,7 @@ public class SplitPanels extends VerticalLayout implements View {
sp.setCaption("Large style");
sp.setWidth("300px");
sp.setHeight("200px");
- sp.addStyleName("large");
+ sp.addStyleName(ValoTheme.SPLITPANEL_LARGE);
sp.setFirstComponent(getContent());
sp.setSecondComponent(getContent());
row.addComponent(sp);
@@ -70,7 +71,7 @@ public class SplitPanels extends VerticalLayout implements View {
sp2.setCaption("Large style");
sp2.setWidth("300px");
sp2.setHeight("200px");
- sp2.addStyleName("large");
+ sp2.addStyleName(ValoTheme.SPLITPANEL_LARGE);
sp2.setFirstComponent(getContent());
sp2.setSecondComponent(getContent());
row.addComponent(sp2);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
index fb6638ee7d..071e6b746a 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java
@@ -42,6 +42,7 @@ import com.vaadin.ui.Table.TableDragMode;
import com.vaadin.ui.TextField;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Tables extends VerticalLayout implements View {
@@ -72,11 +73,11 @@ public class Tables extends VerticalLayout implements View {
setSpacing(true);
Label h1 = new Label("Tables");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout wrap = new HorizontalLayout();
- wrap.addStyleName("wrapping");
+ wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
wrap.setSpacing(true);
addComponent(wrap);
@@ -189,9 +190,9 @@ public class Tables extends VerticalLayout implements View {
Object columnId) {
TextField tf = new TextField();
tf.setInputPrompt("Type here…");
- // tf.addStyleName("compact");
+ // tf.addStyleName(ValoTheme.TABLE_COMPACT);
if ((Integer) itemId % 2 == 0) {
- tf.addStyleName("borderless");
+ tf.addStyleName(ValoTheme.TABLE_BORDERLESS);
}
return tf;
}
@@ -203,9 +204,9 @@ public class Tables extends VerticalLayout implements View {
public Object generateCell(Table source, Object itemId,
Object columnId) {
DateField tf = new DateField();
- tf.addStyleName("compact");
+ tf.addStyleName(ValoTheme.TABLE_COMPACT);
if ((Integer) itemId % 2 == 0) {
- tf.addStyleName("borderless");
+ tf.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
}
return tf;
}
@@ -218,9 +219,9 @@ public class Tables extends VerticalLayout implements View {
Object columnId) {
ComboBox tf = new ComboBox();
tf.setInputPrompt("Select");
- tf.addStyleName("compact");
+ tf.addStyleName(ValoTheme.TABLE_COMPACT);
if ((Integer) itemId % 2 == 0) {
- tf.addStyleName("borderless");
+ tf.addStyleName(ValoTheme.DATEFIELD_BORDERLESS);
}
return tf;
}
@@ -232,7 +233,7 @@ public class Tables extends VerticalLayout implements View {
public Object generateCell(Table source, Object itemId,
Object columnId) {
Button b = new Button("Button");
- b.addStyleName("small");
+ b.addStyleName(ValoTheme.BUTTON_SMALL);
return b;
}
});
@@ -244,7 +245,7 @@ public class Tables extends VerticalLayout implements View {
Object columnId) {
Label label = new Label("Label component");
label.setSizeUndefined();
- label.addStyleName("bold");
+ label.addStyleName(ValoTheme.LABEL_BOLD);
return label;
}
});
@@ -267,7 +268,7 @@ public class Tables extends VerticalLayout implements View {
OptionGroup op = new OptionGroup();
op.addItem("Male");
op.addItem("Female");
- op.addStyleName("horizontal");
+ op.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
return op;
}
});
@@ -321,45 +322,45 @@ public class Tables extends VerticalLayout implements View {
expandRatios ? 1.0f : 0);
if (!stripes) {
- table.addStyleName("no-stripes");
+ table.addStyleName(ValoTheme.TABLE_NO_STRIPES);
} else {
- table.removeStyleName("no-stripes");
+ table.removeStyleName(ValoTheme.TABLE_NO_STRIPES);
}
if (!verticalLines) {
- table.addStyleName("no-vertical-lines");
+ table.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
} else {
- table.removeStyleName("no-vertical-lines");
+ table.removeStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
}
if (!horizontalLines) {
- table.addStyleName("no-horizontal-lines");
+ table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
} else {
- table.removeStyleName("no-horizontal-lines");
+ table.removeStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
}
if (borderless) {
- table.addStyleName("borderless");
+ table.addStyleName(ValoTheme.TABLE_BORDERLESS);
} else {
- table.removeStyleName("borderless");
+ table.removeStyleName(ValoTheme.TABLE_BORDERLESS);
}
if (!headers) {
- table.addStyleName("no-header");
+ table.addStyleName(ValoTheme.TABLE_NO_HEADER);
} else {
- table.removeStyleName("no-header");
+ table.removeStyleName(ValoTheme.TABLE_NO_HEADER);
}
if (compact) {
- table.addStyleName("compact");
+ table.addStyleName(ValoTheme.TABLE_COMPACT);
} else {
- table.removeStyleName("compact");
+ table.removeStyleName(ValoTheme.TABLE_COMPACT);
}
if (small) {
- table.addStyleName("small");
+ table.addStyleName(ValoTheme.TABLE_SMALL);
} else {
- table.removeStyleName("small");
+ table.removeStyleName(ValoTheme.TABLE_SMALL);
}
if (!rowIndex && !rowCaption && rowIcon) {
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
index 5e77292471..421da5ffe7 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
import com.vaadin.ui.TabSheet.SelectedTabChangeListener;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Tabsheets extends VerticalLayout implements View {
@@ -37,12 +38,12 @@ public class Tabsheets extends VerticalLayout implements View {
setMargin(true);
Label h1 = new Label("Tabs");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout wrap = new HorizontalLayout();
wrap.setSpacing(true);
- wrap.addStyleName("wrapping");
+ wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
addComponent(wrap);
final CheckBox closable = new CheckBox("Closable");
@@ -66,12 +67,12 @@ public class Tabsheets extends VerticalLayout implements View {
wrap.addComponent(disable);
Label h3 = new Label("Additional Styles");
- h3.addStyleName("h3");
+ h3.addStyleName(ValoTheme.LABEL_H3);
addComponent(h3);
wrap = new HorizontalLayout();
wrap.setSpacing(true);
- wrap.addStyleName("wrapping");
+ wrap.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
wrap.setMargin(new MarginInfo(false, false, true, false));
addComponent(wrap);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
index 347a683673..be6e430b23 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFields.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class TextFields extends VerticalLayout implements View {
private TestIcon testIcon = new TestIcon(140);
@@ -36,11 +37,11 @@ public class TextFields extends VerticalLayout implements View {
setMargin(true);
Label h1 = new Label("Text Fields");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -72,7 +73,7 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField("Error, borderless");
tf.setValue("Something’s wrong");
tf.setComponentError(new UserError("Fix it, now!"));
- tf.addStyleName("borderless");
+ tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
row.addComponent(tf);
tf = new TextField("Read-only");
@@ -83,121 +84,121 @@ public class TextFields extends VerticalLayout implements View {
tf = new TextField("Small");
tf.setValue("Field value");
- tf.addStyleName("small");
+ tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
row.addComponent(tf);
tf = new TextField("Large");
tf.setValue("Field value");
- tf.addStyleName("large");
+ tf.addStyleName(ValoTheme.TEXTFIELD_LARGE);
tf.setIcon(testIcon.get(true));
row.addComponent(tf);
tf = new TextField("Icon inside");
tf.setInputPrompt("Ooh, an icon");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Large, Icon inside");
tf.setInputPrompt("Ooh, an icon");
- tf.addStyleName("large");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_LARGE);
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Small, Icon inside");
tf.setInputPrompt("Ooh, an icon");
- tf.addStyleName("small");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("16px supported by default");
tf.setInputPrompt("Image icon");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
tf = new TextField();
tf.setValue("Font, no caption");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField();
tf.setValue("Image, no caption");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get(true, 16));
row.addComponent(tf);
CssLayout group = new CssLayout();
- group.addStyleName("v-component-group");
+ group.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
row.addComponent(group);
tf = new TextField();
tf.setInputPrompt("Grouped with a button");
- tf.addStyleName("inline-icon");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
tf.setIcon(testIcon.get());
tf.setWidth("260px");
group.addComponent(tf);
Button button = new Button("Do It");
- // button.addStyleName("primary");
+ // button.addStyleName(ValoTheme.BUTTON_PRIMARY);
group.addComponent(button);
tf = new TextField("Borderless");
tf.setInputPrompt("Write here…");
- tf.addStyleName("inline-icon");
- tf.addStyleName("borderless");
+ tf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
+ tf.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
tf.setIcon(testIcon.get());
row.addComponent(tf);
tf = new TextField("Right-aligned");
tf.setValue("1,234");
- tf.addStyleName("align-right");
+ tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT);
row.addComponent(tf);
tf = new TextField("Centered");
tf.setInputPrompt("Guess what?");
- tf.addStyleName("align-center");
+ tf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
row.addComponent(tf);
PasswordField pwf = new PasswordField("Password");
pwf.setInputPrompt("Secret words");
- pwf.addStyleName("inline-icon");
+ pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
pwf.setIcon(FontAwesome.LOCK);
row.addComponent(pwf);
pwf = new PasswordField("Password, right-aligned");
pwf.setInputPrompt("Secret words");
- pwf.addStyleName("inline-icon");
- pwf.addStyleName("align-right");
+ pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
+ pwf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_RIGHT);
pwf.setIcon(FontAwesome.LOCK);
row.addComponent(pwf);
pwf = new PasswordField("Password, centered");
pwf.setInputPrompt("Secret words");
- pwf.addStyleName("inline-icon");
- pwf.addStyleName("align-center");
+ pwf.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
+ pwf.addStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
pwf.setIcon(FontAwesome.LOCK);
row.addComponent(pwf);
tf = new TextField("Tiny");
tf.setValue("Field value");
- tf.addStyleName("tiny");
+ tf.addStyleName(ValoTheme.TEXTFIELD_TINY);
row.addComponent(tf);
tf = new TextField("Huge");
tf.setValue("Field value");
- tf.addStyleName("huge");
+ tf.addStyleName(ValoTheme.TEXTFIELD_HUGE);
row.addComponent(tf);
h1 = new Label("Text Areas");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
@@ -228,37 +229,37 @@ public class TextFields extends VerticalLayout implements View {
row.addComponent(ta);
ta = new TextArea("Small");
- ta.addStyleName("small");
+ ta.addStyleName(ValoTheme.TEXTAREA_SMALL);
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
ta = new TextArea("Large");
- ta.addStyleName("large");
+ ta.addStyleName(ValoTheme.TEXTAREA_LARGE);
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
ta = new TextArea("Borderless");
- ta.addStyleName("borderless");
+ ta.addStyleName(ValoTheme.TEXTAREA_BORDERLESS);
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
ta = new TextArea("Right-aligned");
- ta.addStyleName("align-right");
+ ta.addStyleName(ValoTheme.TEXTAREA_ALIGN_RIGHT);
ta.setValue("Field value, spanning multiple lines of text");
row.addComponent(ta);
ta = new TextArea("Centered");
- ta.addStyleName("align-center");
+ ta.addStyleName(ValoTheme.TEXTAREA_ALIGN_CENTER);
ta.setValue("Field value, spanning multiple lines of text");
row.addComponent(ta);
ta = new TextArea("Tiny");
- ta.addStyleName("tiny");
+ ta.addStyleName(ValoTheme.TEXTAREA_TINY);
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
ta = new TextArea("Huge");
- ta.addStyleName("huge");
+ ta.addStyleName(ValoTheme.TEXTAREA_HUGE);
ta.setInputPrompt("Write your comment…");
row.addComponent(ta);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Trees.java b/uitest/src/com/vaadin/tests/themes/valo/Trees.java
index cb5657660a..02846d8921 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Trees.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Trees.java
@@ -28,17 +28,18 @@ import com.vaadin.ui.Notification;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Tree.TreeDragMode;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.ValoTheme;
public class Trees extends VerticalLayout implements View {
public Trees() {
setMargin(true);
Label h1 = new Label("Trees");
- h1.addStyleName("h1");
+ h1.addStyleName(ValoTheme.LABEL_H1);
addComponent(h1);
HorizontalLayout row = new HorizontalLayout();
- row.addStyleName("wrapping");
+ row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
row.setSpacing(true);
addComponent(row);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java
index 3a3baa686c..0e62f983a6 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMenuLayout.java
@@ -19,6 +19,7 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.themes.ValoTheme;
/**
*
@@ -34,7 +35,7 @@ public class ValoMenuLayout extends HorizontalLayout {
public ValoMenuLayout() {
setSizeFull();
- menuArea.setPrimaryStyleName("valo-menu");
+ menuArea.setPrimaryStyleName(ValoTheme.MENU_ROOT);
contentArea.setPrimaryStyleName("valo-content");
contentArea.addStyleName("v-scrollable");
@@ -49,7 +50,7 @@ public class ValoMenuLayout extends HorizontalLayout {
}
public void addMenu(Component menu) {
- menu.addStyleName("valo-menu-part");
+ menu.addStyleName(ValoTheme.MENU_PART);
menuArea.addComponent(menu);
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
index 988b3487bd..3bf6fd7ca3 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
@@ -194,29 +194,29 @@ public class ValoThemeUI extends UI {
Component buildTestMenu() {
CssLayout menu = new CssLayout();
- menu.addStyleName("large-icons");
+ menu.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);
Label logo = new Label("Va");
logo.setSizeUndefined();
- logo.setPrimaryStyleName("valo-menu-logo");
+ logo.setPrimaryStyleName(ValoTheme.MENU_LOGO);
menu.addComponent(logo);
Button b = new Button(
"Reference <span class=\"valo-menu-badge\">3</span>");
b.setIcon(FontAwesome.TH_LIST);
- b.setPrimaryStyleName("valo-menu-item");
+ b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
b.addStyleName("selected");
b.setHtmlContentAllowed(true);
menu.addComponent(b);
b = new Button("API");
b.setIcon(FontAwesome.BOOK);
- b.setPrimaryStyleName("valo-menu-item");
+ b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
menu.addComponent(b);
b = new Button("Examples <span class=\"valo-menu-badge\">12</span>");
b.setIcon(FontAwesome.TABLE);
- b.setPrimaryStyleName("valo-menu-item");
+ b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
b.setHtmlContentAllowed(true);
menu.addComponent(b);
@@ -250,7 +250,7 @@ public class ValoThemeUI extends UI {
HorizontalLayout top = new HorizontalLayout();
top.setWidth("100%");
top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
- top.addStyleName("valo-menu-title");
+ top.addStyleName(ValoTheme.MENU_TITLE);
menu.addComponent(top);
menu.addComponent(createThemeSelect());
@@ -297,8 +297,8 @@ public class ValoThemeUI extends UI {
for (final Entry<String, String> item : menuItems.entrySet()) {
if (item.getKey().equals("labels")) {
label = new Label("Components", ContentMode.HTML);
- label.setPrimaryStyleName("valo-menu-subtitle");
- label.addStyleName("h4");
+ label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE);
+ label.addStyleName(ValoTheme.LABEL_H4);
label.setSizeUndefined();
menuItemsLayout.addComponent(label);
}
@@ -308,8 +308,8 @@ public class ValoThemeUI extends UI {
+ "</span>");
count = 0;
label = new Label("Containers", ContentMode.HTML);
- label.setPrimaryStyleName("valo-menu-subtitle");
- label.addStyleName("h4");
+ label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE);
+ label.addStyleName(ValoTheme.LABEL_H4);
label.setSizeUndefined();
menuItemsLayout.addComponent(label);
}
@@ -319,8 +319,8 @@ public class ValoThemeUI extends UI {
+ "</span>");
count = 0;
label = new Label("Other", ContentMode.HTML);
- label.setPrimaryStyleName("valo-menu-subtitle");
- label.addStyleName("h4");
+ label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE);
+ label.addStyleName(ValoTheme.LABEL_H4);
label.setSizeUndefined();
menuItemsLayout.addComponent(label);
}
@@ -335,7 +335,7 @@ public class ValoThemeUI extends UI {
+ " <span class=\"valo-menu-badge\">123</span>");
}
b.setHtmlContentAllowed(true);
- b.setPrimaryStyleName("valo-menu-item");
+ b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
b.setIcon(testIcon.get());
menuItemsLayout.addComponent(b);
count++;
diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java
new file mode 100644
index 0000000000..ff470336f5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.tooltip;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.MenuBar;
+
+public class MenuBarTooltip extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ MenuBar menubar = new MenuBar();
+
+ MenuBar.MenuItem menuitem = menubar.addItem("Menu item", null, null);
+ menuitem.setDescription("Menu item description");
+
+ MenuBar.MenuItem submenuitem1 = menuitem.addItem("Submenu item 1", null, null);
+ submenuitem1.setDescription("Submenu item 1 description");
+
+ MenuBar.MenuItem submenuitem2 = menuitem.addItem("Submenu item 2", null, null);
+ submenuitem2.setDescription("Submenu item 2 description");
+
+ addComponent(menubar);
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14854;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "MenuItem tooltip should have a larger z-index than MenuBar/MenuItem.";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java
new file mode 100644
index 0000000000..9b2f7d13d6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.tooltip;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
+import com.vaadin.ui.themes.ValoTheme;
+
+public class MenuBarTooltipTest extends MultiBrowserTest {
+
+ @Test
+ public void toolTipShouldBeOnTopOfMenuItem() {
+ String[] themes = new String[] {
+ ValoTheme.THEME_NAME,
+ Reindeer.THEME_NAME,
+ Runo.THEME_NAME,
+ ChameleonTheme.THEME_NAME
+ };
+
+ for(String theme : themes) {
+ assertZIndices(theme);
+ }
+ }
+
+ public void assertZIndices(String theme) {
+ openTestURL("theme=" + theme);
+
+ $(MenuBarElement.class).first().clickItem("Menu item");
+
+ assertThat(String.format("Invalid z-index for theme %s.", theme),
+ getZIndex("v-tooltip"), greaterThan(getZIndex("v-menubar-popup")));
+ }
+
+ private int getZIndex(String className) {
+ return Integer.parseInt(
+ findElement(By.className(className)).getCssValue("z-index"));
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
index 8a02d91d2c..3878e85193 100644
--- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
+++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
@@ -23,5 +23,6 @@
<generate-with class="com.vaadin.tests.widgetset.rebind.TestWidgetRegistryGenerator">
<when-type-is class="com.vaadin.tests.widgetset.client.TestWidgetConnector.TestWidgetRegistry" />
</generate-with>
-
+
+ <entry-point class="com.vaadin.tests.widgetset.client.TestingWidgetsetEntryPoint" />
</module>
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ProfilerCompilationCanary.java b/uitest/src/com/vaadin/tests/widgetset/client/ProfilerCompilationCanary.java
new file mode 100644
index 0000000000..d5ab1da2f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/ProfilerCompilationCanary.java
@@ -0,0 +1,48 @@
+/*
+ * 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.widgetset.client;
+
+import com.google.gwt.user.client.ui.Label;
+import com.vaadin.client.Profiler;
+
+public class ProfilerCompilationCanary extends Label {
+ public ProfilerCompilationCanary() {
+ if (Profiler.isEnabled()) {
+ setText("Test does not work when profiler is enabled {dummyCode;}");
+ } else {
+ setText(getCanaryCode());
+ }
+ }
+
+ /*
+ * Finds the native js function for the canaryWithProfiler method and gets a
+ * string representation of it, which in most browsers produces the actual
+ * method implementation that we want to verify has an empty body.
+ */
+ private static native String getCanaryCode()
+ /*-{
+ return @ProfilerCompilationCanary::canaryWithProfiler(*).toString();
+ }-*/;
+
+ /*
+ * We don't care about running this method, we just want to make sure that
+ * the generated implementation is empty.
+ */
+ public static void canaryWithProfiler() {
+ Profiler.enter("canaryWithProfiler");
+ Profiler.leave("canaryWithProfiler");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingWidgetsetEntryPoint.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingWidgetsetEntryPoint.java
new file mode 100644
index 0000000000..7268d02993
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingWidgetsetEntryPoint.java
@@ -0,0 +1,83 @@
+/*
+ * 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.widgetset.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.Window.Location;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ValueMap;
+import com.vaadin.client.debug.internal.DebugButton;
+import com.vaadin.client.debug.internal.Icon;
+import com.vaadin.client.debug.internal.Section;
+import com.vaadin.client.debug.internal.VDebugWindow;
+
+public class TestingWidgetsetEntryPoint implements EntryPoint {
+
+ @Override
+ public void onModuleLoad() {
+ if (Location.getPath().contains("PreserveCustomDebugSectionOpen")) {
+ addDummyDebugWindowSection();
+ }
+ }
+
+ private void addDummyDebugWindowSection() {
+ VDebugWindow.get().addSection(new Section() {
+ private final DebugButton tabButton = new DebugButton(Icon.ERROR,
+ "Dummy debug window section");
+ private final Label controls = new Label("");
+ private final Label contents = new Label(
+ "Dummy debug window section");
+
+ @Override
+ public DebugButton getTabButton() {
+ return tabButton;
+ }
+
+ @Override
+ public Widget getControls() {
+ return controls;
+ }
+
+ @Override
+ public Widget getContent() {
+ return contents;
+ }
+
+ @Override
+ public void show() {
+ // nop
+ }
+
+ @Override
+ public void hide() {
+ // nop
+ }
+
+ @Override
+ public void meta(ApplicationConnection ac, ValueMap meta) {
+ // nop
+ }
+
+ @Override
+ public void uidl(ApplicationConnection ac, ValueMap uidl) {
+ // nop
+ }
+ });
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/MySelectionModelConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/MySelectionModelConnector.java
new file mode 100644
index 0000000000..81a9ab5bf1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/MySelectionModelConnector.java
@@ -0,0 +1,61 @@
+/*
+ * 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.widgetset.client.grid;
+
+import com.vaadin.client.ServerConnector;
+import com.vaadin.client.connectors.MultiSelectionModelConnector;
+import com.vaadin.client.renderers.ComplexRenderer;
+import com.vaadin.client.widget.grid.selection.ClickSelectHandler;
+import com.vaadin.client.widget.grid.selection.SelectionModel.Multi;
+import com.vaadin.client.widgets.Grid;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.components.grid.GridCustomSelectionModel.MySelectionModel;
+
+import elemental.json.JsonObject;
+
+@Connect(MySelectionModel.class)
+public class MySelectionModelConnector extends MultiSelectionModelConnector {
+
+ private ClickSelectHandler<JsonObject> handler;
+
+ @Override
+ protected void extend(ServerConnector target) {
+ super.extend(target);
+ handler = new ClickSelectHandler<JsonObject>(getGrid());
+ }
+
+ @Override
+ public void onUnregister() {
+ super.onUnregister();
+ handler.removeHandler();
+ handler = null;
+ }
+
+ @Override
+ protected Multi<JsonObject> createSelectionModel() {
+ return new MySelectionModel();
+ }
+
+ public class MySelectionModel extends MultiSelectionModel {
+
+ @Override
+ protected ComplexRenderer<Boolean> createSelectionColumnRenderer(
+ Grid<JsonObject> grid) {
+ // No Selection Column.
+ return null;
+ }
+ }
+}