From 4c2963ac4e0f5b2a9a59bd7791f7ea563acae6eb Mon Sep 17 00:00:00 2001 From: Knoobie Date: Mon, 18 Sep 2017 09:47:46 +0200 Subject: Add aria-sort to Grid (#10007) This adds basic support for aria-sort for Grid (https://www.w3.org/TR/wai-aria-1.1/#aria-sort). - aria-sort is not added, if the column is not sortable - aria-sort="none" is added, if the column is sortable but currently not sorted - aria-sort="ascending" is added, if the column is sorted by asc - aria-sort="descending" is added, if the column is sorted by desc - aria-sort="other" is added, if more than 1 column is sorted, currently there is no aria-sort-order --- .../com/vaadin/tests/components/grid/GridSortIndicatorTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'uitest') diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java index 429e5a671e..2f623e1c51 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridSortIndicatorTest.java @@ -35,18 +35,26 @@ public class GridSortIndicatorTest extends SingleBrowserTest { Assert.assertTrue("First column should be sorted ascending", grid.getHeaderCell(0, 0).getAttribute("class") .contains("sort-asc")); + Assert.assertEquals("First column should have aria-sort other", "other", + grid.getHeaderCell(0, 0).getAttribute("aria-sort")); Assert.assertEquals("First column should be first in sort order", "1", grid.getHeaderCell(0, 0).getAttribute("sort-order")); Assert.assertTrue("Second column should be sorted ascending", grid.getHeaderCell(0, 1).getAttribute("class") .contains("sort-asc")); + Assert.assertEquals("Second column should have aria-sort other", "other", + grid.getHeaderCell(0, 1).getAttribute("aria-sort")); Assert.assertEquals("Second column should be also sorted", "2", grid.getHeaderCell(0, 1).getAttribute("sort-order")); $(ButtonElement.class).caption("Sort first").first().click(); + Assert.assertEquals("First column should have aria-sort ascending", "ascending", + grid.getHeaderCell(0, 0).getAttribute("aria-sort")); Assert.assertTrue("First column should be sorted ascending", grid.getHeaderCell(0, 0).getAttribute("class") .contains("sort-asc")); + Assert.assertEquals("Second column should have aria-sort none", "none", + grid.getHeaderCell(0, 1).getAttribute("aria-sort")); Assert.assertFalse("Second column should not be sorted", grid.getHeaderCell(0, 1).getAttribute("class") .contains("sort-asc")); -- cgit v1.2.3