summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2017-09-20 10:59:02 +0300
committerHenri Sara <henri.sara@gmail.com>2017-09-20 11:37:03 +0300
commitf3ae6c2c2b1245d20d94cb4eeee4efee8c2b06c6 (patch)
treea445f0d5da46124d2589412cbe869ef1fceece87 /uitest
parent5558b8768b1eddedb7364cf90c12aa1a36e068c4 (diff)
downloadvaadin-framework-f3ae6c2c2b1245d20d94cb4eeee4efee8c2b06c6.tar.gz
vaadin-framework-f3ae6c2c2b1245d20d94cb4eeee4efee8c2b06c6.zip
Fix ColorPickerGrid indexing
Fixes #9018
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUI.java34
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java43
2 files changed, 77 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUI.java b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUI.java
new file mode 100644
index 0000000000..efffada19a
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUI.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.components.colorpicker;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.tests.components.AbstractReindeerTestUI;
+import com.vaadin.ui.components.colorpicker.ColorPickerGrid;
+
+/**
+ * Tests index handling in ColorPickerGrid.
+ */
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class ColorPickerGridUI extends AbstractReindeerTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ ColorPickerGrid colorPickerGrid = new ColorPickerGrid(
+ new Color[][] { { Color.RED, Color.GREEN, Color.BLUE } });
+ colorPickerGrid.setWidth("300px");
+ colorPickerGrid.setHeight("100px");
+ addComponent(colorPickerGrid);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Click on the second color and check that no exceptions are thrown.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9018;
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java
new file mode 100644
index 0000000000..f1a44a1779
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/colorpicker/ColorPickerGridUITest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2016 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.colorpicker;
+
+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 ColorPickerGridUITest extends SingleBrowserTest {
+
+ @Test
+ public void testNoError() throws Exception {
+ openTestURL();
+
+ // find the color picker grid and click on the second color
+ WebElement grid = getDriver()
+ .findElement(By.className("v-colorpicker-grid"));
+ // click on the second color
+ grid.findElements(By.tagName("td")).get(1).click();
+
+ // check that the color picker does not have component error set
+ if (hasCssClass(grid, "v-colorpicker-grid-error")) {
+ Assert.fail(
+ "ColorPickerGrid should not have an active component error");
+ }
+ }
+}