haikuwebkit/LayoutTests/accessibility/roles-table-and-cell.html

72 lines
2.6 KiB
HTML
Raw Permalink Normal View History

Source/WebCore: Added ARIA 1.1 "cell" and "table" roles. https://bugs.webkit.org/show_bug.cgi?id=146011 <rdar://problem/21398946> Patch by Nan Wang <n_wang@apple.com> on 2015-07-10 Reviewed by Chris Fleizach. Created a new role called GridCellRole to match the gridcell role, so the previous CellRole and TableRole will match to cell and table role. Made the changes to make sure that both GridRole and TableRole have same behavior, as well as the circumstance for GridCellRole and CellRole. Test: accessibility/roles-table-and-cell.html * accessibility/AXObjectCache.cpp: (WebCore::createFromRenderer): * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::supportsRequiredAttribute): (WebCore::AccessibilityNodeObject::canSetSelectedAttribute): * accessibility/AccessibilityObject.cpp: (WebCore::initializeRoleMap): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::setSelectedRows): (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): (WebCore::AccessibilityRenderObject::selectedChildren): * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::roleValue): * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::determineAccessibilityRole): * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]): (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]): (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (createAccessibilityRoleMap): LayoutTests: Added tests for new role: table and cell. https://bugs.webkit.org/show_bug.cgi?id=146011. Patch by Nan Wang <n_wang@apple.com> on 2015-07-10 Reviewed by Chris Fleizach. Added tests for table and cell role. Also modified other tests to fit the changes. * accessibility/roles-computedRoleString-expected.txt: * accessibility/roles-computedRoleString.html: * accessibilit/roles-table-and-cell-expected.txt: Added. * accessibility/roles-table-and-cell.html: Added. * platform/mac/accessibility/aria-table-hierarchy-expected.txt: * platform/mac/accessibility/aria-tables-expected.txt: * platform/mac/accessibility/roles-exposed-expected.txt: Canonical link: https://commits.webkit.org/164929@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-07-10 22:04:50 +00:00
<!DOCTYPE HTML>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<!-- ==================================================================================================== -->
<!-- This tests ARIA table role and cell role work as intended -->
<!-- ==================================================================================================== -->
<div role="grid" data-role="grid" class="ex">
<div role="gridcell" data-role="gridcell" class="ex">data</div>
<div role="cell" data-role="cell" class="ex">data2</div>
<div role="cell" data-role="cell" class="ex">data3</div>
</div>
<table role="table" data-role="table" class="ex">
<td role="gridcell" data-role="gridcell" class="ex">data</td>
<td data-role="cell" class="ex">data2</td>
<td role="cell" data-role="cell" class="ex">data3</td>
</table>
<div id="console"></div>
<script>
if (window.testRunner && window.accessibilityController) {
description("This tests that table and cell have the correct ARIA roles")
var examples = document.querySelectorAll(".ex");
var el, contentAttrRoleString, axElement, computedAriaRole, output, expectedRole, expectation, result, note;
for (var i = 0, c = examples.length; i < c; i++) {
el = examples[i];
el.id = "ex" + i
axElement = accessibilityController.accessibleElementById(el.id);
if (!axElement)
continue;
computedAriaRole = axElement.computedRoleString;
contentAttrRoleString = el.getAttribute("role");
note = el.getAttribute("data-note")
output = el.tagName.toLowerCase() + (contentAttrRoleString ? ("[role=\""+contentAttrRoleString+"\"]") : "") + (note ? note : "");
output += " -> ";
output += computedAriaRole;
output += ". ";
expectedRole = "";
if (el.hasAttribute("data-role")) {
expectedRole = el.getAttribute("data-role");
}
expectation = expectedRole;
matchedResults = (computedAriaRole == expectedRole)
result = document.getElementById('console');
if (matchedResults) {
result.innerText += "PASS: " + output + "\n";
} else {
result.innerText += "FAIL: " + output + "Expected: " + expectation + ".\n";
}
}
// Once tests are complete, hide all the example markup.
examples = document.querySelectorAll(".ex");
for (var i = 0, c = examples.length; i < c; i++) {
el = examples[i];
el.style.display = "none";
}
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>