aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2018-02-12 15:14:49 +0200
committerIlia Motornyi <elmot@vaadin.com>2018-02-12 15:14:49 +0200
commitc641c7f56fcccada9268cbe0979fc66726f637d3 (patch)
tree4d177cfefb3c33f917518efb9e060a8ca9c6017f /uitest/src/main/java
parent201c4f1d77c96b2284773309a6f8c836e159a2d4 (diff)
downloadvaadin-framework-c641c7f56fcccada9268cbe0979fc66726f637d3.tar.gz
vaadin-framework-c641c7f56fcccada9268cbe0979fc66726f637d3.zip
Implement focus handing in RadioButtonGroup and CheckboxGroup (#10440)
Fixes #10429 * implement focus handing in RadioButtonGroup, fixes #10429 * Merge branch 'master' of https://github.com/vaadin/framework into radiobuttongroup-focus * merge * Merge branch 'master' of https://github.com/vaadin/framework into radiobuttongroup-focus * fix initial focus handling also on CheckBoxGroup and add tests * add license headers * Merge branch 'master' of https://github.com/vaadin/framework into radiobuttongroup-focus * changed client to use lambdas and refactored focus testing to parent class * made FocusTest abstract * Merge branch 'master' of https://github.com/vaadin/framework into radiobuttongroup-focus * don't allow focusing on disabled items & refactor focusing first item
Diffstat (limited to 'uitest/src/main/java')
-rwxr-xr-xuitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocus.java40
-rwxr-xr-xuitest/src/main/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocus.java44
2 files changed, 84 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocus.java b/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocus.java
new file mode 100755
index 0000000000..7d845e96a4
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocus.java
@@ -0,0 +1,40 @@
+/*
+ * 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.checkboxgroup;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.CheckBoxGroup;
+
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class CheckBoxGroupFocus extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ CheckBoxGroup<String> cbg = new CheckBoxGroup<>("CheckBoxes");
+ cbg.setItems("Test1", "Test2", "Test3");
+ cbg.select("Test2");
+ cbg.setItemCaptionGenerator(item -> "Option " + item);
+ cbg.focus();
+ CheckBoxGroup<String> cbg2 = new CheckBoxGroup<>("No selection");
+ cbg2.setItems("Foo1", "Foo2", "Foo3");
+ Button button = new Button("focus second group", e -> cbg2.focus());
+ addComponents(cbg, cbg2, button);
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocus.java b/uitest/src/main/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocus.java
new file mode 100755
index 0000000000..4342a32860
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocus.java
@@ -0,0 +1,44 @@
+/*
+ * 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.radiobuttongroup;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.RadioButtonGroup;
+
+/**
+ * @author Vaadin Ltd
+ *
+ */
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class RadioButtonGroupFocus extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ RadioButtonGroup<String> rbg = new RadioButtonGroup<>("Radios");
+ rbg.setItems("Test1", "Test2", "Test3");
+ rbg.setSelectedItem("Test2");
+ rbg.setItemCaptionGenerator(item -> "Option " + item);
+ rbg.focus();
+ RadioButtonGroup<String> rbg2 = new RadioButtonGroup<>("No selection");
+ rbg2.setItems("Foo1", "Foo2", "Foo3");
+ Button button = new Button("focus second group", e -> rbg2.focus());
+ addComponents(rbg, rbg2, button);
+ }
+
+}