diff options
Diffstat (limited to 'uitest')
3 files changed, 53 insertions, 1 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabled.java b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabled.java new file mode 100644 index 0000000000..885b701517 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabled.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.components.nativeselect; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.NativeSelect; + +/** + * @author Vaadin Ltd + * + */ +@Widgetset("com.vaadin.DefaultWidgetSet") +public class NativeSelectDisabled extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + NativeSelect<String> select = new NativeSelect<>(); + select.setItems("Foo", "Bar"); + select.setValue("Bar"); + select.setEnabled(false); + addButton("Set Enabled/Disabled", event -> { + select.setEnabled(!select.isEnabled()); + }); + addComponent(select); + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabledTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabledTest.java new file mode 100644 index 0000000000..fe01ef90ad --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectDisabledTest.java @@ -0,0 +1,26 @@ +package com.vaadin.tests.components.nativeselect; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.NativeSelectElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class NativeSelectDisabledTest extends MultiBrowserTest { + + @Test + public void testDisabled() { + openTestURL(); + + NativeSelectElement el = $(NativeSelectElement.class).first(); + assertEquals(false, el.isEnabled()); + ButtonElement but = $(ButtonElement.class).first(); + but.click(); + assertEquals(true, el.isEnabled()); + assertEquals(null, el.getSelectElement().getAttribute("disabled")); + but.click(); + System.out.println(el.getSelectElement().getText()); + assertEquals("true", el.getSelectElement().getAttribute("disabled")); + } +}
\ No newline at end of file diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java index 4f48d7a1ce..10a78e4fc5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectInitTest.java @@ -35,5 +35,4 @@ public class NativeSelectInitTest extends MultiBrowserTest { String selected = $(NativeSelectElement.class).first().getValue(); assertEquals("Bar", selected); } - } |