diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-03-28 22:03:55 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-03-31 19:19:09 +0000 |
commit | d0bc54ba4b487fe461cc950de02ec57187c654ad (patch) | |
tree | 7e8ca5b152907cc625307b1bb604f6496748f025 /uitest | |
parent | 7a47febb2fdb03a743cca60409426ff70cc463a2 (diff) | |
download | vaadin-framework-d0bc54ba4b487fe461cc950de02ec57187c654ad.tar.gz vaadin-framework-d0bc54ba4b487fe461cc950de02ec57187c654ad.zip |
Prevent popup open when datafield is disabled (#13508).
Change-Id: I5bb3ec24ad15d832a43998a4cee49a61ae81562e
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java | 46 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java | 52 |
2 files changed, 98 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java new file mode 100644 index 0000000000..c48d2383a7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java @@ -0,0 +1,46 @@ +/* + * Copyright 2000-2013 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.datefield; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; + +/** + * + * @since 7.1 + * @author Vaadin Ltd + */ +public class DisabledDateFieldPopup extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + DateField field = new DateField(); + field.setEnabled(false); + addComponent(field); + } + + @Override + protected String getTestDescription() { + return "Don't open popup calendar if datefield is disabled"; + } + + @Override + protected Integer getTicketNumber() { + return 13508; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java new file mode 100644 index 0000000000..dc287c19da --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java @@ -0,0 +1,52 @@ +/* + * Copyright 2000-2013 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.datefield; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since 7.1 + * @author Vaadin Ltd + */ +public class DisabledDateFieldPopupTest extends MultiBrowserTest { + + @Test + public void testPopup() { + openTestURL(); + + WebElement button = driver.findElement(By + .className("v-datefield-button")); + button.click(); + + Assert.assertFalse( + "Calendar popup should not be opened for disabled date field on mouse click", + isElementPresent(By.className("v-datefield-popup"))); + + button.sendKeys(Keys.ARROW_DOWN); + + Assert.assertFalse("Calendar popup should not be opened for " + + "disabled date fild on down key", + isElementPresent(By.className("v-datefield-popup"))); + + } +} |