diff options
author | Knoobie <Knoobie@gmx.de> | 2017-10-04 07:51:31 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-04 08:51:31 +0300 |
commit | 80336d30ed12d53f24c01de5c4b6274ccc094b3b (patch) | |
tree | dd3994504c85feade1810478faa372f5229ffefc /uitest | |
parent | bf690d31eb986ef1803324ff2bd628104a7cb0fe (diff) | |
download | vaadin-framework-80336d30ed12d53f24c01de5c4b6274ccc094b3b.tar.gz vaadin-framework-80336d30ed12d53f24c01de5c4b6274ccc094b3b.zip |
Add role="grid" and aria-multiselectable to grid (#10009)
Also adds aria-selected for grid rows.
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java | 50 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaMultiselectableTest.java | 50 |
2 files changed, 100 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java new file mode 100644 index 0000000000..144e518c43 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java @@ -0,0 +1,50 @@ +/* + * 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.grid; + +import com.vaadin.data.ValueProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.SelectionMode; + +/** + * @author Vaadin Ltd + * + */ +public class GridAriaMultiselectable extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Grid<String> grid = new Grid<>(); + grid.addColumn(ValueProvider.identity()); + grid.setItems("a", "b"); + grid.setSelectionMode(SelectionMode.NONE); + + addComponent(grid); + + Button singleSelectBtn = new Button("SingleSelect", event -> { + grid.setSelectionMode(SelectionMode.SINGLE); + }); + addComponent(singleSelectBtn); + + Button multiSelectBtn = new Button("MultiSelect", event -> { + grid.setSelectionMode(SelectionMode.MULTI); + }); + addComponent(multiSelectBtn); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaMultiselectableTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaMultiselectableTest.java new file mode 100644 index 0000000000..eb6cd44f50 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAriaMultiselectableTest.java @@ -0,0 +1,50 @@ +/* + * 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.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; + +/** + * @author Vaadin Ltd + */ +public class GridAriaMultiselectableTest extends SingleBrowserTest { + + @Test + public void checkAriaMultiselectable() { + openTestURL(); + + GridElement grid = $(GridElement.class).first(); + + Assert.assertTrue("Grid should have the role 'grid'", + grid.getHTML().contains("role=\"grid\"")); + Assert.assertFalse("Grid should not have aria-multiselectable", + grid.getHTML().contains("aria-multiselectable")); + + $(ButtonElement.class).caption("SingleSelect").first().click(); + + Assert.assertTrue("Grid should have aria-multiselectable 'false'", + grid.getHTML().contains("aria-multiselectable=\"false\"")); + + $(ButtonElement.class).caption("MultiSelect").first().click(); + + Assert.assertTrue("Grid should have aria-multiselectable 'true'", + grid.getHTML().contains("aria-multiselectable=\"true\"")); + } +} |