AX: Role=switch not returning correct accessibilityValue
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 15:07:05 +0000 (15:07 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 15:07:05 +0000 (15:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194006

Reviewed by Joanmarie Diggs.

Source/WebCore:

Return the toggle state of a role=switch element.

Test: accessibility/ios-simulator/role-switch.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityValue]):

LayoutTests:

* accessibility/ios-simulator/role-switch-expected.txt: Added.
* accessibility/ios-simulator/role-switch.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240709 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/role-switch-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/role-switch.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index f2ef8ba..fe9d4ab 100644 (file)
@@ -1,3 +1,13 @@
+2019-01-30  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Role=switch not returning correct accessibilityValue
+        https://bugs.webkit.org/show_bug.cgi?id=194006
+
+        Reviewed by Joanmarie Diggs.
+
+        * accessibility/ios-simulator/role-switch-expected.txt: Added.
+        * accessibility/ios-simulator/role-switch.html: Added.
+
 2019-01-30  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed WPE gardening. Manage failures in the imported WPT tests,
diff --git a/LayoutTests/accessibility/ios-simulator/role-switch-expected.txt b/LayoutTests/accessibility/ios-simulator/role-switch-expected.txt
new file mode 100644 (file)
index 0000000..7e3fe1c
--- /dev/null
@@ -0,0 +1,12 @@
+
+This test thats accessibilityValue is correct for role=switch.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.stringValue is 'AXValue: 1'
+PASS element.stringValue is 'AXValue: 0'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/role-switch.html b/LayoutTests/accessibility/ios-simulator/role-switch.html
new file mode 100644 (file)
index 0000000..e9f1c6a
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+var successfullyParsed = false;
+if (window.testRunner)
+   testRunner.dumpAsText();
+</script>
+</head>
+<body>
+
+<button role="switch" aria-checked="true" id="switch" class="switch">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This test thats accessibilityValue is correct for role=switch.");
+
+    if (window.accessibilityController) {
+
+        var element = accessibilityController.accessibleElementById("switch");
+        shouldBe("element.stringValue", "'AXValue: 1'");
+
+        document.getElementById("switch").ariaChecked = false;
+        shouldBe("element.stringValue", "'AXValue: 0'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
+
index 120c31f..a59039b 100644 (file)
@@ -1,3 +1,17 @@
+2019-01-30  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Role=switch not returning correct accessibilityValue
+        https://bugs.webkit.org/show_bug.cgi?id=194006
+
+        Reviewed by Joanmarie Diggs.
+
+        Return the toggle state of a role=switch element.        
+
+        Test: accessibility/ios-simulator/role-switch.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityValue]):
+
 2019-01-29  Rob Buis  <rbuis@igalia.com>
 
         Align with Fetch on data: URLs
index 25e8bc4..79f344a 100644 (file)
@@ -1404,7 +1404,7 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
         return value;
     
     AccessibilityRole role = m_object->roleValue();
-    if (m_object->isCheckboxOrRadio() || role == AccessibilityRole::MenuItemCheckbox || role == AccessibilityRole::MenuItemRadio) {
+    if (m_object->isCheckboxOrRadio() || role == AccessibilityRole::MenuItemCheckbox || role == AccessibilityRole::MenuItemRadio || role == AccessibilityRole::Switch) {
         switch (m_object->checkboxOrRadioValue()) {
         case AccessibilityButtonState::Off:
             return [NSString stringWithFormat:@"%d", 0];