diff options
author | Artur Signell <artur@vaadin.com> | 2016-09-15 12:09:41 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-09-15 10:39:29 +0000 |
commit | e77421b44331e225a186ba6b6d3482f0537a0c4d (patch) | |
tree | 01f65c0b7c5a68533cc5b272e7bac09767794551 | |
parent | c73e1833b624f931777215d0b8b14b0b1b833b9e (diff) | |
download | vaadin-framework-e77421b44331e225a186ba6b6d3482f0537a0c4d.tar.gz vaadin-framework-e77421b44331e225a186ba6b6d3482f0537a0c4d.zip |
Fix AbstractTextFieldConnector super class
This makes field level features work correctly with
TextField/PasswordField/TextArea
Change-Id: I10c9fff10fdcf300e1e3a1940c97260ace849a81
9 files changed, 199 insertions, 6 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java index d774ba2262..251a5c7a97 100644 --- a/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textfield/AbstractTextFieldConnector.java @@ -17,7 +17,7 @@ package com.vaadin.client.ui.textfield; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.annotations.OnStateChange; -import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.AbstractTextFieldWidget; import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; import com.vaadin.shared.ui.textfield.AbstractTextFieldClientRpc; @@ -28,8 +28,8 @@ import com.vaadin.ui.AbstractTextField; /** * Connector class for AbstractTextField. */ -public abstract class AbstractTextFieldConnector - extends AbstractComponentConnector implements ValueChangeHandler.Owner { +public abstract class AbstractTextFieldConnector extends AbstractFieldConnector + implements ValueChangeHandler.Owner { private class AbstractTextFieldClientRpcImpl implements AbstractTextFieldClientRpc { diff --git a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java index 86a743001b..ab63c2ae42 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import com.vaadin.data.HasRequired; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Alignment; @@ -12,7 +13,6 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.v7.data.Item; -import com.vaadin.v7.ui.Field; import com.vaadin.v7.ui.NativeSelect; public abstract class ComponentTestCase<T extends AbstractComponent> @@ -71,7 +71,7 @@ public abstract class ComponentTestCase<T extends AbstractComponent> actions.add(createReadonlyAction(false)); actions.add(createErrorIndicatorAction(false)); - if (Field.class.isAssignableFrom(getTestClass())) { + if (HasRequired.class.isAssignableFrom(getTestClass())) { actions.add(createRequiredAction(false)); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java index 689663c84a..7f4f3c855b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java @@ -3,7 +3,8 @@ package com.vaadin.tests.components.richtextarea; import com.vaadin.tests.components.abstractfield.AbstractFieldTest; import com.vaadin.ui.RichTextArea; -public class RichTextAreaTest extends AbstractFieldTest<RichTextArea, String> { +public class ConfigurableRichTextAreaUI + extends AbstractFieldTest<RichTextArea, String> { @Override protected Class<RichTextArea> getTestClass() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUI.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUI.java new file mode 100644 index 0000000000..7605443101 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUI.java @@ -0,0 +1,29 @@ +/* + * 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.textarea; + +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.TextArea; + +public class ConfigurableTextAreaUI + extends AbstractFieldTest<TextArea, String> { + + @Override + protected Class<TextArea> getTestClass() { + return TextArea.class; + } + +} diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUI.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUI.java new file mode 100644 index 0000000000..00e8a21fd9 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUI.java @@ -0,0 +1,29 @@ +/* + * 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.textfield; + +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.TextField; + +public class ConfigurableTextFieldUI + extends AbstractFieldTest<TextField, String> { + + @Override + protected Class<TextField> getTestClass() { + return TextField.class; + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ConfigurableAbstractFieldTest.java b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ConfigurableAbstractFieldTest.java new file mode 100644 index 0000000000..82b572f5e1 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ConfigurableAbstractFieldTest.java @@ -0,0 +1,67 @@ +/* + * 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.abstractfield; + +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public abstract class ConfigurableAbstractFieldTest extends SingleBrowserTest { + + private static final org.openqa.selenium.By REQUIRED_BY = By + .className("v-required"); + private static final org.openqa.selenium.By ERROR_INDICATOR_BY = By + .className("v-errorindicator"); + + @Test + public void requiredIndicator() { + openTestURL(); + + assertNoRequiredIndicator(); + selectMenuPath("Component", "State", "Required"); + assertRequiredIndicator(); + selectMenuPath("Component", "State", "Required"); + assertNoRequiredIndicator(); + } + + @Test + public void errorIndicator() { + openTestURL(); + + assertNoErrorIndicator(); + selectMenuPath("Component", "State", "Error indicator"); + assertErrorIndicator(); + selectMenuPath("Component", "State", "Error indicator"); + assertNoErrorIndicator(); + } + + private void assertRequiredIndicator() { + assertElementPresent(REQUIRED_BY); + } + + private void assertNoRequiredIndicator() { + assertElementNotPresent(REQUIRED_BY); + } + + private void assertErrorIndicator() { + assertElementPresent(ERROR_INDICATOR_BY); + } + + private void assertNoErrorIndicator() { + assertElementNotPresent(ERROR_INDICATOR_BY); + } +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUITest.java b/uitest/src/test/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUITest.java new file mode 100644 index 0000000000..5b510facbe --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUITest.java @@ -0,0 +1,23 @@ +/* + * 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.richtextarea; + +import com.vaadin.tests.components.abstractfield.ConfigurableAbstractFieldTest; + +public class ConfigurableRichTextAreaUITest + extends ConfigurableAbstractFieldTest { + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUITest.java b/uitest/src/test/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUITest.java new file mode 100644 index 0000000000..7460b8d074 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/textarea/ConfigurableTextAreaUITest.java @@ -0,0 +1,22 @@ +/* + * 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.textarea; + +import com.vaadin.tests.components.abstractfield.ConfigurableAbstractFieldTest; + +public class ConfigurableTextAreaUITest extends ConfigurableAbstractFieldTest { + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUITest.java b/uitest/src/test/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUITest.java new file mode 100644 index 0000000000..ab4f5018b2 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/textfield/ConfigurableTextFieldUITest.java @@ -0,0 +1,22 @@ +/* + * 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.textfield; + +import com.vaadin.tests.components.abstractfield.ConfigurableAbstractFieldTest; + +public class ConfigurableTextFieldUITest extends ConfigurableAbstractFieldTest { + +} |