diff options
author | Knoobie <Knoobie@gmx.de> | 2017-10-30 09:00:21 +0100 |
---|---|---|
committer | Péter Török <31210544+torok-peter@users.noreply.github.com> | 2017-10-30 10:00:21 +0200 |
commit | e65efdfb50bc10bedf506d475f582276f6be0e2f (patch) | |
tree | 73c6ef9f6ad9658ea2ff564024f8426433c69b06 /uitest | |
parent | fb6e81221bd1b5ab0b81a3ee6c82e4286df57264 (diff) | |
download | vaadin-framework-e65efdfb50bc10bedf506d475f582276f6be0e2f.tar.gz vaadin-framework-e65efdfb50bc10bedf506d475f582276f6be0e2f.zip |
add Grid.Column#get/setAssistiveCaption (#10219)
* add Grid#Column#get/setAssistiveCaption
* fix test and update doc
* move testGridAssistiveCaption to GridTest
* delete test file
* delete test file
* Delete GridAssistiveCaptionTest.java
* Create GridAssistiveCaptionTest
* Create GridAssistiveCaption
* Rename GridAssistiveCaption to GridAssistiveCaption.java
* Rename GridAssistiveCaptionTest to GridAssistiveCaptionTest.java
* Reformat using eclipse
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridAssistiveCaption.java | 40 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/grid/GridAssistiveCaptionTest.java | 49 |
2 files changed, 89 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAssistiveCaption.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAssistiveCaption.java new file mode 100644 index 0000000000..83351d82f2 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAssistiveCaption.java @@ -0,0 +1,40 @@ +/* + * 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.data.ValueProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Grid; + +public class GridAssistiveCaption extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Grid<String> grid = new Grid<>(); + grid.addColumn(ValueProvider.identity()); + grid.setItems("a", "b"); + addComponent(grid); + + addComponent(new Button("addAssistiveCaption", event -> { + grid.getColumns().get(0).setAssistiveCaption("Press Enter to sort."); + })); + addComponent(new Button("removeAssistiveCaption", event -> { + grid.getColumns().get(0).setAssistiveCaption(null); + })); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridAssistiveCaptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAssistiveCaptionTest.java new file mode 100644 index 0000000000..e15858900a --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridAssistiveCaptionTest.java @@ -0,0 +1,49 @@ +/* + * 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 static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.GridElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class GridAssistiveCaptionTest extends SingleBrowserTest { + + @Test + public void checkGridAriaLabel() { + openTestURL(); + + GridElement.GridCellElement headerCell = $(GridElement.class).first() + .getHeaderCell(0, 0); + + // default grid has no aria-label + assertNull("Column should not contain aria-label", + headerCell.getAttribute("aria-label")); + + $(ButtonElement.class).caption("addAssistiveCaption").first().click(); + assertTrue("Column should contain aria-label", headerCell + .getAttribute("aria-label").equals("Press Enter to sort.")); + + $(ButtonElement.class).caption("removeAssistiveCaption").first() + .click(); + assertNull("Column should not contain aria-label", + headerCell.getAttribute("aria-label")); + } +} |