aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java48
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java43
3 files changed, 93 insertions, 7 deletions
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index 57a0222118..d2c9b7160c 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -458,13 +458,8 @@ public class VPopupCalendar extends VTextualDate implements Field,
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- if (enabled) {
- Roles.getButtonRole().setAriaDisabledState(
- calendarToggle.getElement(), true);
- } else {
- Roles.getButtonRole().setAriaDisabledState(
- calendarToggle.getElement(), false);
- }
+ Roles.getButtonRole().setAriaDisabledState(calendarToggle.getElement(),
+ !enabled);
}
/**
diff --git a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java
new file mode 100644
index 0000000000..c192b561cc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabled.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+import com.vaadin.ui.VerticalLayout;
+
+public class AriaDisabled extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout content = new VerticalLayout();
+ content.setMargin(true);
+ content.setSpacing(true);
+
+ final DateField disabledDateField = new DateField("Disabled DateField");
+ disabledDateField.setEnabled(false);
+
+ setContent(content);
+ content.addComponent(disabledDateField);
+ content.addComponent(new DateField("Enabled DateField"));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Test for aria-disabled attribute on DateField.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13463;
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java
new file mode 100644
index 0000000000..823638ef0c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/AriaDisabledTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class AriaDisabledTest extends MultiBrowserTest {
+
+ @Test
+ public void verifyAriaDisabledAttributes() {
+ openTestURL();
+
+ // Expect aria-disabled="false" on the enabled DateField.
+ String ariaDisabled = driver.findElement(
+ By.vaadin("/VVerticalLayout[0]/VPopupCalendar[1]#popupButton"))
+ .getAttribute("aria-disabled");
+ assertEquals("false", ariaDisabled);
+
+ // Expect aria-disabled="true" on the disabled DateField.
+ ariaDisabled = driver.findElement(By.cssSelector(".v-disabled button"))
+ .getAttribute("aria-disabled");
+ assertEquals("true", ariaDisabled);
+ }
+
+}