summaryrefslogtreecommitdiffstats
path: root/uitest/src
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-26 18:24:43 +0300
commit59c79733319c21e2e3402fb5ef9a8db4d0e356fe (patch)
tree06e5b7f12be3c14fc5868fffaa24a0d32c60d583 /uitest/src
parentc9d537b26bdec8dde8660e8ead63aeee3bd5fc1c (diff)
downloadvaadin-framework-8.1.5.tar.gz
vaadin-framework-8.1.5.zip
Fix ColorPickerGrid indexing8.1.5
Fixes #9018
Diffstat (limited to 'uitest/src')
-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");
+ }
+ }
+}