aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorKnoobie <Knoobie@gmx.de>2017-10-11 12:15:26 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-11 13:15:26 +0300
commit0843f53881a3514a72370e51ab33f59df423aa0e (patch)
treeb094e68eb28adf57a540c2624f9ad78f888fddf9 /uitest/src/test
parent69c6675572e05c6b9c193b402f8d980f6af40884 (diff)
downloadvaadin-framework-0843f53881a3514a72370e51ab33f59df423aa0e.tar.gz
vaadin-framework-0843f53881a3514a72370e51ab33f59df423aa0e.zip
Add aria-rowcount to grid (#10167)
This is based on discussion from vaadin/vaadin-grid#1023 .
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaRowcountTest.java74
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcountTest.java73
2 files changed, 147 insertions, 0 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaRowcountTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaRowcountTest.java
new file mode 100644
index 0000000000..cf2bdebb6f
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaRowcountTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2000-2017 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.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Vaadin Ltd
+ */
+public class GridAriaRowcountTest extends SingleBrowserTest {
+
+ private GridElement grid;
+
+ @Test
+ public void checkGridAriaRowcount() {
+ openTestURL();
+
+ grid = $(GridElement.class).first();
+
+ // default with 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("addFooter").first().click();
+ // 1 header row, 2 body rows and 1 footer row.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("removeFooter").first().click();
+ // 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("addHeader").first().click();
+ // 2 header row and 2 body rows.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("removeHeader").first().click();
+ // 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("setItemsTo3").first().click();
+ // 1 header row and 3 body rows.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("setItemsTo6").first().click();
+ // 1 header row and 6 body rows.
+ assertTrue("Grid should have 7 rows", containsRows(7));
+
+ $(ButtonElement.class).caption("updateAll").first().click();
+ // 2 header rows, 4 body rows and 1 footer row.
+ assertTrue("Grid should have 7 rows", containsRows(7));
+ }
+
+ private boolean containsRows(int rowcount) {
+ return grid.getHTML().contains("aria-rowcount=\"" + String.valueOf(rowcount) + "\"");
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcountTest.java b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcountTest.java
new file mode 100644
index 0000000000..df940c7091
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcountTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2017 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.treegrid;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TreeGridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Vaadin Ltd
+ */
+public class TreeGridAriaRowcountTest extends SingleBrowserTest {
+
+ private TreeGridElement grid;
+
+ @Test
+ public void checkTreeGridAriaRowcount() {
+ openTestURL();
+
+ grid = $(TreeGridElement.class).first();
+
+ // default with 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("addFooter").first().click();
+ // 1 header row, 2 body rows and 1 footer row.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("removeFooter").first().click();
+ // 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("addHeader").first().click();
+ // 2 header row and 2 body rows.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("removeHeader").first().click();
+ // 1 header row and 2 body rows.
+ assertTrue("Grid should have 3 rows", containsRows(3));
+
+ $(ButtonElement.class).caption("setItemsTo3").first().click();
+ // 1 header row and 3 body rows.
+ assertTrue("Grid should have 4 rows", containsRows(4));
+
+ $(ButtonElement.class).caption("setItemsTo6").first().click();
+ // 1 header row and 6 body rows.
+ assertTrue("Grid should have 7 rows", containsRows(7));
+
+ $(ButtonElement.class).caption("updateAll").first().click();
+ // 2 header rows, 4 body rows and 1 footer row.
+ assertTrue("Grid should have 7 rows", containsRows(7));
+ }
+
+ private boolean containsRows(int rowcount) {
+ return grid.getHTML().contains("aria-rowcount=\"" + String.valueOf(rowcount) + "\"");
+ }
+}