haikuwebkit/LayoutTests/accessibility/aria-switch-checked.html

44 lines
1.5 KiB
HTML
Raw Permalink Normal View History

AX: Implement support for ARIA 1.1 'switch' role https://bugs.webkit.org/show_bug.cgi?id=141986 Reviewed by Chris Fleizach. Source/WebCore: Map the role to ATK_ROLE_TOGGLE_BUTTON for Gtk and Efl; on the Mac, to AXCheckBox with a subrole of AXSwitch. Ensure it looks and acts like a widget to accessibility APIs (supports and emits notifications when toggled, doesn't have children, exposes a name and description when provided). Tests: accessibility/aria-switch-checked.html accessibility/aria-switch-sends-notification.html accessibility/aria-switch-text.html * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::canHaveChildren): (WebCore::AccessibilityNodeObject::isChecked): (WebCore::AccessibilityNodeObject::visibleText): (WebCore::AccessibilityNodeObject::title): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isARIAInput): (WebCore::AccessibilityObject::actionVerb): (WebCore::initializeRoleMap): (WebCore::AccessibilityObject::supportsChecked): (WebCore::AccessibilityObject::checkboxOrRadioValue): * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isSwitch): * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::postPlatformNotification): * accessibility/atk/WebKitAccessibleWrapperAtk.cpp: (atkRole): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]): (-[WebAccessibilityObjectWrapper accessibilityTraits]): (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (createAccessibilityRoleMap): (-[WebAccessibilityObjectWrapper subrole]): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): LayoutTests: * accessibility/aria-switch-checked-expected.txt: Added. * accessibility/aria-switch-checked.html: Added. * accessibility/aria-switch-sends-notification-expected.txt: Added. * accessibility/aria-switch-sends-notification.html: Added. * accessibility/aria-switch-text.html: Added. * accessibility/roles-exposed.html: Added a test case for the new role. * platform/efl/accessibility/aria-fallback-roles-expected.txt: Added. * platform/efl/accessibility/aria-switch-text-expected.txt: Added. * platform/efl/accessibility/roles-exposed-expected.txt: Updated for the new role. * platform/gtk/accessibility/aria-fallback-roles-expected.txt: Added. * platform/gtk/accessibility/aria-switch-text-expected.txt: Added. * platform/gtk/accessibility/roles-exposed-expected.txt: Updated for the new role. * platform/mac-mavericks/accessibility/roles-exposed-expected.txt: Updated for the new role. * platform/mac/TestExpectations: Skip the 'checked' notifcation as the Mac doesn't have it. * platform/mac/accessibility/aria-switch-text-expected.txt: Added. * platform/mac/accessibility/roles-exposed-expected.txt: Updated for the new role. Canonical link: https://commits.webkit.org/160015@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-02-25 01:43:42 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div role="switch" id="switch1">X</div>
<div role="switch" id="switch2" aria-checked="true">X</div>
<div role="switch" id="switch3" aria-checked="false">X</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that ARIA switches correctly handle the aria-checked attribute.");
if (window.accessibilityController) {
// If aria-checked is absent, it should be not checked.
var widget = accessibilityController.accessibleElementById("switch1");
shouldBeFalse("widget.isChecked");
// If aria-checked is present and true, it's clearly checked.
widget = accessibilityController.accessibleElementById("switch2");
shouldBeTrue("widget.isChecked");
// If aria-checked is present and false, it's clearly not checked.
widget = accessibilityController.accessibleElementById("switch3");
shouldBeFalse("widget.isChecked");
// Change the value on the element and be sure we see the change
var element = document.getElementById("switch3");
element.setAttribute("aria-checked", "true");
shouldBeTrue("widget.isChecked");
// Remove the attribute from the element and be sure we see the change
element.removeAttribute("aria-checked");
shouldBeFalse("widget.isChecked");
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>